function convertPrix(p) { for (prop in p) { if (prop.indexOf("prix",0) == 0) { var val = p[prop] p[prop] = {entier:Math.floor(val),decimal:Math.floor((val-Math.floor(val))*100)} } } } function changeParamsDVDVOD(action, id) { document.getElementById('form_dvdvod_addtocart'+id).action = action; } function verifParamsDVDVOD(id) { if (document.getElementById('form_dvdvod_addtocart'+id).action != '') document.getElementById('form_dvdvod_addtocart'+id).submit(); else alert('Merci de cocher l\'une des offres pour l\'ajouter à votre panier') } function prixJS(prix) { var entier = prix.entier var decimales = prix.decimal var resultat = ''; resultat += ''; resultat += ''; if (decimales != "0" && decimales != "00" && decimales != '' && decimales != null) resultat += ''; resultat += '

'+entier+'

'+decimales+'

'; return resultat } function loadingDVDVODBloc(blocCible, blocsIDs) { blocsIDs = blocsIDs.split(','); for (i = 0; i < blocsIDs.length; i++) document.getElementById(blocCible+blocsIDs[i]).innerHTML = '
Chargement des produits...
'; } function adjustDVDVODShopping(xhr, divCible, fnGenText, modemax, max) { if (xhr.responseText != "False") { if (undefined == max) max = 1 var nbfmax = 0 var produitsDVDVOD = eval('('+xhr.responseText+')'); if (produitsDVDVOD.total > 0){ for(i = 0;i < produitsDVDVOD.total;i++) { if (produitsDVDVOD.rows[i].prix != '' && (nbfmax < max)) { convertPrix(produitsDVDVOD.rows[i]); document.getElementById(divCible+produitsDVDVOD.rows[i].produitdvdvod).innerHTML = fnGenText(produitsDVDVOD.rows[i], produitsDVDVOD.rows[i].cfilm); if (modemax == true) nbfmax++; } else { DivOff(divCible+'bloc'+produitsDVDVOD.rows[i].produitdvdvod); } } } else { if(undefined != document.getElementById(divCible+'all')) document.getElementById(divCible+'all').style.display='none'; noProducts = true; } } else { if(undefined != document.getElementById(divCible+'all')) document.getElementById(divCible+'all').style.display='none'; } } var ajaxTimeout; var test2; var go = true; var accessSuccess = false; var noProducts = false; function closeloadingDVDVODBloc(divCible, blocsIDs) { go = false; if (false == accessSuccess || true == noProducts) { blocsIDs = blocsIDs.split(','); for (i = 0; i < blocsIDs.length; i++) { document.getElementById(divCible+blocsIDs[i]).innerHTML = ""; } } clearInterval(ajaxTimeout); } function testProducts(divCible, blocsIDs) { ajaxTimeout = setInterval('closeloadingDVDVODBloc("'+divCible+'", "'+ blocsIDs +'")', 5000); } function getProduitsDVDVOD(divCible, params, fnGenText, modemax, max, mode) { new ACAjax.Request( '/skin/ajax/dvdvod.html', { method:'post', onSuccess:function(xhr){if(true == go) {adjustDVDVODShopping(xhr, divCible, fnGenText, modemax, max); if('vod' == mode) adjustBlocsVOD(xhr, divCible); if(xhr.responseText != "False") accessSuccess = true; else accessSuccess = false;}}, onFailure:function(){if(true == go) {DivOff(divCible+'all');}}, parameters:params } ) } function construcDVDVODblocVOD (produit) { var URLDVDVOD = 'http://glowria.allocine.fr' var actionFormInit = '' var checkedInit = '' if (undefined != produit.prixdvd && (undefined == produit.prixvodlocation && undefined == produit.prixvodillimite)) { actionFormInit = URLDVDVOD + produit.urldvd checkedInit = 'checked' } if (undefined != produit.prixvodlocation && (undefined == produit.prixdvd && undefined == produit.prixvodillimite)) { actionFormInit = URLDVDVOD + produit.urlvodlocation checkedInit = 'checked' } if (undefined != produit.prixvodillimite && (undefined == produit.prixdvd && undefined == produit.prixvodlocation)) { actionFormInit = URLDVDVOD + produit.urlvodillimite checkedInit = 'checked' } var resultat = '
' if (undefined != produit.prixdvd) { resultat += '' } if (undefined != produit.prixvodlocation) { resultat += '' } if (undefined != produit.prixvodillimite) { resultat += '' } resultat += '
' + prixJS(produit.prixdvd) + '

Location DVD

' + prixJS(produit.prixvodlocation) + '

Télécharger en VOD (' + produit.dureelicence + 'h)

' + prixJS(produit.prixvodillimite) + '

Télécharger en VOD (achat)

' return resultat } function adjustBlocsVOD(xhr, bloc){ var ele = IDsVOD.split(','); var tmpEle; var tmpEle2; var cptAff = 0; var lastEle; if (xhr.responseText != "False") { var elements = eval('('+xhr.responseText+')'); for (i = 0; i < elements.total; i++){ tmpEle = document.getElementById(bloc+'bloc'+ele[i]); if ('none' == tmpEle.style.display) { for (j = i+1; j < elements.total; j++) { tmpEle2 = document.getElementById(bloc+'bloc'+ele[j]); if('none' != tmpEle2.style.display) { tmpEle.innerHTML = tmpEle2.innerHTML; tmpEle.style.display = ''; tmpEle2.style.display = 'none'; tmpEle.style.align='left' cptAff++; lastEle = i; break; } } } else cptAff++; } } if (cptAff%4 != 0) { if(undefined != lastEle) { tmpEle = document.getElementById(bloc+'bloc'+ele[lastEle]); var newEle = document.createElement('td'); newEle.style.width = '100%' tmpEle.parentNode.appendChild(newEle); } } }