/**
 *
 * @author	Benoit Asselin <benoit(at)agenceici(dot)com>
 * @version	javascript.js, 2011/04/07
 * @link	http://www.agenceici.com/
 *
 */

function noSpam(e,d,c,a){var b="mailto:"+e+"@"+d+"."+c;if(a!==undefined){b+="?subject="+encodeURIComponent(a)}window.location.href=b;return false}(function(a){a.fixPNG=function(){if(a.browser.msie&&a.browser.version<="6.0"){a('img[src$=".png"]').each(function(){a(this).css({width:a(this).width(),height:a(this).height(),filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a(this).attr("src")+"',sizingMethod='image')"}).attr("src",Globals.path+"images/none.gif")})}};a.fn.slideImages=function(){return this.each(function(){var e=this;var c=a(e).find("ul");var j=a(e).find("li");var g=false;var h=0;function f(i){a("#slide-dot a").eq(h).removeClass("hover").removeClass("active").addClass("normal");if(i!==undefined){clearInterval(g);g=setInterval(function(){f()},5000);h=i}else{h++}if(h>=j.length){h=0}c.animate({left:-(j.width()*h)},800);a("#slide-dot a").eq(h).removeClass("normal").addClass("active")}var b="";b+='<div id="slide-dot">';for(var d=0;d<j.length;d++){b+='<a class="normal"><span><img src="'+Globals.path+'images/none.gif" alt="" /></span></a>'}b+="</div>";a(b).appendTo(e);a("#slide-dot a").hover(function(){if(a(this).hasClass("active")){return}a(this).removeClass("normal").addClass("hover")},function(){if(a(this).hasClass("active")){return}a(this).removeClass("hover").addClass("normal")}).click(function(){f(a(this).index())});c.css({width:a(e).width()*j.length});f(0);return this})};a.fn.focus2=function(){return this.each(function(){a(this).focus().animate({backgroundColor:"#f26883"},400).animate({backgroundColor:"#fff"},400);return this})}})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});var BlockSearch={ready:function(){$("#search-frm").submit(BlockSearch.frmSubmit);$("#search-q").focus(BlockSearch.qFocus).blur(BlockSearch.qBlur);BlockSearch.qBlur()},qFocus:function(){if($("#search-q").val()==$("#search-q").attr("title")){$("#search-q").addClass("active").val("")}},qBlur:function(){if(!$.trim($("#search-q").val())){$("#search-q").removeClass("active");$("#search-q").val($("#search-q").attr("title"))}else{$("#search-q").addClass("active")}},frmSubmit:function(){if(!$.trim($("#search-q").val())||$("#search-q").val()==$("#search-q").attr("title")){alert(Translate.searchErrorQ);$("#search-q").focus2();return false}return true}};var BlockNewsletter={ready:function(){$("#newsletter-frm").submit(BlockNewsletter.frmSubmit);$("#newsletter-name, #newsletter-email").each(function(){$(this).val($(this).attr("title"))});$("#newsletter-name, #newsletter-email").focus(BlockNewsletter.inputFocus).blur(BlockNewsletter.inputBlur)},inputFocus:function(){if($(this).val()==$(this).attr("title")){$(this).addClass("active").val("")}},inputBlur:function(){if(!$.trim($(this).val())){$(this).removeClass("active");$(this).val($(this).attr("title"))}else{$(this).addClass("active")}},frmSubmit:function(){if(!$.trim($("#newsletter-name").val())||$("#newsletter-name").val()==$("#newsletter-name").attr("title")){alert(Translate.newsletterErrorName);$("#newsletter-name").focus2();return false}if(!$.trim($("#newsletter-email").val())||$("#newsletter-email").val()==$("#newsletter-email").attr("title")){alert(Translate.newsletterErrorEmail);$("#newsletter-email").focus2();return false}return true}};var PageIndex={ready:function(){$("form.cart-add input.submit").hover(function(a){$(this).parent().find("div.cart-add-bull").clone().appendTo($("body")).css({display:"block",left:$(this).offset().left,top:$(this).offset().top})},function(){$("body").children("div.cart-add-bull").remove()});$("#slide").slideImages()}};var PageCategories={ready:function(){}};var PageProduct={imageActive:0,$imagesMin:false,$imagesMax:false,ready:function(){PageProduct.$imagesMin=$("#images-min a:not(.zoom)");PageProduct.$imagesMin.click(PageProduct.imageMinClick);PageProduct.$imagesMax=$("#images-max a, a.zoom");PageProduct.$imagesMax.click(PageProduct.imageMaxClick)},imageMinClick:function(){if(PageProduct.imageActive==$(this).index()){PageProduct.imageMaxClick();return false}PageProduct.$imagesMin.eq(PageProduct.imageActive).removeClass("active").addClass("normal");PageProduct.$imagesMax.eq(PageProduct.imageActive).fadeOut(400);PageProduct.imageActive=$(this).index();PageProduct.$imagesMin.eq(PageProduct.imageActive).removeClass("normal").addClass("active");PageProduct.$imagesMax.eq(PageProduct.imageActive).fadeIn(400);return false},imageMaxClick:function(){var a=PageProduct.$imagesMax.eq(PageProduct.imageActive).attr("href");var c="";c+='<div id="image-zoom">';c+='<div class="iz-background"></div>';c+='<div class="iz-content"><img src="'+a+'" alt="" style="display:none;"/></div>';c+="</div>";var b=$(c);b.find("img").load(PageProduct.imageZoomLoad);b.find("div.iz-content").css({top:($(window).scrollTop()+50)});b.click(PageProduct.imageZoomClick);b.appendTo("body");return false},imageZoomLoad:function(){$(this).parent().css({backgroundImage:"none"}).end().fadeIn(200)},imageZoomClick:function(){$("#image-zoom").remove()}};var PageAccount={ready:function(){$("#form-new").submit(PageAccount.formAccountNewSubmit);$("#form-edit").submit(PageAccount.formAccountEditSubmit)},formAccountNewSubmit:function(){return PageAccount.formAccountSubmit(true)},formAccountEditSubmit:function(){return PageAccount.formAccountSubmit(false)},formAccountSubmit:function(a){if(!$.trim($("#customer_name").val())){alert(Translate.accountErrorCustomerName);$("#customer_name").focus2();return false}if(!$.trim($("#customer_firstname").val())){alert(Translate.accountErrorCustomerFirstname);$("#customer_firstname").focus2();return false}if(!$.trim($("#customer_email").val())){alert(Translate.accountErrorCustomerEmail);$("#customer_email").focus2();return false}if($("#customer_email").val()!=$("#customer_email_bis").val()){alert(Translate.accountErrorCustomerEmailBis);$("#customer_email_bis").focus2();return false}if(!$.trim($("#customer_address_1").val())){alert(Translate.accountErrorCustomerAddress1);$("#customer_address_1").focus2();return false}if(!$.trim($("#customer_postalcode").val())){alert(Translate.accountErrorCustomerPostalCode);$("#customer_postalcode").focus2();return false}if(!$.trim($("#customer_city").val())){alert(Translate.accountErrorCustomerCity);$("#customer_city").focus2();return false}if(a){if($.trim($("#customer_pass").val()).length<6){alert(Translate.accountErrorCustomerPass);$("#customer_pass").focus2();return false}}if($("#customer_pass").val()!=$("#customer_pass_bis").val()){alert(Translate.accountErrorCustomerPassBis);$("#customer_pass_bis").focus2();return false}if(a){if(!$.trim($("#captcha_key").val())){alert(Translate.accountErrorCaptcha);$("#captcha_key").focus2();return false}}return true},alert:function(a){alert(a)}};var PageOrder={ready:function(){$("#form-del_all").click(PageOrder.delAllClick);$(".a-read-more").click(PageOrder.readMoreClick);$(".btn-quantity-more").click(PageOrder.quantityMoreClick);$(".btn-quantity-less").click(PageOrder.quantityLessClick);$("#country_id").change(PageOrder.countryChange);$(".btn-next").click(PageOrder.nextClick)},delAllClick:function(){var a=!$('input[name^="o_p_del"]').first().attr("checked");$('input[name^="o_p_del"]').attr("checked",a)},readMoreClick:function(){$(this).next().toggle(200,function(){if($(this).is(":visible")){$(this).prev().find(".btn-read-more").removeClass("btn-rm-hidden").addClass("btn-rm-visible")}else{$(this).prev().find(".btn-read-more").removeClass("btn-rm-visible").addClass("btn-rm-hidden")}})},quantityMoreClick:function(){PageOrder._quantity(this,1);return false},quantityLessClick:function(){PageOrder._quantity(this,-1);return false},_quantity:function(d,c){var a=$(d).parents("td").find('input[type="text"]');var b=parseInt(a.val())+c<0?0:(parseInt(a.val())+c);if(isNaN(b)){b=0}a.val(b)},countryChange:function(){PageOrder.recalculate()},recalculate:function(){$("#form-mode").val("recalculate");$("#form-order").submit()},nextClick:function(){if(Globals.logon){$("#form-mode").val("order-step-1");$("#form-order").submit()}else{PopupAccount.login("order")}}};var PagePayment={step1Ready:function(){$("#form-payment").submit(PagePayment.step1Submit);$("#address_delivery_default").click(function(){PagePayment.step1Disabled("delivery",true)});$("#address_delivery_personalize").click(function(){PagePayment.step1Disabled("delivery",false)});$("#address_billing_default").click(function(){PagePayment.step1Disabled("billing",true)});$("#address_billing_personalize").click(function(){PagePayment.step1Disabled("billing",false)});$("#delivery_country_id").change(PagePayment.step1CountryChange)},step1Disabled:function(c,b){var a="#div-"+c;if(b){$(a).hide(200)}else{$(a).show(200)}$(a+" input, "+a+" select").attr("disabled",b)},step1CountryChange:function(){$("#cgv").attr("checked",false);$("#form-payment").unbind().submit()},step1Submit:function(){if(!$("#cgv").attr("checked")){$("#cgv").focus();alert(Translate.paymentErrorCGV);return false}return true},step2Ready:function(){$("#code-frm").submit(PagePayment.step2CodeFrmSubmit)},step2CodeFrmSubmit:function(){if(!$.trim($("#code-key").val())||$("#code-key").val()==$("#code-key").attr("title")){alert(Translate.paymentErrorCodeKey);$("#code-key").focus2();return false}return true},step3Ready:function(){}};var PageContact={ready:function(){$("#form-contact").submit(PageContact.formContactSubmit);$("#contact_name").focus()},formContactSubmit:function(){if(!$.trim($("#contact_email").val())){$("#contact_email").focus2();return false}if(!$.trim($("#contact_object").val())){$("#contact_object").focus2();return false}if(!$.trim($("#contact_message").val())){$("#contact_message").focus2();return false}$("#form-contact button").attr("disabled",true).css({opacity:0.5});var a={ajax:true,sess:Globals.sess,mode:"contact",contact_name:$.trim($("#contact_name").val()),contact_email:$.trim($("#contact_email").val()),contact_object:$.trim($("#contact_object").val()),contact_message:$.trim($("#contact_message").val())};$.post(Globals.path+"ajax.php",a,function(c){var b=$(c).find("statut").text();if(b=="OK"){$("#form-contact").unbind("submit").submit(function(){return false});$("#form-contact button").attr("disabled",true).css({opacity:0.5})}else{$("#form-contact button").attr("disabled",false).css({opacity:1})}$("#form-contact-return").html($(c).find("msg").text())});return false}};var PageAjax={load:function(d){var c="";c+='<div id="page-ajax-pa">';if($.browser.msie&&$.browser.version<="6.0"){c+='<iframe style="position:absolute; width:100%; height:100%; filter:mask();" class="pa-iframe"></iframe>'}c+='<div class="pa-background"></div>';c+='<div class="pa-title"><input type="button" value="&times;" id="pa-close" /></div>';c+='<div class="pa-content" id="pa-content">';c+="<h1>Chargement de la page</h1>";c+="<p>Veuillez patienter...</p>";c+="</div>";c+="</div>";var a=$(c);a.find("#page-ajax-pa, div.pa-background, iframe.pa-iframe").height($(document).height());a.find("div.pa-content").css({top:($(window).scrollTop()+50)});a.find("#pa-close").css({top:($(window).scrollTop()+30)});a.find("#pa-close, div.pa-background").click(PageAjax.close);if($.browser.msie){a.appendTo("body")}else{a.css({opacity:0}).appendTo("body").animate({opacity:1},200)}var b=$(d.currentTarget).attr("href");var e={ajax:true};$.post(b,e,function(f){var h=$(f).find("page_title").text();var g=$(f).find("page_xhtml").text();$("#pa-content").html(g)});return false},close:function(){if($.browser.msie){$("#page-ajax-pa").remove()}else{$("#page-ajax-pa").animate({opacity:0},200,function(){$(this).remove()})}return false}};var PopupAccount={redirect:false,login:function(a){PopupAccount.close();if(a!==undefined){PopupAccount.redirect=a}var c="";c+='<div id="popup-pp">';if($.browser.msie&&$.browser.version<="6.0"){c+='<iframe style="position:absolute; width:100%; height:100%; filter:mask();" class="pp-iframe"></iframe>'}c+='<div class="pp-background"></div>';c+='<div class="pp-content" id="pp-form-login">';c+='<img src="'+Globals.path+'images/none.gif" alt="" class="shadow" />';c+="<h1>"+Translate.popupAccountLoginTitle1+" <em>"+Translate.popupAccountLoginTitle2+'</em><input type="button" value="&times;" id="pp-close" /></h1>';c+='<form action="#" method="post">';c+='<p class="first"><label for="pp-login">'+Translate.popupAccountLoginFrmEmail+'</label><br /><input type="text" id="pp-login" maxlength="100" class="text boxtext" /></p>';c+='<p><label for="pp-password">'+Translate.popupAccountLoginFrmPassword+'</label><br /><input type="password" id="pp-password" maxlength="100" class="text boxtext" /></p>';c+='<p><input type="checkbox" id="pp-remember" value="30" class="checkbox" /><label for="pp-remember" class="checkbox"> '+Translate.popupAccountLoginFrmRemember+"</label></p>";c+='<p class="buttons"><input type="submit" id="pp-submit" value="'+Translate.popupAccountLoginFrmSubmit+'" class="boxbutton" /></p>';c+='<p class="links"><a href="#" class="pp-lost">'+Translate.popupAccountLoginPasswordLost+"</a></p>";c+="</form>";c+='<div class="pp-new-account">';c+="<p>"+Translate.popupAccountLoginNewAccountMsg+"</p>";if(!PopupAccount.redirect){c+='<a href="'+Globals.path+"mon-compte.php?mode=new"+(!Globals.cookie?"&amp;sess="+Globals.sess:"")+'" class="boxbutton new">'+Translate.popupAccountLoginNewAccountBtn+"</a>"}else{c+='<a href="'+Globals.path+"mon-compte.php?mode=new&amp;redirect="+PopupAccount.redirect+(!Globals.cookie?"&amp;sess="+Globals.sess:"")+'" class="boxbutton new">'+Translate.popupAccountLoginNewAccountBtn+"</a>"}c+="</div>";c+="</div>";c+="</div>";var b=$(c);b.find("#popup-pp, div.pp-background, iframe.pp-iframe").height($(document).height());b.find("#pp-close, div.pp-background").click(PopupAccount.close);b.find("form").submit(PopupAccount.loginSubmit);b.find("a.pp-lost").click(PopupAccount.passwordLost);if($.browser.msie){b.appendTo("body")}else{b.css({opacity:0}).appendTo("body").animate({opacity:1},200)}$("#pp-login").focus();return false},loginSubmit:function(){if(!$.trim($("#pp-login").val())){$("#pp-login").focus2();return false}if(!$.trim($("#pp-password").val())){$("#pp-password").focus2();return false}var a={ajax:true,sess:Globals.sess,mode:"login",login:$("#pp-login").val(),password:$("#pp-password").val()};if($("#pp-remember").attr("checked")){a.remember=$("#pp-remember").val()}$.post(Globals.path+"ajax.php",a,PopupAccount.loginSubmitDone);return false},loginSubmitDone:function(b){var a=$(b).find("statut").text();if(a=="OK"){if(PopupAccount.redirect){switch(PopupAccount.redirect){case"order":window.location.href=Globals.path+"ma-commande.php?step=1"+(!Globals.cookie?"&sess="+Globals.sess:"");break}}else{window.location.href=Globals.page}}else{$("#pp-password").val("");$("#pp-login, #pp-password").focus2()}},passwordLost:function(){var a="";a+='<p class="pp-lost-msg">'+Translate.popupAccountLostFrmMsg+"</p>";a+='<p><label for="pp-login-lost">'+Translate.popupAccountLostFrmEmail+'</label><br /><input type="text" id="pp-login-lost" maxlength="100" class="text boxtext" /></p>';a+='<p class="buttons"><input type="submit" id="pp-submit-lost" value="'+Translate.popupAccountLostFrmSubmit+'" class="boxbutton" /></p>';$("#popup-pp form").html(a);$("#pp-submit-lost").click(PopupAccount.passwordLostSubmit);$("#pp-login-lost").focus();return false},passwordLostSubmit:function(){if(!$.trim($("#pp-login-lost").val())){$("#pp-login-lost").focus2();return false}var a={ajax:true,sess:Globals.sess,mode:"lost",login:$("#pp-login-lost").val()};$.post(Globals.path+"ajax.php",a,PopupAccount.passwordLostSubmitDone);return false},passwordLostSubmitDone:function(b){var a=$(b).find("statut").text();if(a=="OK"){$('<p class="pp-lost-msg2">'+Translate.popupAccountLostDone+"</p>").appendTo("#popup-pp form");setTimeout(PopupAccount.close,2000)}else{$("#pp-login-lost").val("").focus2()}},close:function(){if($.browser.msie){$("#popup-pp").remove()}else{$("#popup-pp").animate({opacity:0},200,function(){$(this).remove()})}return false}};$(document).ready(function(){$("a.page-ajax").click(PageAjax.load)});$(window).load(function(){$.fixPNG()});
