$(function() { $("a#additional-cost-info").fancybox({ 'showCloseButton' : false, 'padding' : 0, 'overlayOpacity' : '0.5', 'overlayColor' : '#000000', onStart: function() { $("#fancybox-wrap").css({ width: '320px', margin: 0 }); $("#fancybox-content").css({ width: '314px', margin: 0 }); }, onComplete: function() { $("#fancybox-wrap").css({ width: '320px', margin: 0 }); $("#fancybox-content").css({ width: '314px', margin: 0 }); $.fancybox.center(); } }); });url='http://www.scrapmalin.com/'; url_main='http://www.scrapmalin.com/'; murl='http://www.scrapmalin.com/'; mdurl='http://media-divers.scrapmalin.com/'; /* ISPRO=''; */ ISPRO=0; LangID='0'; /*var produits_id_preco = []; var produits_q_preco = []; var produits_status_preco = [];*/ var produits_id = []; var produits_quantites = []; var produits_status = []; $(document).ready(function() { $('font>table').addClass('xdebug-error'); $('font>table *').removeAttr('style').removeAttr('bgcolor'); $('font>table tr:first-child').addClass('xdebug-error_description'); $('font>table tr:nth-child(2)').addClass('xdebug-error_callStack'); MaJTemplate(); $("#fancybox-wrap").css({ width: '570px' }); $("#demandeCarte").hide(); $("#cartePriv").hide(); $("#consultSolde").hide(); /* Opacité sur le template */ $(".fancybox").fancybox({ onComplete: function() { fancyAjoutPanierSucces(); } }); $("#fancybox-wrap").css({ width: '570px' }); $("#footer #carteMonde a img").css('opacity', '0.6'); $(" a.promo img").css('opacity', '1'); $(".imgOpacity").css('opacity', '1'); $("#footer #carteMonde a img").hover( function () { $(this).css('opacity', '1'); }, function () { $(this).css('opacity', '0.6'); } ); $("a.promo img").hover( function () { $(this).css('opacity', '0.6'); }, function () { $(this).css('opacity', '1'); } ); $(".imgOpacity").hover( function () { $(this).css('opacity', '0.6'); }, function () { $(this).css('opacity', '1'); } ); /* Opacité sur le template */ $(".moncompte").hide(); $("input#pwd").hide(); encours=0; offset={ x:0, y:0 }; heightConnect = $("#meconnecter").height(); $("#meconnecter span").height(heightConnect); $("#meconnecter").click(function(){ encours=1; $(".moncompte").slideToggle("fast",function(){ offset=$(".moncompte").offset(); encours=0; }); }); /*============ESPACE PRO==========*/ /*encourss=0; offsets={ x:0, y:0 }; $("#espacePro").hover(function(){ encourss=1; $(".espaceproMenu").slideDown("fast"); offsets=$(".espaceproMenu").offset(); offsets.left = 919; encourss=0; });*/ if(ISPRO == 1){ $.get("client/client-client.kajax", {action : "getMenuPro"} , function(data){ $("#MenuPro").html(data); $("#MenuProDroite").html(data); $("#fancy_newsletter").fancybox({ 'titleShow' : false, 'overlayOpacity': '0.7', 'overlayColor' : '#000000', 'showCloseButton' : false, 'transitionIn' : 'elastic', 'speedIn' : '100000' }); }); } /*============ESPACE PRO==========*/ /*===== focus sur la connexion ====*/ $("input#pwdhide").focus(function(){ $("input#pwd").show(); $("input#pwdhide").hide(); $("input#pwd").focus(); }); $("input#emailC").focus(function(){ if($("input#emailC").val() == "Votre email"){ emailLang = "Votre email"; } if($("input#emailC").val() == "Ihre E-mail"){ emailLang = "Ihre E-mail"; } if($("input#emailC").val() == "Votre email" || $("input#emailC").val() == "Ihre E-mail"){ $("input#emailC").val(""); } }); $("input#pwd, input#emailC").blur(function(){ if($("input#pwd").val() == ""){ $("input#pwd").hide(); $("input#pwdhide").show(); } if($("input#emailC").val() == ""){ $("input#emailC").val(emailLang); } }); /*===== focus sur la connexion ====*/ $(document).click(function(e) { $('.marques-selector-results').hide(); $('.selector-results').hide(); $('.categories-selector-results').hide(); if($("#compte_connexion").attr('display')!='none' && encours==0){ if((e.pageXoffset.left+288) || (e.pageYoffset.top+482)){ $(".moncompte").slideUp("normal"); } } /*if($(".espaceproMenu").css('display')!='none' && encourss==0){ if((e.pageXoffsets.left+200) || (e.pageYoffsets.top+615)){ $(".espaceproMenu").slideUp("fast"); } }*/ }); $("#InscNews").click(function(){ window.location.href=url+"compte_client/gerer_newsletters.html"; }); $('.marques-selector-btn').click(function(e) { e.stopPropagation(); }); $('.selector-btn').click(function(e) { e.stopPropagation(); }); $('.categories-selector-btn').click(function(e) { e.stopPropagation(); }); /*----- Sous menu -----*/ $(".sousMenu").hide(); $("#droiteMenu ul li").removeClass('active'); $("#droiteMenu ul li").hover( function () { /*$(".sousMenu").eq($(this).index()).show(); $(this).addClass('active'); $("#droiteMenu ul li a").eq($(this).index()+1).css('background-position','-100px');*/ rel = $(this).attr("rel"); $("#"+rel).show(); $(this).addClass('active'); $("#droiteMenu ul li a").eq($(this).index()+1).css('background-position','-100px'); }, function () { $(".sousMenu").hide(); rel = $(this).find("a").attr("rel"); $("#droiteMenu ul li").removeClass('active'); $("#droiteMenu ul li a").eq($(this).index()+1).css('background-position','0 -339px'); } ); $(".sousMenu").hover(function(){ $(this).show(); if(ISPRO == 1){index = $(this).index()-4;}else{index = $(this).index()-5;} //$("#droiteMenu ul li").eq(index+1).addClass('active'); //$("#droiteMenu ul li a").eq(index+2).css('background-position','-100px'); id = $(this).attr("id"); $("#droiteMenu ul li[rel="+id+"]").addClass('active'); $("#droiteMenu ul li[rel="+id+"]").next().find("a").css('background-position','-100px'); }, function(){ $(this).hide(); if(ISPRO == 1){index = $(this).index()-4;}else{index = $(this).index()-5;} $("#droiteMenu ul li").removeClass('active'); id = $(this).attr("id"); //$("#droiteMenu ul li a").eq(index+2).css('background-position','0 -339px'); $("#droiteMenu ul li[rel="+id+"]").next().find("a").css('background-position','0 -339px'); } ); $("#bonnesAffaires").hover(function(){ $(".sousMenu").eq(7).show(); $(this).addClass('active'); }, function () { $(".sousMenu").hide(); $("#gaucheMenu a").removeClass('active'); } ); $("#sousMenuBonnesAffaires").hover(function(){ $(this).show(); var index = 2; $("#gaucheMenu a").eq(index).addClass('active'); }, function(){ $(this).hide(); $("#gaucheMenu a").removeClass('active'); } ); path=$.url.attr("path"); if(path!=null){ path=path.split('/'); if(path[1].lastIndexOf("_") != -1){ textM = path[1].substr(0,path[1].lastIndexOf("_")); }else{ textM = path[1]; } if(textM == "avenue_du_faire"){ textM = "carterie"; } premiereLettre = textM.substr(0,1); premiereLettre = premiereLettre.toUpperCase(); text = premiereLettre + "" + textM.substr(1); $("#sMenu"+text).parent().addClass("active"); } // alert("#sMenu"+text); /*----- Sous menu -----*/ /* Modifié par IDWEB : passé de bind à live pour capturer les balises a ajoute en ajax */ $("a.ajoutPanier").live("click", function() { /* Remise à zéro des variables globales pour la précommande */ /* produits_id_preco = []; produits_q_preco = []; produits_status_preco = [];*/ produits_id = []; produits_quantites = []; produits_status = []; /* On split l'attribut rel avec le caractère espace comme séparateur */ var temp = $(this).attr("rel"); var produits = temp.split(" "); produits = arrayNotEmpty(produits); var nb_produits = produits.length; /* Ajout simple */ if (nb_produits == 1) { /* Récupération de l'ID et cie */ var tab = produits[0].split("-"); var produit_id = tab[1]; var produit_status = tab[2]; var tag = produit_id + "-" + produit_status; /* Si aucune quantité, q est égal à +1 */ var q = "+1"; if ($("#quantite-" + tag).length > 0) { if ($("#quantite-" + tag).attr("disabled") != "disabled") { q = eval($("#quantite-" + tag).val()); } else q = "0"; } /* On vérifie le stock */ $.get('loki/panier-panier.kajax', { action: 'getRemainingStock', quantite: q, produit_id: produit_id, status: produit_status }, function(data) { stock_remaining = eval(data * 1); if(stock_remaining < 0) { /* Alerte stock */ qt = eval(q+stock_remaining); $("#quantite-"+tag).val(qt); calculPrix(tag, qt); if($("p#remise").length == 1) { calculPrixBarre(tag, qt); } /* On affiche l'alerte de stock que s'il n'y a qu'un produit à ajouter, pour éviter d'avoir 50 fois la fenêtre */ $("a#alerte_stock").attr("href",url + 'common/alerte_stock.html?quantite='+q+'&produit_id='+produit_id).click(); /* Fin alerte stock */ /* Affichage de l'ajout au panier */ }else { $.get('loki/panier-panier.kajax', { action: 'pushLigne', quantite: q, produit_id: produit_id, status: produit_status }, function(data) { fancyAjoutPanierSucces(); if ($("a#produit-ajoutpanier-succes-" + produit_id).length > 0) { $("a#produit-ajoutpanier-succes-" + produit_id).trigger('click'); } else { $("a#produit-ajoutpanier-succes").click(); } }); } }); } /* Ajout multiple */ else { var j=0; /* Parcours des produits à ajouter */ for (i = 0; i < nb_produits; i++) { var tabM = produits[i].split("-"); /* produit-- */ var tag = tabM[1] + "-" + tabM[2]; /* Si aucune quantité, q est égal à +1 */ if ($("#quantite-" + tag).length > 0) { if(eval($("#quantite-" + tag).val())>0){ produits_id[j] = tabM[1]; produits_status[j] = tabM[2]; produits_quantites[j] = eval($("#quantite-" + tag).val()); j++; } }else{ produits_quantites[j] = "+1"; j++; } } if(j>0){ /* On vérifie les stocks */ $.post('loki/panier-panier_multiple.kajax', { action: 'getRemainingStock', quantite: produits_quantites, produit_id: produits_id, status: produits_status }, function(data) { stock_remaining = data.split(" "); var produits_id_en_stock = []; var produits_q_en_stock = []; var produits_status_en_stock = []; /* Parcours des produits */ for (i = 0; i < nb_produits; i++) { var tab = produits[i].split("-"); /* produit-- */ produit_id = produits_id[i]; produit_status = produits_status[i]; var tag = produits_id[i] + "-" + produits_status[i]; /* Si aucune quantité, q est égal à +1 */ var produit_q = "+1"; if ($("#quantite-" + tag).length > 0) { if(eval($("#quantite-" + tag).val())>0){ produit_q = eval($("#quantite-" + tag).val()); } } var stock = eval(stock_remaining[i] * 1); /* En stock */ if (stock >= 0) { produits_id_en_stock.push(produit_id); produits_q_en_stock.push(produit_q); produits_status_en_stock.push(produit_status); } /*else if (stock < 0) { produits_id_en_stock.push(produit_id); produits_q_en_stock.push(produit_q); produits_status_en_stock.push(produit_status); produits_id_preco.push(produit_id); produits_q_preco.push(-stock); produits_status_preco.push(produit_status); }*/ } $.post('loki/panier-panier_multiple.kajax', { action: 'pushLigne', quantite: produits_q_en_stock, produit_id: produits_id_en_stock, status: produits_status_en_stock }, function(data) { $("a#multi-ajoutpanier-succes").attr("href", url + "common/ajoutmultirecapitulatif.html?id=" + produits); $("a#multi-ajoutpanier-succes").trigger('click'); }); }); } } return false; }); /* -------- Fin gestion de l'ajout au panier ------- */ /* Fenêtre succès ajout panier * Modifié par NVANNIER : rajout da la fonction live pour détecter les balises a ajoutées en AJAX * */ fancyAjoutPanierSucces(); //.trigger("click"); // $(this).click(); //}); $("a#fermerFancyboxOverview").live('click', function(){ $.fancybox.close(); }); /* Bouton 'Continuer mes achats' */ $("a.continuerAchat").live("click",function(){ $.fancybox.close(); }); /* Bouton 'Gestion des oeillets' */ $("a#oeilletselect").live("click",function(){ var oprix = 0; if($("input#oeillets").attr("checked")){ oprix = parseFloat($("input#oeillets").val()); } // Calcul du prix avec les options if($("input.prixFinal").size()>0){ var opm = parseFloat( $("#oeilletsprix").val()); $("#oeilletsprix").val(oprix); var opf = $("input.prixFinal").val(); opf = parseFloat(opf)- opm + oprix; var otag = $("a.plus").attr("id"); otag = otag.substring(5, otag.length); oqt = $('#quantite-'+otag).val() $('input.prixFinal').val(opf) // Affichage nouveau prix calculPrix(otag, oqt); } }); /* Fin fenêtre succès ajout panier */ /* Ouverture du popup intermédiaire */ $("a.menu-open-intermediate").fancybox({ 'showCloseButton' : false, 'padding' : 0, 'type' : 'inline', onStart: function() { $(".sousMenu").hide(); $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); }, onComplete: function() { $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); } }); }); /* ==== liste select perso RECHERCHE==== */ function toggleMarquesResults() { otherlist = document.getElementById('categories-results'); if(otherlist.style.display == 'block') { otherlist.style.display = 'none'; } elem = document.getElementById('marques-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function toggleCategoriesResults() { otherlist = document.getElementById('marques-results'); if(otherlist.style.display == 'block') { otherlist.style.display = 'none'; } elem = document.getElementById('categories-results'); elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function marquestocategories(num, name) { document.getElementById('marques-results').style.display = 'none'; document.getElementById('marques-btn').innerHTML = name; document.getElementById('marques').value = num; $.get("marque/marque-recherche.kajax",{ action : "GetCategoriesByMarque", marque_id : num },function(data){ $("#categories").val("-1"); $("#categories-btn").html("par catégories"); $("#categories-results").html(data); }); return false; } function selectCategorie(num, name) { document.getElementById('categories-results').style.display = 'none'; document.getElementById('categories-btn').innerHTML = name; document.getElementById('categories').value = num; } function toggleGammesResults() { elem = document.getElementById('gammes-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function selectGamme(num, name) { document.getElementById('gammes-results').style.display = 'none'; document.getElementById('gammes-btn').innerHTML = name; document.getElementById('gamme').value = num; } function toggleTendancesResults() { elem = document.getElementById('tendances-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function selectTendance(num, mois) { window.location.href=url+"stickers/tendance-"+num+".html"; document.getElementById('tendances-btn').innerHTML = mois; } /* ==== liste select perso RECHERCHE==== */ function calculPrixBarre(cible, qte) { cible_temp = cible.split("-"); produit_id_cible = cible_temp[0]; if($("span.prixBarre-"+produit_id_cible).length == 1) { valeur_de_base = parseFloat($("input.prixBarre-"+produit_id_cible).val()); nouvelle_valeur = Math.round((valeur_de_base * parseInt(qte)) * 100) / 100; $("span.prixBarre-"+produit_id_cible).html(nouvelle_valeur + " €"); } else { valeur_de_base = parseFloat($("input.prixBarre").val()); nouvelle_valeur = Math.round((valeur_de_base * parseInt(qte)) * 100) / 100; $("span.prixBarre").html(nouvelle_valeur + " €"); } } function calculPrix(cible, qte) { cible_temp = cible.split("-"); produit_id_cible = cible_temp[0]; if($("span.prixBarre-"+produit_id_cible).length == 1) { valeur_de_base = parseFloat($("input.prixFinal-"+produit_id_cible).val()); nouvelle_valeur = Math.round((valeur_de_base * parseInt(qte)) * 100) / 100; $("p#prixFinal").html(nouvelle_valeur + " €"); } else { valeur_de_base = parseFloat($("input.prixFinal").val()); nouvelle_valeur = Math.round((valeur_de_base * parseInt(qte)) * 100) / 100; $("p#prixFinal").html(nouvelle_valeur + " €"); } } function empty(mixed_var) { var key; if (mixed_var === "" || mixed_var === 0 || mixed_var === "0" || mixed_var === null || mixed_var === false || typeof mixed_var === 'undefined' ){ return true; } if (typeof mixed_var == 'object') { for (key in mixed_var) { return false; } return true; } return false; } function arrayNotEmpty(tab) { var nb = tab.length; var newTab = []; for (i = 0; i < nb; i++) { if (!empty(tab[i])) newTab[newTab.length] = tab[i]; } return newTab; } function fancyAjoutPanierSucces() { $("a#produit-ajoutpanier-succes, a.produit-ajoutpanier-succes").fancybox({ 'showCloseButton': false, 'padding' : 0, onStart: function() { }, onComplete: function() { $("#fancybox-content, #fancybox-wrap").css({ width: '800px', margin: 0 }); /*$("#fancybox-wrap").css({ width: '780px' });*/ $.fancybox.center(); } }); $("a#alerte_stock").fancybox({ 'titleShow' : false, 'overlayOpacity' : '0.7', 'overlayColor' : '#777777', 'transitionIn' : 'elastic', 'orig' : $("#ajoutPanier"), 'speedIn' : '100000', 'showCloseButton' : false, onStart: function() { $("#fancybox-content").css({ border: '10px solid #fff' }); } }); } function auth(){ var login = encodeURIComponent($("#emailC").val()); var passwd = encodeURIComponent($("#pwd").val()); $.ajax({ url : 'client/client-client.kajax', dataType: 'json', type: 'GET', data: 'action=getAvailableFeatures&ILOGIN='+login+'&IPASS='+passwd, success: function(data) { splashscreen_url = url + "common/connect_splashscreen.html"; $("#hiddenlink").fancybox({ 'overlayOpacity' : '0.5', 'overlayColor' : '#000000', 'showCloseButton' : false, 'padding' : 0, onComplete: function() { $("#fancybox-content").css("width", "716px"); $("#fancybox-wrap").css("width", "756px"); $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); } }); if(data == "0") { $("#hiddenlink").attr("href", splashscreen_url + "?auth=" + data).trigger('click'); }else if(data == "11") { $("#hiddenlink").attr("href", splashscreen_url + "?auth=" + data).trigger('click'); } else if(data.authOK == "1") { $("#hiddenlink").attr("href", splashscreen_url + "?auth=" + data.authOK).trigger('click'); var nomPrenom = data.prenom+" "+data.nom; var chaine = nomPrenom; var lg_max = 13; //nombre de caractère autoriser if (chaine.length > lg_max) { chaine = chaine.substring(0, 10); nomPrenom = chaine+"..."; } if(ISPRO == 1){ $.get("client/client-client.kajax", {action : "getMenuPro"} , function(data){ $("#MenuProDroite").html(data); }); } $("#meconnecter span.nomPrenom").html(nomPrenom); $("#formConnect").hide(); $("#nouvClient").hide(); $("#sedeconnecter").addClass("connecte"); //alert(data.carteClub); // carte scrapmalin if(data.carteClub == "0" && data.carteScrap == "0"){ $("#demandeCarte").show(); } if(data.carteScrap == "1"){ $("#cartePriv").show(); $("#consultSolde").show(); $("#demandeCarte0").hide(); } if(data.carteClub == "1"){ $("#consultSolde").show(); $("#demandeCarte0").hide(); } // fin carte scrapmalin } } }); $(".moncompte").hide(); return false; } function MaJTemplate(){ $.getJSON("client/client-client.kajax",{ action : "getTemplateData" },function(data){ if(typeof(data.nom)!='undefined'){ $(".nomPrenom").html(data.nom); $("#formConnect").hide(); $("#nouvClient").hide(); $("#sedeconnecter").addClass("connecte"); //alert(data.carteClub); // carte scrapmalin if(data.carteClub == "0" || data.carteScrap == "0"){ $("#demandeCarte").show(); } if(data.carteScrap == "1"){ $("#consultSolde").show(); $("#demandeCarte").hide(); } if(data.carteClub == "1"){ $("#consultSolde").show(); $("#demandeCarte").hide(); } }else{ $("#demandeCarte").show(); } $("#qtArticlePanier").html(data.articles); }); } function MaJNbArticle(){ $.get("panier/panier-panier.kajax",{ action : "getNbArticle" },function(data){ $("#qtArticlePanier").html(data); }); } function round(number,X) { X = (!X ? 2 : X); z=Math.round(number*Math.pow(10,X))/Math.pow(10,X); x=''+z+''; pos=x.indexOf('.'); if (pos==-1) z=z+'.0'; if (pos==x.length-2) z=z+'0'; return z; } function pushFavoris() { if (navigator.appName != "Microsoft Internet Explorer"){ window.sidebar.addPanel(document.title,window.location,''); }else { window.external.AddFavorite(window.location,document.title); } } /* ==== Ideco Chargement de photo ==== */ function toggleTypesResults() { otherlist1 = document.getElementById('rubriques-results'); otherlist2 = document.getElementById('share-photo-familles-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('types-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function toggleRubriquesResults() { otherlist1 = document.getElementById('types-results'); otherlist2 = document.getElementById('share-photo-familles-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('rubriques-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function toggleFamillesResults() { otherlist1 = document.getElementById('rubriques-results'); otherlist2 = document.getElementById('types-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('share-photo-familles-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function selectTypePiece(num, name) { document.getElementById('types-results').style.display = 'none'; document.getElementById('types-btn').innerHTML = name; document.getElementById('typePiece').value = num; } function selectSharePhotoFamille(sca_num, ssca_num, name) { document.getElementById('share-photo-familles-results').style.display = 'none'; document.getElementById('share-photo-familles-btn').innerHTML = name; document.getElementById('share-photo-famille').value = sca_num; document.getElementById('share-photo-sousfamille').value = ssca_num; } function selectRubrique(num, name) { document.getElementById('rubriques-results').style.display = 'none'; document.getElementById('rubriques-btn').innerHTML = name; document.getElementById('rubrique').value = num; $.get("photo-recherche.kajax",{ action : "GetFamillesByRubrique", rubrique : num },function(data){ $("#share-photo-famille").val("-1"); $("#share-photo-familles-btn").html("Famille"); $("#share-photo-familles-results").html(data); }); return false; } /* ==== Ideco filtre photo ==== */ function toggleFiltreTriFieldResults() { otherlist1 = document.getElementById('filtre-photo-rubriques-results'); otherlist2 = document.getElementById('filtre-photo-familles-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('filtre-photo-triFields-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function toggleFiltreRubriquesResults() { otherlist1 = document.getElementById('filtre-photo-triFields-results'); otherlist2 = document.getElementById('filtre-photo-familles-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('filtre-photo-rubriques-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function toggleFiltreFamillesResults() { otherlist1 = document.getElementById('filtre-photo-rubriques-results'); otherlist2 = document.getElementById('filtre-photo-triFields-results'); if(otherlist1.style.display == 'block') { otherlist1.style.display = 'none'; } if(otherlist2.style.display == 'block') { otherlist2.style.display = 'none'; } elem = document.getElementById('filtre-photo-familles-results') elem.style.display = (elem.style.display == 'none') ? 'block': 'none'; } function selectFiltreTriField(num, name) { document.getElementById('filtre-photo-triFields-results').style.display = 'none'; document.getElementById('filtre-photo-triFields-btn').innerHTML = name; document.getElementById('tri').value = num; } function selectFiltreFamille(sca_num, ssca_num, name) { document.getElementById('filtre-photo-familles-results').style.display = 'none'; document.getElementById('filtre-photo-familles-btn').innerHTML = name; document.getElementById('famille').value = sca_num; document.getElementById('sousfamille').value = ssca_num; } function selectFiltreRubrique(num, name) { document.getElementById('filtre-photo-rubriques-results').style.display = 'none'; document.getElementById('filtre-photo-rubriques-btn').innerHTML = name; document.getElementById('rubrique').value = num; $.get("photo-recherche2.kajax",{ action : "GetFamillesByRubrique", rubrique : num },function(data){ $("#famille").val("-1"); $("#filtre-photo-familles-btn").html("Famille"); $("#filtre-photo-familles-results").html(data); }); return false; } $(function() { if($.browser.msie) { if($.browser.version=="6.0") { /* Mercerie : Fiche-fils */ $("#mercerieTab4ColonnesConteneur").css("position","absolute"); $('#mercerieFiche').height($('#mercerieFiche').height()+$('#mercerieTab4ColonnesConteneur').height()); /* Correction bug ie6 pour slideMenu */ $("#categorie-menu-sidebar-plus li.first,#categorie-menu-sidebar li.first").css("zoom","1"); /* Compte client */ $(".compte-client-panier-sauvegarde").css({ width: "770px" }); $("#presentationCartes").css({ clear: "both", width: "795px", height: "860px", backgroundColor: "transparent" }); }else if($.browser.version=="7.0") { $("#prixPanier").css("padding-top", "50px"); }else if($.browser.version=="8.0") { }else if($.browser.version!="9.0") {} } if($.browser.opera) { $("#flash2 #bandeMenuFlash #menuFlash li a").css("font-size", "19px"); $("#flash2 .sMenuFlash li a").css("font-size","16px"); } });$(function() { $("#connect-splashscreen-close").live("click", function() { $.fancybox.close(); }); });var isCtrl = false; function overviewCall() { $(document) .keyup(function(key) { key = key||window.event; code = (key.keyCode ? key.keyCode : key.which); if(key.ctrlKey || code==17) { isCtrl = false; } }) .keydown(function(key) { key = key||window.event; code = (key.keyCode ? key.keyCode : key.which); if(key.ctrlKey || code==17) { isCtrl = true; } }); $(".imgProdCat, .apercu").mousedown(function(e) { mouseBtn = e.button; parentElem = $(this).parent(); isOverview = true; isFiche = false; temp_element = parentElem.attr("id").split("-"); produit_id = temp_element[1]; if($.browser.msie) { if(mouseBtn == 1) { /* Click gauche */ isOverview = true; isFiche = false; } else if(mouseBtn == 2 || mouseBtn == 4) { /* Click droit / Click molette */ isOverview = false; isFiche = true; } } else { if(mouseBtn == 0 && isCtrl) { /* Ctrl + Click gauche */ isOverview = false; isFiche = true; } else { if(mouseBtn == 0) { /* Click gauche */ isOverview = true; isFiche = false; } else if(mouseBtn == 1 || mouseBtn == 2) { /* Click droit / Click molette */ isOverview = false; isFiche = true; } } } elems = $("#image-overview-"+produit_id+" , #button-overview-"+produit_id); if(isOverview) { url_overview = parentElem.attr("rel"); elems.fancybox({ 'showCloseButton' : false, 'href' : url_overview, 'padding' : 0, 'type' : 'inline', onComplete: function() { $("#fancybox-content").css("width", "764px"); $("#fancybox-wrap").css("width", "804px"); $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); fancyAjoutPanierSucces(); $(this).trigger("click"); /*pngFixFancyboxs();*/ } }); } if(isFiche) { url_fiche = parentElem.attr("name"); elems.unbind("click.fb"); elems.attr("href", url_fiche); } return false; }); /** * SAUVEGARDE DE L'ANCIEN APPEL DE LA FANCYBOX POUR L'OVERVIEW */ /*$(".imgProdCat, .apercu").fancybox({ 'showCloseButton' : false, 'padding' : 0, onComplete: function() { $("#fancybox-content, #fancybox-wrap").css({ width: '742px', margin: 0 }); $.fancybox.center(); fancyAjoutPanierSucces(); } });*/ }var defaultQEBorderColor = "#646464"; var errorQEBorderColor = "#e00"; $(function() { $("a#btn-produit-ask-question-expert").fancybox({ 'showCloseButton' : false, 'padding' : 0, 'type' : 'inline', onStart: function() { $("#fancybox-content").css("width", "756px"); $("#fancybox-wrap").css("width", "804px"); $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); }, onComplete: function() { $("#fancybox-content").css("width", "756px"); $("#fancybox-wrap").css("width", "804px"); $("#fancybox-content, #fancybox-wrap").css({ margin: 0, opacity: 1 }); $.fancybox.center(); } }); $("a#question-expert-fb-closeBtn").live("click", function() { $.fancybox.close(); }); $("input#question-expert-fb-submit").live("click", function() { resetQEForm(); if(checkQEForm()) { $(this).attr({ value: "Envoi en cours", disabled: "disabled" }) produit_id = $("#question-expert-fb-produit-id").val(); email = $("#question-expert-fb-email").val(); question = $("#question-expert-fb-question").val(); $.post('produit-questionExpert.kajax', { action: 'sendQuestion', produit_id: produit_id, email: email, question: question }, function(data) { if(data == "0") { html = "

Echec de l'envoi de votre question à l'expert.

"; $("#question-expert-fb-form").prepend(html); $("input#question-expert-fb-submit").attr("value", "Envoyer votre question").removeAttr("disabled"); window.setTimeout(function() { $("#question-expert-fb-error-msg").fadeOut(); }, 6000); } else if(data == "1") { html = "

Votre question à l'expert a bien été envoyée.

Fermer cette fenêtre

"; $("#question-expert-fb-container").html(html); } }); } else { $(this).attr("value", "Envoyer votre question").removeAttr("disabled"); } }); $("#question-expert-fb-email, #question-expert-fb-question").live("focus", function() { resetQEForm(); }); }); function resetQEForm() { if($("span.question-expert-fb-error").length > 0) { $("span.question-expert-fb-error").remove(); $("#question-expert-fb-email, #question-expert-fb-question").css("border-color", defaultQEBorderColor); } } function checkQEForm() { flag = true; emailPattern = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]{2,}([.][a-zA-Z]{2,3}){1,}$/; if(!emailPattern.test($("#question-expert-fb-email").val()) && $("#question-expert-fb-email").val() != "") { flag = false; $("#question-expert-fb-input-error").append('Email non valide'); } else if($("#question-expert-fb-email").val() == "") { flag = false; $("#question-expert-fb-input-error").append('Veuillez saisir votre email'); } if(!flag) { $("#question-expert-fb-email").css("border-color", errorQEBorderColor); } if($("#question-expert-fb-question").val() == "") { flag = false; $("#question-expert-fb-textarea-error").append('Veuillez saisir la question à poser à notre expert'); $("#question-expert-fb-question").css("border-color", errorQEBorderColor); } return flag; }$(function() { $("a.moins").live("click", function() { temp = $(this).attr("id"); tag = temp.substring(6, temp.length); q = eval($("#quantite-"+tag).val() + "-1"); if(q > 0) { $("#quantite-"+tag).val(q); calculPrix(tag, q); if($("p#remise").length == 1) { calculPrixBarre(tag, q); } return false; } return false; }); $("a.plus").live("click", function() { temp = $(this).attr("id"); tag = temp.substring(5, temp.length); q = eval($("#quantite-"+tag).val() + "+1"); $("#quantite-"+tag).val(q); calculPrix(tag, q); if($("p#remise").length == 1) { calculPrixBarre(tag, q); } return false; }); $("input[id^=quantite-]") .live("keyup", function() { temp = $(this).attr("id"); tag = temp.substring(9, temp.length); nb = $(this).val(); if(isNaN($(this).val()) || $(this).val()=="" || $(this).val() <= 0) { calculPrix(tag, 1); if($("p#remise").length == 1) { calculPrixBarre(tag, 1); } } else { calculPrix(tag, nb); if($("p#remise").length == 1) { calculPrixBarre(tag, nb); } } }) .live("blur", function() { if(isNaN($(this).val()) || $(this).val()=="" || $(this).val() <= 0) { temp = $(this).attr("id"); tag = temp.substring(9, temp.length); $("#quantite-"+tag).val('1'); calculPrix(tag, 1); if($("p#remise").length == 1) { calculPrixBarre(tag, 1); } } }); $("a#produit-ajoutpanier-succes").live("click", function() { fancyAjoutPanierSucces(); }); $(".photoProduitMini").live('mouseover mouseout',function(event){ if($(this).parent().attr("id") == "photoProduitOverview") { if (event.type == 'mouseover') { temp=$(this).attr("id"); target=temp.substring(19, temp.length); }else{ temp=$("a[id^='photoProduitMaxiOverview-']").attr('id'); target=temp.substring(25,temp.length); } src="http://www.scrapmalin.com/images/300/"+target; $("#imgPrincipal").attr("src",src); } }); });jQuery.fn.pngFix = function(settings) { settings = jQuery.extend({ imgs: true, backgrounds: true, shim: 'x.gif', apply_positioning: true }, settings); return this.each(function(){ if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) { jQuery(this).find('*').andSelf().each(function(i,obj) { var self = jQuery(obj); if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) { var bg = self.css('background-image'); var src = bg.substring(5,bg.length-2); var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale'); var styles = { 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')", 'background-image': 'url('+settings.shim+')' }; self.css(styles); }; if (settings.imgs && self.is('img[src$=png]')){ var styles = { //'width': self.width() + 'px', //'height': self.height() + 'px', 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')" }; self.css(styles).attr('src', settings.shim); }; if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){ self.css('position', 'relative'); }; }); }; }); };$(function() { /*$("#fancybox-overlay").live("click", function() { return false; });*/ $("#valide_continue").live('click', function() { var choix = $("input[name='choix-panier']:checked").val(); if (choix != "0" && choix != "1") { alert('Vous devez sélectionner un choix.'); return false; } if (choix == "0") { fermer_fancy(); } else { effacerPreco(fermer_fancy); } }); /*"delPrecommande"*/ $("#valide_acces_panier").live('click',function() { var choix = $("input[name='choix-panier']:checked").val(); if (choix != "0" && choix != "1") { alert('Vous devez sélectionner un choix.'); return false; } if (choix == "0") { aller_panier(); } else { effacerPreco(aller_panier); } }); }); function aller_panier() { document.location = "http://www.scrapmalin.com/commande/etape_1.html"; } function fermer_fancy() { $.fancybox.close(); } function effacerPreco(fn) { $.get("panier-panier_multiple.kajax", { action: 'delPrecommande', produit_id: produits_id }, function(data) { fn(); }); }$(function() { /** * Si le navigateur est Internet Explorer en version 6.0 */ if($.browser.msie && $.browser.version=="6.0") { /* Liste des images en background */ imagesList = new Array( 'a#img-jeuxconcours', 'div#imgMenuFlash' ); /* Blank image */ shimImg = "http://www.scrapmalin.com/media_template_default_blank.gif"; $(window).load(function(){ /* Toutes les images PNG chargé via la balise */ $("img[src$='png']").each(function() { if($(this).attr("id") != "tableauCartes") { /** * 'img_w' && 'img_h' : Correctifs au plugin pngFix qui redimensionne aléatoirement les images */ img_w = $(this).width(); img_h = $(this).height(); $(this).pngFix({ shim: shimImg }); $(this).attr("width", img_w).attr("height", img_h); } }); }); /* Toutes les images en background citées dans le tableau 'imagesList' */ for(i=0; i 0) { $(imagesList[i]).pngFix({ shim: shimImg }); } } } }); function pngFixAfterLoad() { if($.browser.msie && $.browser.version=="6.0") { $("img[src$='png']").each(function() { if($(this).attr("id") != "tableauCartes") { /** * 'img_w' && 'img_h' : Correctifs au plugin pngFix qui redimensionne aléatoirement les images */ img_w = $(this).width(); img_h = $(this).height(); $(this).pngFix({ shim: shimImg }); $(this).attr("width", img_w).attr("height", img_h); } }); } } function pngFixFancyboxs() { if($.browser.msie && $.browser.version=="6.0") { $("#fancybox-content img[src$='png']").each(function() { img_w = $(this).width(); img_h = $(this).height(); $(this).pngFix({ shim: shimImg }); $(this).attr("width", img_w).attr("height", img_h); }); } }$(function() { $(".close-simple-message").live("click", function(){ $.fancybox.close(); }); $("#preco").live("click", function(){ produit_id=$("#produit_id").val(); qt=$("#q").val(); $.get("panier-panier.kajax", { action : "pushLigne", produit_id : produit_id, quantite : qt, status : 1 }, function(){ $("div.fancy_alerte").remove(); $("#fancy-end-succes").load($("a#produit-ajoutpanier-succes").attr("href")); $("#fancybox-content").css({ border: 0, width: '800px' }); $("#quantite-"+produit_id+"-0").val(qt); calculPrix(produit_id+"-0", qt); if($("p#remise").length == 1) { calculPrixBarre(produit_id+"-0", qt); } return false; }); }); $("#close-preco").live("click", function(){ produit_id=$("#produit_id").val(); qt_origine=$("#qo").val(); $.get("panier-panier.kajax", { action : "pushLigne", produit_id : produit_id, quantite : qt_origine, status : 0 }, function(){ $("div.fancy_alerte").remove(); $("#fancy-end-succes").load($("a#produit-ajoutpanier-succes").attr("href")); $("#fancybox-content").css({ border: 0, width: '800px' }); return false; }); }); });/** * Prévenir disponibilité (Produits en rupture de stock) */ $(function() { /* page produit */ $("#alerte_prevenir, a.alerte_prevenir").fancybox({ 'showCloseButton' : false, 'padding' : 0, 'overlayOpacity' : '0.5', 'overlayColor' : '#000000', onStart: function() { $("#fancybox-wrap").css({ width: '426px', margin: 0 }); $("#fancybox-content").css({ width: '400px', margin: 0 }); }, onComplete: function() { $("#fancybox-wrap").css({ width: '426px', margin: 0 }); $("#fancybox-content").css({ width: '400px', margin: 0 }); $.fancybox.center(); } }); $("#prevenir, a.prevenir").live("click", function() { if($(this).hasClass("prevenir")) { produit_id = $(this).attr("rel"); } else { $("#alerte_prevenir").trigger('click'); } }); /* page overview */ $("a.prevenirOverview").live("click", function(){ open_url = $("#alerte_prevenir").attr('href'); $("#fancybox-content").load(open_url); $("#fancybox-content, #fancybox-wrap").css({ width: '400px', margin: 0 }); }); /* Traitement */ $("#confirm_prevenir").live("click", function(){ $("#info").remove(); temp = $("input.produit_prevenir").attr('id'); target = temp.split("-"); produit = target[1]; $.get("produit-indisponible.kajax",{ pid : produit, mail : $("#mail_prevenir").val() },function(data){ if(data=="Mail"){ $("#texte_fancy_error").html("Veuillez saisir un mail valide"); }else if(data!="Erreur"){ $("#texte_fancy").html("Un mail vous sera envoyé quand ce produit sera de nouveau en stock.") } }); }); });