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 += ''+entier+' | ';
resultat += ' € | ';
if (decimales != "0" && decimales != "00" && decimales != '' && decimales != null)
resultat += ''+decimales+' | ';
resultat += '
';
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 = '