function loadPopup(video){try{var pageTracker=_gat._getTracker("UA-915232-1");pageTracker._trackEvent('aideinteractive',video);}catch(err){}
window.open("/aide-interactive/"+video+".html","myPopup","status=0, toolbar=0, location=0, menubar=0, width=988, height=595");}
function activeInfoStock(){var tabId=''
$('img[id^="info-stock"]').each(function(){var contentHelp=$(this).attr('alt');$(this).qtip({position:{corner:{target:'rightMiddle',tooltip:'leftMiddle'}},content:contentHelp,show:'mouseover',hide:'mouseout',style:{name:'light'}});$(this).attr('alt','');});}
function ID(id){if(document.getElementById)return document.getElementById(id);else if(document.layers)return document.id;else return document.all.id;}
function Bascule(DivID1,DivID2,OngletID1,OngletID2){var MaDiv1=ID(DivID1);var MaDiv2=ID(DivID2);var MonOnglet1=ID(OngletID1);var MonOnglet2=ID(OngletID2);MaDiv1.style.display='block';MonOnglet1.style.background='url(/common/images/10-ans-internet/onglet.gif) no-repeat left top';MonOnglet1.style.color='white';if(MaDiv1.style.display=='block'){MaDiv1.style.display='block';MonOnglet1.style.background='url(/common/images/10-ans-internet/onglet.gif) no-repeat left top';MonOnglet1.style.color='white';MaDiv2.style.display='none';MonOnglet2.style.background='';MonOnglet2.style.color='black';}}
function show_price(reference)
{var ref=reference;var prices='price-marketprice-'+ref;var isPromo='';$("td[class^='is_promo']").each(function(){isPromo+=$(this).attr('class')+',';});if(prices!='')
{$.get('/price/marketprice/',{prices:prices,ispromo:isPromo});}}
function boxprix(msg){$(document).ready(function(){$('#alert h6').html('VOICI LES PRIX DE VOS DIFFERENTS MARCHES :');$('#alert').jqmShow().find('div.jqmAlertContent').html(msg).end().find('.jqmAlertBtn img').mouseover(function(){$(this).css('cursor','pointer');}).end().find('.jqmAlertBtn img').click(function(){$('#alert').jqmHide();});});}
function saveSearch(nbr,term,section,category,brand,flag,kwd,caracts)
{var jqxhr=$.get("/search/savesearch/?nbrclient="+nbr+"&termclient="+term+"&sectionclient="+section+"&categoryclient="+category+"&brandclient="+brand+"&flagclient="+flag+"&kwdclient="+kwd+"&caractsclient="+caracts,function(){document.getElementById('saveresponse').innerHTML="<span id='save'>Votre recherche a bien été sauvegardée.</span>";})}
function valideAvis(pertinent,avis,type,term,section,category,brand,flag,kwd,caracts)
{if(avis!='')
{var releve;if(pertinent)
{for(var i=0;i<pertinent.length;i++)
{if(pertinent[i].checked)
{releve=pertinent[i].value;}}}
var jqxhr=$.get("/search/saveavis/?trouveclient="+releve+"&avisclient="+avis+"&typeclient="+type+"&termclient="+term+"&sectionclient="+section+"&categoryclient="+category+"&brandclient="+brand+"&flagclient="+flag+"&kwdclient="+kwd+"&caractsclient="+caracts,function(){document.getElementById('avisresponse').innerHTML="<span id='save'>Votre avis a bien été enregistré.</span>";})}
else{alert("Merci de saisir votre avis avant de valider.");}}
function refreshStock()
{var stocks="";var reliquats='';var dispos="";var qtt="";var stockagency="";$("span.stock").each(function(){id=$(this).attr("id");stocks+=$(this).attr("id")+",";});$('span.reliquat').each(function(){id=$(this).attr("id");reliquats+=$(this).attr('id')+',';arr=id.split('_');qtt+=$('#qtt-item_'+arr[1]).val()+",";});$('span.dispo').each(function(){id=$(this).attr("id");dispos+=$(this).attr("id")+",";});$('span.stockagency').each(function(){id=$(this).attr("id");stockagency+=$(this).attr("id")+",";})
if(stocks!='')
{$.post('/stock/ajaxstock/',{stocks:stocks});}
if(reliquats!='')
{$.post('/stock/ajaxreliquat/',{reliquats:reliquats,quantite:qtt});}
if(dispos!='')
{$.post('/stock/ajaxdispo/',{dispos:dispos});}
if(stockagency!='')
{$.post('/stock/ajaxstockagency/',{stockagency:stockagency});}}
function alert(msg,id){$(document).ready(function(){$('#alert').jqmShow().find('div.jqmAlertContent').html(msg).end().find('.jqmAlertBtn img').mouseover(function(){$(this).css('cursor','pointer');}).end().find('.jqmAlertBtn img').click(function(){$('#alert').jqmHide();if(id!=null)
{debugLog('Focus sur '+id);window.location='#referencecommande';$(id).focus();}});});}
function showModal()
{$('#modal-content').jqmShow();}
function hideModal()
{$('#modal-content').jqmHide();}
function showFancy()
{$("a#fancy_auto").fancybox().trigger("click");}
function hideFancy(){$.fancybox.close();}
function confirm(msg,callback){$(document).ready(function(){$('#confirm').jqmShow().find('p.jqmConfirmMsg').html(msg).end().find(':image:visible').click(function(){if(this.value=='yes')
(typeof callback=='string')?window.location.href=callback:callback();$('#confirm').jqmHide();});});}
function pagerFactory(idx,slide){if(idx==0){var anchor='<li class="anchorCycle"><a href="#"><img alt="" src="/common/images/footer-nav-link-on.gif"/></a></li>';}
else{var anchor='<li class="anchorCycle"><a href="#"><img alt="" src="/common/images/footer-nav-link-off.gif"/></a></li>';}
return anchor;}
function clickfunc(){$(this).unbind('click');var favorite=this.id;$(this).toggleClass("fav-on");$.get('/user/addfavorite/',{favorite:favorite});}
$.fn.customSelectSearch=function(){return this.each(function(){obj=$(this);obj.after("<div id=\"selectoptions\"> </div>");obj.before("<input type=\"hidden\" value =\"\" name=\""+this.name+"\" class=\"customselect\"/><div id=\"iconselect\">Dans tout le catalogue</div><div id=\"iconselectholder\"> </div>").remove();obj.find('option').each(function(i){var html="<div id=\""+$(this).attr("value")+"\" class=\"selectitems\"><img src=\""+this.title+"\" /><span>"+$(this).html()+"</span></div>";$("#selectoptions").append(html);});$("#iconselect").click(function(){$("#iconselectholder").toggle();});$("#iconselectholder").append($("#selectoptions")[0]);$(".selectitems").mouseover(function(){$(this).addClass("hoverclass");});$(".selectitems").mouseout(function(){$(this).removeClass("hoverclass");});$(".selectitems").click(function(){$(".selectedclass").removeClass("selectedclass");$(this).addClass("selectedclass");var thisselection=$(this).html();$(".customselect").val(this.id);$("#iconselect").html(thisselection);$("#iconselectholder").toggle()});});};var speedFade="normal";var couleur=new Array();couleur['sousmenu-batiment']='#EB3E04';couleur['sousmenu-ameublement']='#F37F00';couleur['sousmenu-fixation']='#6BBA1F';couleur['sousmenu-outillage']='#1B6BAE';couleur['sousmenu-coupe']='#D553B4';couleur['sousmenu-maintenance']='#389987';couleur['sousmenu-protection']='#6298CB';$(document).ready(function(){$("#aide-video").each(function(){var url=$(this).find("a").attr('href');var flashvars={};var params={};var attributes={};params.allowFullScreen="true";;params.allowScriptAccess="always";params.wmode="transparent";flashvars.file=url;swfobject.embedSWF("/common/swf/player.swf","aide-video","610","486","9.0.115",false,flashvars,params,attributes);});$("#patch-video").each(function(){var url=$(this).find("a").attr('href');var flashvars={};var params={};var attributes={};params.allowFullScreen="true";;params.allowScriptAccess="always";params.wmode="transparent";flashvars.file=url;swfobject.embedSWF("/common/swf/player.swf","patch-video","320","264","9.0.115",false,flashvars,params,attributes);});$('#alert').jqm({overlay:88,modal:true,trigger:false});$('#confirm').jqm({overlay:88,modal:true,trigger:false});$('#modal-content').jqm({overlay:88,modal:true,trigger:false});$('#modalWindow').jqm({modal:false,overlay:88,trigger:false});$('#jqmVideo').jqm({trigger:false,modal:false,overlay:88,onHide:function(h){var player=document.getElementById('videoProduct');player.sendEvent("PLAY","false");h.o.remove();h.w.hide();$('#videoContent').html('');$('#videoContent').html('<div id="jqmVideoContent"></div>');}});$('#logbox #inputform input').focus(function(){$(this).val('');});$('#quickorder #quick-input-ref').focus(function(){$(this).val('');});$("form#home-cart-add").ajaxForm();$('#inscrit input').focus(function(){$(this).val('');});$('a.thickboxMap').click(function(){var url=$(this).attr('href');$('#jqmContent').attr('src',url);$('#modalWindow h1').html('Géolocalisation du point');$('#modalWindow').jqmShow();return false;});$('.customselect').customSelectSearch();$('img.info-help').each(function(){var contentHelp=$(this).attr('alt');$(this).qtip({content:contentHelp,show:'mouseover',hide:'mouseout',style:{name:'light',tip:true}});});$('a.info-help').each(function(){var contentHelp=$(this).attr('title');$(this).attr('title','');$(this).qtip({content:contentHelp,show:'mouseover',hide:'mouseout',position:{corner:{tooltip:'topMiddle',target:'bottomMiddle'}},style:{name:'light',tip:true}});});$("#searchInput").click(function(){if($(this).val()=='un produit, une référence, une page...')
{$(this).val('');}});$("#searchInput").result(function(event,data,formatted){$('#engine-content form').submit();$("#searchInput").trigger('blur');});$("#engine-content-btn").click(function(){var term=$('#searchInput').val();debugLog(term);if(term==''||term=='un produit, une référence, une page...')
{debugLog('Veuillez saisir un terme de recherche');$("#searchInput").trigger("focus");$("#searchInput").val('');}
else
{debugLog('Soumission de la recherche');$("#engine-content form").submit();$(this).unbind('click');$("#searchInput").trigger("blur");}});$("#engine-content-btn").mouseover(function(){$(this).css('cursor','pointer');});var contentHelp="Quelques exemples pour vous guider : <b>Perceuse, 121 121, Hettich, Charnières, Page 150,etc...</b>";$("#searchInput").qtip({content:{prerender:true,text:contentHelp},position:{corner:{target:'bottomMiddle',tooltip:'topMiddle'}},style:{tip:'topMiddle',name:'light',width:'242'},hide:{when:{event:'blur'}},show:{when:{event:'focus'}},api:{onRender:function()
{var self=this;var helper=$('#helpEngine');$("#searchInput").bind('keypress',self.hide);helper.bind('mouseover',self.show);helper.bind('mouseout',self.hide);}}});$("#slideshow").cycle({fx:'scrollHorz',prev:'#prev',next:'#next',timeout:0});$("#nav a.activeSlide img").livequery(function(){$(this).attr('src','/common/images/footer-nav-link-on.gif');});$("#nav a[class!='activeSlide'] img").livequery(function(){$(this).attr('src','/common/images/footer-nav-link-off.gif');});$("#discover span").hover(function(){$(this).css('cursor','pointer');});$('#footer-transport .postcode').keyup(function(){var postcode=$(this).attr('value');if(postcode.length==5)
{$.get("/postcode/ajax/",{postcode:postcode});}});$('#footer-transport .postcode').focus(function(){$(this).val('');});$('#page-pointenlev .postcode').keyup(function(){var postcode=$(this).attr('value');if(postcode.length==5)
{$.get("/postcode/ajax/",{postcode:postcode,selectId:'page-pointenlev'});}});$('#livraisonaccueil .postcode').keyup(function(){var postcode=$(this).attr('value');if(postcode.length==5)
{$.get("/postcode/ajax/",{postcode:postcode,selectId:'livraisonaccueil'});}});$('#livraisonaccueil .postcode').focus(function(){$(this).val('');});$("img[class^='add_caddie']").livequery('click',function(){var id=$(this).attr('class');var tab=id.split('_');var ref=tab[2];if($('input.'+id))
{var qt=$('input.'+id).attr('value');}
else{var qt=1;}
$.get('/cart/add/',{cartPage:0,article:ref,quantity:qt});});$("img[class^='add_caddie']").livequery(function(){$(this).hover(function(){$(this).css('cursor','pointer');;})});$("img[class^='add_ipad_caddie']").livequery('click',function(){var id=$(this).attr('class');var tab=id.split('_');var ref=tab[3];if($('input.'+id))
{var qt=$('input.'+id).attr('value');}
else{var qt=1;}
$.get('/cart/add/',{cartPage:0,article:ref,quantity:qt,ipad:true});});$("img[class^='add_ipad_caddie']").livequery(function(){$(this).hover(function(){$(this).css('cursor','pointer');;})});$("img[class^='identification']").each(function(){$(this).click(function(){var id=$(this).attr('class');var tab=id.split('_');var ref=tab[1];$.get('/user/modalconnexion/',{reference:ref});});$(this).mouseover(function(){$(this).css('cursor','pointer');});});$("img[class^='add_selectedref_caddie']").each(function(){$(this).click(function(){var id=$(this).attr('class');var tab=id.split('_');var idProduct=tab[3];if($('select#selected_'+idProduct).val()=='')
{alert('Merci de choisir <strong>une référence dans le sélecteur</strong> avant de valider l\'article dans le panier');}
else{var ref=$('select#selected_'+idProduct).val();if($('input.'+id))
{var qt=$('input.'+id).attr('value');}
else{var qt=1;}
$.get('/cart/add/',{cartPage:0,article:ref,quantity:qt},function(){$('select#selected_'+idProduct+' option:first').attr('selected','selected');});}});$(this).mouseover(function(){$(this).css('cursor','pointer');});});$("input[class^='quantity']").keypress(function(e){if(e.which==13)
{var id=$(this).attr('class');var tab=id.split(' ');if($('img.'+tab[1]))
{$('img.'+tab[1]).trigger('click');}}});var prices='';$('span.prix').each(function(){prices+=$(this).attr('id')+',';});if(prices!='')
{$.post('/price/ajax/',{prices:prices});}
var prices='';$('span.marketprix').each(function(){prices+=$(this).attr('id')+',';});if(prices!='')
{$.post('/price/marketprice/',{prices:prices});}
var rprices='';$('span.rprix').each(function(){rprices+=$(this).attr('id')+',';});if(rprices!='')
{$.post('/price/ajax/',{prices:rprices});}
var isPromo='';$("td[class^='is_promo']").each(function(){isPromo+=$(this).attr('class')+',';});if(isPromo!='')
{$.post('/price/ajax/',{prices:prices,ispromo:isPromo});}
var favorites='';$('td.favoris span').each(function(){if($(this).attr('class')!='fav-on')
{favorites+=$(this).attr('id')+',';}
$(this).click(clickfunc);$(this).mouseover(function(){$(this).css('cursor','pointer');})});if(favorites!='')
{$.get('/user/isfavorite/',{favorites:favorites});}
$('#close-alert-browser img').mouseover(function(){$(this).css('cursor','pointer');});$('#close-alert-browser img').click(function(){$('#update-browser').fadeOut('normal',function(){$(this).hide();});});$('.jqmClose').click(function(){hideModal();});$("form.jqtranform").jqTransform();});
