function createCookie(name, value, days) { var expires; if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.toGMTString(); } else { expires = ""; } document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + expires + "; path=/"; } function readCookie(name) { var nameEQ = encodeURIComponent(name) + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) === 0) return decodeURIComponent(c.substring(nameEQ.length, c.length)); } return null; } createCookie('cookie',1,1); function eraseCookie(name) { createCookie(name, "", -1); } function resize_hauteur(tab){ if (tab instanceof Array){ max_height = ''; for (var i=0; i $(max_height)[0].getBoundingClientRect().height){ max_height = tab[i]; } } } for (var i=0; i max_height){ max_height = $(this)[0].getBoundingClientRect().height; } }) $(tab).each(function(){ $(this).css("min-height",max_height); }) } } function aff_alert(chaine,url) { if(url==1) { apprise(chaine, {'verify':false}, function(r) { if(r) { //window.location.href=''; window.location.reload(); } else { } }); } else { apprise(chaine); } } function showElement(el){ if($(el).css('display') == 'none'){ $(el).show(); }else{ $(el).hide(); } } function showModif(el, el1){ $(el).fadeOut(1000, function () { $(el1).fadeIn("slow"); }); } /* $('.blink').each(function() { var elem = $(this); setInterval(function() { if (elem.css('visibility') == 'hidden') { elem.css('visibility', 'visible'); } else { elem.css('visibility', 'hidden'); } }, 1000); });*/ function test_chiffre(el) { reg = new RegExp("[^(0-9)]", "g"); if (el.value != "") { if (reg.test(el.value)){ //alert("ALERTE_CHIFFRE"); el.value = el.value.replace(reg, ''); } } } $(function(){ $('input.int').keyup(function() { test_chiffre(this); }); $('input.limit_pourcent').keyup(function() { $('input.limit_pourcent').each(function() { if($(this).val()>100 || $(this).val()<0){ $(this).val(""); } }); }); }); function ajouter_panier(id,bloc){ $.ajax({ cache:false, type: "POST", url: "pages/include/boutique_ajouter_panier.php", data: {"id":id}, success: function(resultat){ aff_alert(resultat); var page = $("#page").val(); $("#"+bloc).load("pages/include/boutique_panier.php?page="+page); } }); if($("#page_nb_produit").val()=="page_espace"){ load_nb_produit("#nb_produit"); } } function ajouter_participant_panier(bloc){ var e=""; var regex = /^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/; e += $.trim($("#nom_participant").val()) !="" ? "": "Veuillez saisir le nom du participant
"; e += $.trim($("#prenom_participant").val()) !="" ? "": "Veuillez saisir le prénom du participant
"; e += $.trim($("#mail_participant").val()) !="" ? "": "Veuillez saisir l'adresse Email du participant
"; e += regex.test($("#mail_participant").val()) ? "" : "Veuillez saisir une adresse Email valide
"; e += $("form#participant input[name='id_produit[]']").is(":checked") ? "": "Veuillez sélectioner au moins un événement
"; if(e!=""){ aff_alert(e); }else{ $.ajax({ cache:false, type: "POST", url: "pages/include/boutique_ajouter_evenement_panier.php", data: $("form#participant input").serialize(), success: function(resultat){ aff_alert(resultat); $("form#participant input[type='text']").each(function(){ $(this).val(""); }); $("form#participant input").removeAttr("checked"); $("#"+bloc).load("pages/include/boutique_panier.php"); } }); } } function load_nb_produit(bloc){ $.ajax({ cache:false, type: "POST", url: "pages/include/boutique_nb_produit_panier.php", success: function(resultat){ $(bloc).html(resultat); } }); } function load_info(id){ $.ajax({ cache:false, type: "POST", url: "pages/include/boutique_detail_produit.php", data: {"id":id}, success: function(resultat){ $("#detail_produit").html(resultat); $.colorbox({inline:true, close:'', href:'#detail_produit', innerWidth:'850px', innerheight:"90%"}) } }); } function supprimer_panier(id,bloc){ apprise( 'Confirmez-vous la suppression ?', { 'verify':true,'textYes' : 'Oui', 'textNo' : 'Non'}, function(r) { if(r) { $.ajax({ cache:false, type: "POST", url: "pages/include/boutique_supprimer_panier.php", data: {"id":id}, success: function(resultat){ aff_alert(resultat); $("#"+bloc).load("pages/include/boutique_panier.php"); } }); } else{} }); } function printBon() { var opts = 'scrollbars=yes,resizable=yes,menubar=no,status=yes'; var w = 650; var h = 400; var pw = window.open('printBon.php','pwin','width='+w+',height='+h+',top=5,left=5,'+opts); } function calcul_total(el,dest){ var total = 0; var txt = ''; $(el).each(function(){ total += isNaN(parseFloat($(this).val())) ? 0 : parseFloat($(this).val()); }); $(dest).val(total); } function check_convention(val,el){ if(val==3){ $("#autre_convention"+el).removeAttr("disabled").show(); }else{ $("#autre_convention"+el).hide().prop("disabled","disabled"); } } function check_cgv(){ if($("#cgv").is(":checked")){ window.location.href='/validation_panier-30.html'; }else{ aff_alert("Vous devez accepter les conditions générales de vente pour terminer votre commande."); return false; } } function close_block(el){ $(el).fadeOut(); }