function validSearch(mode,formId,errorMessageId,extension){var valid=true;if(mode=="size"){var paramWidth="width";var paramRatio="ratio";var paramDiameter="diameter";if(extension!=null){paramWidth+=extension;paramRatio+=extension;paramDiameter+=extension;}var width=EL(paramWidth);var ratio=EL(paramRatio);var diameter=EL(paramDiameter);var labelWidthName="label-"+paramWidth;var labelRatioName="label-"+paramRatio;var labelDiameterName="label-"+paramDiameter;var labelWidth=EL(labelWidthName);var labelRatio=EL(labelRatioName);var labelDiameter=EL(labelDiameterName);var labelError="";if(width.value==""){valid=false;labelError+=labelWidth.value;}if(ratio.value==""){if(!valid){labelError+=", ";}valid=false;labelError+=labelRatio.value;}if(diameter.value==""){if(!valid){labelError+=", ";}valid=false;labelError+=labelDiameter.value;}}if(valid){var form=EL(formId);form.submit();startDecreaseError(0,errorMessageId);}else{EL(errorMessageId).style.display="block";var heightError=96;EL("label-"+errorMessageId).firstChild.nodeValue=labelError;startDecreaseError(heightError,errorMessageId);}return false;}function startDecreaseError(heightAsk,errorMessId){div1=EL(errorMessId);div1.style.display="block";var speed=0.3;if(navigator.appName=="Microsoft Internet Explorer"){speed=1;}actif=window.setInterval("decreaseError("+heightAsk+",'"+errorMessId+"')",speed);}function decreaseError(heightAsk,errorMessId){div1=EL(errorMessId);height=div1.style.height.substring(0,div1.style.height.length-2);if(height<heightAsk){height=(height*1)+1;div1.style.height=height+"px";}else{if(height>heightAsk){height=(height*1)-1;div1.style.height=height+"px";}else{window.clearInterval(actif);if(heightAsk==0){div1.style.display="none";}}}}var Valraiso={namespace:function(name){if(!name||!name.length){return null;}var current=window;var names=name.split(".");for(var i=0;i<names.length;i++){current[names[i]]=current[names[i]]||{};current=current[names[i]];}},extend:function(obj,properties){if(!obj){return;}for(property in properties){obj[property]=properties[property];}}};Valraiso.namespace("Valraiso.DOM");Valraiso.DOM={toElement:function(e){if(typeof e=="string"){return document.getElementById(e);}return e;},getClassNames:function(element){return EL(element).className.split(/\s+/);},updateClassName:function(element,classNames){EL(element).className=classNames.join(" ");}};var EL=Valraiso.DOM.toElement;Valraiso.namespace("Valraiso.util");Valraiso.util={trim:function(s){if(typeof s!="string"){return s;}return s.replace(/^(\s*)([\W\w]*)(\b\s*$)/,"$2");},checkEmail:function(val){var usr='([a-zA-Z0-9][a-zA-Z0-9_.-]*|"([^\\\\\x80-\xff\015\012"]|\\\\[^\x80-\xff])+")';var domain="([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";var regex="^"+usr+"@"+domain+"$";var myrxp=new RegExp(regex);return(myrxp.test(val));},addWindowOnload:function(func){var windowonload=window.onload;window.onload=function(){if(windowonload!=null){windowonload();}func();};}};Valraiso.namespace("Valraiso.net");Valraiso.net.Browser=function(){this.initialize.apply(this,arguments);};Valraiso.net.Browser.prototype={navigator:null,platform:null,userAgent:null,isWin32:false,isLinux:false,isMac:false,isGecko:false,isFirefox:false,isNetscape:false,isMSIE:false,isSafari:false,isOpera:false,isChrome:false,code:null,name:null,majorVersion:0,minorVersion:0,minorVersion2:0,version:"",_Engine:function(){this.code=navigator.appCodeName;this.versionString=navigator.appVersion;this.version=parseFloat(this.versionString);this.clientName=navigator.appName;},initialize:function(){this.navigator=window.navigator;this.Engine=new this._Engine();this.platform=navigator.platform;this.userAgent=navigator.userAgent;this.isWin32=(this.platform.indexOf("Win32")>=0);this.isLinux=(this.platform.indexOf("Linux")>=0);this.isMac=(this.platform.indexOf("Mac")>=0);this.isGecko=(this.userAgent.indexOf("Gecko/")>=0);this.isFirefox=(this.userAgent.indexOf("Firefox/")>=0);this.isNetscape=(this.userAgent.indexOf("Netscape/")>=0);this.isMSIE=(this.userAgent.indexOf("MSIE")>=0);this.isSafari=(this.userAgent.indexOf("Safari/")>=0);this.isOpera=(this.userAgent.indexOf("Opera")>=0);this.isChrome=(this.userAgent.indexOf("Chrome/")>=0);if(this.isOpera){this.isMSIE=false;}this.code=this.Engine.code;if(this.isGecko){this.code="Gecko";}if(this.isFirefox){this.code="Firefox";}if(this.isNetscape){this.code="Netscape";}if(this.isMSIE){this.code="MSIE";}if(this.isSafari){this.code="Safari";}if(this.isOpera){this.code="Opera";}this.name=this.Engine.clientName;if(this.isFirefox){this.name="Mozilla Firefox";}if(this.isSafari){this.name="Safari";}if(this.isOpera){this.name="Opera";}this.version=""+this.Engine.version;if(this.code){var reg=new RegExp(this.code+"/?\\s?;?([\\d.]*)");var res=this.userAgent.match(reg);if(res.length==2){this.version=res[1];res=this.version.match(/\d+/g);this.majorVersion=(res[0]?parseInt(res[0]):0);this.minorVersion=(res[1]?parseInt(res[1]):0);this.minorVersion2=(res[2]?parseInt(res[2]):0);}}}};Valraiso.net.Browser.Instance=new Valraiso.net.Browser();Valraiso.namespace("Valraiso.CSS");Valraiso.CSS={appendNavigatorInformations:function(){var list=document.getElementsByTagName("html");if(list!=null&&list.length>0){var html=list.item(0);var browser=Valraiso.net.Browser.Instance;var classNames=Valraiso.DOM.getClassNames(html);classNames.push(browser.isGecko?"Gecko":"NotGecko");classNames.push(browser.isFirefox?"Firefox":"NotFirefox");classNames.push(browser.isNetscape?"Netscape":"NotNetscape");classNames.push(browser.isSafari?"Safari":"NotSafari");classNames.push(browser.isOpera?"Opera":"NotOpera");classNames.push(browser.isMSIE?"MSIE":"NotMSIE");classNames.push(browser.isMac?"Mac":"NotMac");if(browser.isMSIE){classNames.push("MSIE"+browser.majorVersion);}Valraiso.DOM.updateClassName(html,classNames);}}};Valraiso.CSS.appendNavigatorInformations();Valraiso.namespace("Valraiso.form");Valraiso.form={getFieldValue:function(element){element=EL(element);var value;if(element==null){return null;}switch(element.type){case"checkbox":if(element.checked){value="on";}break;case"radio":case"password":case"textarea":case"text":value=element.value;break;case"select-one":value=Valraiso.form.select.getSelectedValue(element);break;default:if(typeof element=="object"){for(var i=0;i<element.length;i++){if(element[i].checked){value=element[i].value;}}}break;}if(value==null||value.length==0){return null;}return value;}};Valraiso.namespace("Valraiso.form.select");Valraiso.form.select={getSelectedOption:function(element){element=EL(element);if(element.selectedIndex<0){return null;}return element.options[element.selectedIndex];},setSelectedValue:function(element,value){for(var i=0;i<EL(element).options.length;i++){var opt=EL(element).options[i];if(opt.value==value){opt.selected=true;break;}}},getSelectedValue:function(element){return Valraiso.form.select.getSelectedOption(element).value;},getSelectedText:function(element){return Valraiso.form.select.getSelectedOption(element).text;}};Valraiso.namespace("Valraiso.CSS.events");Valraiso.CSS.events={toggleSelect:function(){var selects=document.getElementsByTagName("select");if(selects.length==0){return;}var visibility=(selects[0].style.visibility=="hidden")?"visible":"hidden";for(var i=0;i<selects.length;i++){selects.item(i).style.visibility=visibility;}},showSelect:function(){var selects=document.getElementsByTagName("select");if(selects.length==0){return;}for(var i=0;i<selects.length;i++){selects.item(i).style.visibility="visible";}},hideSelect:function(){var selects=document.getElementsByTagName("select");if(selects.length==0){return;}for(var i=0;i<selects.length;i++){selects.item(i).style.visibility="hidden";}}};function setTrackingVisitCookie(){var strReferer=document.referrer;var domainName=null;var parameters=window.location.search;var httpPosition=strReferer.indexOf("http://");var isPopgomDomain=false;var cplib=null;if(strReferer!=null&&strReferer!=""){if(httpPosition!=-1){var urlPart=strReferer.substring(httpPosition+7,strReferer.length);var slashPosition=urlPart.indexOf("/");if(slashPosition!=-1){domainName=urlPart.substring(0,slashPosition);}else{domainName=urlPart;}}if(domainName!=null){var regExpDomain=new RegExp("popgom","g");isPopgomDomain=regExpDomain.test(domainName);}}if(!isPopgomDomain){if(parameters!=null&&parameters!=""){var pos=parameters.indexOf("?");if(pos!=-1){var strParams=parameters.substring(pos+1,parameters.length);var cplibExists=strParams.indexOf("cplib=");if(cplibExists!=-1){var anotherParam=strParams.indexOf("&",cplibExists);if(anotherParam!=-1){cplib=strParams.substring(cplibExists+6,cplibExists+anotherParam);}else{cplib=strParams.substring(cplibExists+6,strParams.length);}}}}var cookieValue="";if(cplib!=null){cookieValue+="cplib="+cplib;}else{cookieValue+="cplib=nothing";}if(strReferer!=null&&strReferer!=""){cookieValue+=";ref="+strReferer;if(domainName!=null){cookieValue+=";domain="+strReferer;}}else{cookieValue+=";ref=nothing;domain=nothing";}var firstTrackingVisit=getCookieValue("ref1");if(firstTrackingVisit==null){document.cookie="ref1="+escape(cookieValue)+";path=/;expires="+new Date("January 1, 3000").toGMTString();}var currentTrackingVisit=getCookieValue("ref");if(currentTrackingVisit==null){document.cookie="ref="+escape(cookieValue)+";path=/";}}}Bw={};Bw.Core={bind:function(el,proto){var p=null;var n=null;try{p=(typeof proto=="string")?eval(proto):proto;}catch(e){}if(p&&p.selfclassName){p.selfclass=eval(p.selfclassName);if(p.superclassName){p.superclass=eval(p.superclassName);Bw.Core.bind(el,p.superclassName);}for(e in p){el[e]=p[e];}el.className=p.selfclassName.replace(/\./g,"");return p;}},bootstrap:function(el,c){var n=c||el.className;if(n&&Bw.Core.bind(el,n)&&!el.initialize()){return;}var e=el.firstChild;while(e!=null){try{Bw.Core.bootstrap(e);}catch(ex){}e=e.nextSibling;}},load:function(parent,url,force){var q=Bw.IO.Query.create();if(force){q.setNoCache();}q.get(url);parent.innerHTML=q.getText();Bw.Core.bootstrap(parent);Bw.Core.evalScript(parent.innerHTML,force);},evalScript:function(html,force){var idx=html.toLowerCase().indexOf("<script");while(idx>-1){var idxEnd=html.toLowerCase().indexOf(">",idx);var balise=html.substring(idx+8,idxEnd);var idxSrc=balise.toLowerCase().indexOf("src=");if(idxSrc==-1){var idxSlashScript=html.toLowerCase().indexOf("<\/script>",idx+8);var script=html.substring(idxEnd+1,idxSlashScript);eval(script);}else{if(balise.charAt(idxSrc+4)=='"'||balise.charAt(idxSrc+4)=="'"){idxSrc++;}var idxSrcEnd=-1;for(var i=idxSrc+4;i<balise.length;i++){if(balise.charAt(i)==" "||balise.charAt(i)=='"'||balise.charAt(i)=="'"){idxSrcEnd=i;}}var source=balise.substring(idxSrc+4,idxSrcEnd);var q=Bw.IO.Query.create();if(force){q.setNoCache();}q.get(source);if(q.getStatus()==200){eval(q.getText());}}idx=html.toLowerCase().indexOf("<script",idx+8);}},check:function(){},start:function(){if(self.dialogArguments){self.opener=self.dialogArguments;}Bw.Core.check();Bw.Core.bootstrap(document.body);}};Bw.instanceOf=function(el,type){return(el&&((el.selfclass&&el.selfclass==type)||(el.className&&el.className==type.selfclassName)));};Bw.inherits=function(el,type){if(!el){return false;}var t=el.selfclass;while(t){if(t==type){return true;}t=t.superclass;}return false;};Bw.getById=function(id){return document.getElementById(id);};Bw.getEvent=function(e){if(!e){e=window.event;e.target=e.srcElement;}return e;};Bw.getGlobalMousePosition=function(e){var p={x:e.clientX,y:e.clientY};var d=document.documentElement;var b=document.body;var w=window;p.x+=(w.scrollX)?w.scrollX:(d.scrollLeft+b.scrollLeft);p.y+=(w.scrollY)?w.scrollY:(d.scrollTop+b.scrollTop);return p;};Array.prototype.lookup=function(o){var l=this.length;for(var i=0;i<l;i++){if(this[i]==o){return i;}}return -1;};function log(str){var l=Bw.getById("log");if(!l){l=document.createElement("DIV");l.style.font="menu";l.style.clear="both";l.id="log";document.body.appendChild(l);}l.innerHTML+=(str+"<br>");}window.onload=function(){Bw.Core.start();};Bw.IO={};Bw.IO.Query={superclassName:null,selfclassName:"Bw.IO.Query",create:function(){var obj=new Object();Bw.Core.bootstrap(obj,this);return obj;},initialize:function(){this.asyncCallback=null;this.headers={};this.impl=Bw.Xml.Helpers.createHttpRequest();},get:function(url,callback){this.transmit("GET",url,null,callback);},post:function(url,obj,callback){if(obj&&obj.selfclass&&obj.selfclass==Bw.IO.Message){obj=obj.dom;}this.transmit("POST",url,obj,callback);},transmit:function(method,url,obj,callback){var async=(typeof callback!="undefined");if(async){this.asyncCallback=callback;}this.impl.open(method,this.buildUrl(url),async);for(h in this.headers){this.impl.setRequestHeader(h,this.headers[h]);}if(async){var self=this;this.impl.onreadystatechange=function(){self.readyStateChanged();};}this.impl.send(obj);window.status="";},readyStateChanged:function(){if(this.impl.readyState==4){window.status="";this.asyncCallback();}},setNoCache:function(){this.headers["If-Modified-Since"]="Sat, 1 Jan 2005 00:00:00 GMT";},setHeader:function(name,value){this.headers[name]=value;},getText:function(){return this.impl.responseText;},getMessage:function(){return Bw.IO.Message.createFromXml(this.impl.responseXML);},getXml:function(){return this.impl.responseXML;},getStatus:function(){return this.impl.status;},getStatusText:function(){return this.impl.statusText;},buildUrl:function(url){var l=document.location;if(url.indexOf("/")==0){var p=l.port;var h=l.host;var u=l.protocol+"//"+h;if(p!=null&&p!=""&&h.indexOf(p)<0){u+=(":"+p);}return(u+url);}else{var l=l.toString();var p=l.lastIndexOf("/");var u=l.substr(0,p);return(u+"/"+url);}},PostData:function(){this.properties={};this.toString=function(){var s="";for(name in this.properties){if(s!=""){s+="&";}var value=this.properties[name];value=""+value;if(typeof value!="string"){continue;}value=value.replace(/%/g,"%25");value=value.replace(/&/g,"%26");s+=(name+"="+value);}return s;};}};Bw.IO.Message={superclassName:null,selfclassName:"Bw.IO.Message",create:function(name){var obj=new Object();obj.name=(name)?name:"message";Bw.Core.bootstrap(obj,this);return obj;},createFromXml:function(xml){var obj=new Object();obj.dom=xml;Bw.Core.bootstrap(obj,this);return obj;},initialize:function(){if(!this.dom){var d=Bw.Xml.Helpers.createDocument();d.appendChild(d.createElement(this.name));this.dom=d;}this.root=this.dom;if(!this.name){this.name=this.root.nodeName;}},changeRoot:function(path){var n=Bw.Xml.Path.navigate(path,this.root,false);this.root=(node==null)?this.dom:node;},put:function(path,value,from){var f=(from)?from:this.root;var n=Bw.Xml.Path.navigate(path,f,true);if(n){Bw.Xml.Helpers.setNodeValue(n,value);}return n;},get:function(path,from){var f=(from)?from:this.root;var n=Bw.Xml.Path.navigate(path,f,false);return(!n)?null:Bw.Xml.Helpers.getNodeValue(n);},getNodes:function(path,from){var f=(from)?from:this.root;return Bw.Xml.Helpers.getNodes(f,path);},getNode:function(path,from){var f=(from)?from:this.root;return Bw.Xml.Helpers.getNode(f,path,false);},count:function(path){var n=Bw.Xml.Path.navigate(path,this.root,false);return(!n)?-1:Bw.Xml.Helpers.countHomonymNodes(n);},remove:function(path){var n=Bw.Xml.Path.navigate(path,this.root,false);return(!n)?null:Bw.Xml.Path.removeNode(n);}};Bw.Xml={};Bw.Xml.Path={cache:{},compile:function(path){var code="var n=r;";var start=0;var end=false;while(!end){var stop=path.indexOf("/",start);if(stop==-1){stop=path.length;end=true;}var e=path.substring(start,stop);var a=null;var p=e.indexOf("@");if(p!=-1){a=e.substring(p+1,e.length);e=e.substring(0,p);}var i=0;var bo=e.indexOf("[");if(bo!=-1){var bc=e.indexOf("]",bo);if(bc!=-1){i=e.substring(bo+1,bc);e=e.substring(0,bo);}}if(e!=""||i!=0){code=code+("n=Bw.Xml.Path._el(n,'"+e+"',"+i+",c);");}if(a!=null&&end){code=code+("n=Bw.Xml.Path._at(n,'"+a+"',c);");}start=stop+1;}return new Function("r","c",code+"return n;");},navigate:function(path,root,create){var c=Bw.Xml.Path.cache[path];if(!c||c==null){c=Bw.Xml.Path.compile(path);Bw.Xml.Path.cache[path]=c;}return c(root,create);},_el:function(node,name,index,create){if(node==null){return null;}if(name=="."||name==""){return node;}function arr(parent,name){var n=[];var i=0;var c=parent.firstChild;while(c!=null){if(c.nodeType==1&&c.nodeName==name){n[i++]=c;}c=c.nextSibling;}return n;}var nodes=arr(node,name);var l=nodes.length;if(index<l){return nodes[index];}if(!create){return null;}var gap=index-l+1;var doc=node.ownerDocument;var n=null;for(var j=0;j<gap;j++){n=doc.createElement(name);node.appendChild(n);}return n;},_at:function(node,name,create){if(node==null){return null;}var a=node.getAttributeNode(name);if(a!=null||(a==null&&!create)){return a;}node.setAttribute(name,"");return node.getAttributeNode(name);}};Bw.Xml.Helpers={getNodes:function(node,path){var a=[];var n=Bw.Xml.Path.navigate(path,node,false);var c=n;while(c!=null){if(c.nodeName==n.nodeName){a.push(c);}c=c.nextSibling;}return a;},getNode:function(node,path,create){var tmp=Bw.Xml.Path.navigate(path,node,create);return tmp;},getNodeValue:function(node){var c=node.childNodes;var l=c.length;var v="";for(var i=0;i<l;i++){var n=c[i];var t=n.nodeType;if(t==3||t==4){v+=n.nodeValue;}}return v;},setNodeValue:function(node,value){if(!value){return;}if(node.nodeType==2){node.value=value;return;}var c=node.childNodes;var l=c.length;for(var i=0;i<l;i++){var n=c[i];if(n.nodeType==3){if(value!=null){n.data=value;}else{node.removeChild(n);}return;}}if(value!=null){var f=node.firstChild;var t=node.ownerDocument.createTextNode(value);if(f==null){node.appendChild(t);}else{node.insertBefore(t,f);}}},removeNode:function(node){var n=node;if(n.nodeType==2){n.ownerElement.removeAttributeNode(n);}else{n.parentNode.removeChild(n);}return n;},importNode:function(dom,node,deep){var n;if(node.nodeType==1){n=dom.createElement(node.nodeName);for(var i=0;i<node.attributes.length;i++){var attr=node.attributes[i];if(attr.nodeValue!=null&&attr.nodeValue!=""){n.setAttribute(attr.name,attr.nodeValue);}}}else{if(node.nodeType==3){n=dom.createTextNode(node.nodeValue);}}if(deep&&node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++){n.appendChild(Bw.Xml.Helpers.importNode(dom,node.childNodes[i],true));}}return n;},createDocument:function(){var i=document.implementation;var d=(i.createDocument)?i.createDocument("","",null):new ActiveXObject("MSXML.DOMDocument");return d;},createHttpRequest:function(){return(typeof ActiveXObject!="undefined")?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();}};var curtainVisible=false;function showCurtain(){var curtain=document.getElementById("curtain");if(curtain==null){var body=document.body;var bodyHeight=body.offsetHeight;var bodyWidth=document.width;if(typeof bodyWidth=="undefined"){bodyWidth=body.offsetWidth;}curtain=document.createElement("div");curtain.id="curtain";with(curtain.style){width=bodyWidth+"px";height=bodyHeight+"px";display="none";backgroundColor="black";position="absolute";top=0;left=0;opacity=0.7;MozOpacity=0.7;filter="alpha(opacity=70)";zIndex=10;}document.body.appendChild(curtain);}curtainVisible=true;curtain.style.display="block";Valraiso.CSS.events.hideSelect();}function hideCurtain(){var curtain=document.getElementById("curtain");if(curtain!=null){curtain.style.display="none";curtainVisible=false;Valraiso.CSS.events.showSelect();}}function toggleCurtain(){if(curtainVisible){hideCurtain();}else{showCurtain();}}var navigateur=navigator.appName.substring(0,3);function openNavigatorCenteredWindow(page,titre,largeur,hauteur,options){if(window.top.screenLeft&&document.body.clientWidth){var left=window.top.screenLeft+(document.body.clientWidth/2)-(largeur/2);var top=(window.top.screenTop+(document.body.clientHeight/2)-(hauteur/2))-14;}else{if(navigateur=="Ope"){var left=(window.innerWidth/2)-(largeur/2);var top=(window.innerHeight/2)-(hauteur/2);}else{if(window.screenX&&window.innerWidth){var left=window.screenX+(window.innerWidth/2)-(largeur/2);var top=(window.screenY+(window.innerHeight/2)-(hauteur/2))+100;}else{var left=screen.availWidth/2;var top=screen.availHeight/2;}}}var popup=window.open(page,titre,"top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);if(popup.closed==false){popup.focus();}}function affichePopUp(nom){var popup=EL(nom);var pos=getDocumentScroll();popup.style.display="block";popup.style.top=(pos.y+100)+"px";toggleCurtain();return false;}function masquePopUp(nom){var popup=EL(nom);popup.style.display="none";return false;}function getDocumentScroll(){var scroll={};scroll.x=0;scroll.y=0;if(typeof window.pageYOffset=="number"){scroll.y=window.pageYOffset;scroll.x=window.pageXOffset;}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scroll.y=document.body.scrollTop;scroll.x=document.body.scrollLeft;}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scroll.y=document.documentElement.scrollTop;scroll.x=document.documentElement.scrollLeft;}}}return scroll;}function checkKeyNewletterPopup(e){var touche;if(window.event){touche=e.keyCode;}else{if(e.which){touche=e.which;}}if(touche==13){var result=checkNewsletterPopup();return result;}return true;}function checkNewsletterPopup(){var emailNewsLetter=EL("email-newsLetter");var newsletterPopUpError=EL("newsletter-popup-error");var customerAccountLink=EL("customer-account-link");var emailForm=EL("popup-prospect-form");var popupProspectIntro=EL("popup-prospect-intro");if(emailNewsLetter.value==""||!Valraiso.util.checkEmail(emailNewsLetter.value)){newsletterPopUpError.style.display="block";}else{var query=Bw.IO.Query.create();var url="/customer-exists?email="+emailNewsLetter.value;query.setNoCache();query.get(url);var customerExists=query.getText();if(customerExists!=null){if(customerExists.indexOf("true")<0){var form=EL("encartNewsletterForm");newsletterPopUpError.style.display="none";form.submit();}else{emailForm.style.display="none";newsletterPopUpError.style.display="none";popupProspectIntro.style.display="none";customerAccountLink.style.display="block";}}}return false;}function disconnectCustomer(){var query=Bw.IO.Query.create();query.setNoCache();query.get("/pneus-POPGOM/mon-compte?disconnect=true",function(){var sheet=query.getText();document.location="/";});}function disconnectCustomerOrderProcess(){var query=Bw.IO.Query.create();query.setNoCache();query.get("/order/disconnect",function(){var sheet=query.getText();document.location="/order/nextStep";});}function popupChanged(pop,uri,extension){var id=pop.id;var url="?type=";var params="";var type="";var widthName="width";var ratioName="ratio";var diameterName="diameter";var loadName="load";var speedName="speed";if(extension!=null){widthName+=extension;ratioName+=extension;diameterName+=extension;loadName+=extension;speedName+=extension;}params+="&searchType=tyre";if(id==widthName){invalidateDimension(speedName,loadName,diameterName,ratioName);}else{if(id==ratioName){invalidateDimension(speedName,loadName,diameterName);}else{if(id=="carMaker"){invalidateVehicle("carDimension","carYear","carMotorPower","carModel");}else{if(id=="carModel"){invalidateVehicle("carDimension","carYear","carMotorPower");}else{if(id=="carMotorPower"){invalidateVehicle("carDimension","carYear");}else{if(id=="carYear"){invalidateVehicle("carDimension");}else{if(id==diameterName){invalidateDimension(speedName,loadName);}}}}}}}var el=EL(widthName);var value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&width="+value;type="ratio";}el=EL(ratioName);value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&ratio="+value;type="diameter";}el=EL("carMaker");value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&carMaker="+value;type="carModel";}el=EL("carModel");value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&carModel="+value;type="carMotorPower";}el=EL("carMotorPower");value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&carMotorPower="+value;type="carYear";}el=EL("carYear");value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&carYear="+value;type="carDimension";}el=EL(diameterName);value=Valraiso.form.getFieldValue(el);if(value!=null){params+="&diameter="+value;type="load";url+=type+params;if(extension!=null){url+="&manufacturerSearch="+extension;}loadMultiPopup(uri+url,type,extension);type="speed";url="?type=";}if(type==""){return;}url+=type+params;if(extension!=null){url+="&manufacturerSearch="+extension;}if(type!=null&&type=="carDimension"){loadMultiPopupIfNoCaptcha(uri+url,type);}else{loadMultiPopup(uri+url,type,extension);}}function invalidateDimension(speed,load,diameter,ratio){var pop;if(ratio!=null){pop=EL(ratio);if(pop!=null){Valraiso.form.select.setSelectedValue(pop,"");cleanPopUp("",ratio);}}if(diameter!=null){pop=EL(diameter);if(pop!=null){Valraiso.form.select.setSelectedValue(pop,"");cleanPopUp("",diameter);}}if(load!=null){pop=EL(load);if(pop!=null){Valraiso.form.select.setSelectedValue(pop,"");cleanPopUp("",load);}}if(speed!=null){pop=EL(speed);if(pop!=null){Valraiso.form.select.setSelectedValue(pop,"");cleanPopUp("",speed);}}}function loadMultiPopup(url,type,extension){var query=Bw.IO.Query.create();query.setNoCache();query.get(url,function(){gotMultiPopup(query,type,extension);});}function gotMultiPopup(query,type,extension){var pop=query.getText();var firstType=type;var selectBeginPosition=pop.indexOf("<select");var selectEndPosition=pop.indexOf("</select>");while(selectBeginPosition!=-1&&selectEndPosition!=-1){if(selectBeginPosition!=-1&&selectEndPosition!=-1){var selectContent=pop.substring(selectBeginPosition,selectEndPosition+9);pop=pop.substring(selectEndPosition+9,pop.length-1);var idBeginPosition=selectContent.indexOf("id=");var idEndPosition=selectContent.indexOf("class=");type=selectContent.substring(idBeginPosition+4,idEndPosition-2);var div=EL(type+"Container");if(div!=null){div.innerHTML=selectContent;}selectBeginPosition=pop.indexOf("<select");selectEndPosition=pop.indexOf("</select>");}}displaySelectFocus();saveMultiFindDimension(firstType);}function displaySelectFocus(){var width=EL("width");var ratio=EL("ratio");var diameter=EL("diameter");var load=EL("load");var speed=EL("speed");var loadLabel=EL("loadLabel");var speedLabel=EL("speedLabel");var carMaker=EL("carMaker");var carModel=EL("carModel");var carMotorPower=EL("carMotorPower");var carYear=EL("carYear");var carDimension=EL("carDimension");if(width!=null&&EL("direction-width")!=null){if(width.options[width.selectedIndex].value!=""){EL("direction-width").style.display="none";if(ratio!=null){if(ratio.options[ratio.selectedIndex].value!=""){EL("direction-ratio").style.display="none";if(diameter!=null){if(diameter.options[diameter.selectedIndex].value!=""){EL("direction-diameter").style.display="none";if(load!=null){if(load.options[load.selectedIndex].value!=""||load.options[load.selectedIndex].text==loadLabel.value){EL("direction-load").style.display="none";}else{EL("direction-load").style.display="block";}}if(speed!=null){if(speed.options[speed.selectedIndex].value!=""||speed.options[speed.selectedIndex].text==speedLabel.value){EL("direction-speed").style.display="none";}else{EL("direction-speed").style.display="block";}}}else{EL("direction-diameter").style.display="block";EL("direction-load").style.display="none";EL("direction-speed").style.display="none";}}}else{EL("direction-ratio").style.display="block";EL("direction-diameter").style.display="none";EL("direction-load").style.display="none";EL("direction-speed").style.display="none";}}}else{EL("direction-width").style.display="block";EL("direction-ratio").style.display="none";EL("direction-diameter").style.display="none";EL("direction-load").style.display="none";EL("direction-speed").style.display="none";}}else{if(carMaker!=null){if(carMaker.options[carMaker.selectedIndex].value!=""){EL("direction-carMaker").style.display="none";if(carModel.options[carModel.selectedIndex].value!=""){EL("direction-carModel").style.display="none";if(carMotorPower.options[carMotorPower.selectedIndex].value!=""){EL("direction-carMotorPower").style.display="none";if(carYear.options[carYear.selectedIndex].value!=""){EL("direction-carYear").style.display="none";if(carDimension.options[carDimension.selectedIndex].value!=""){EL("direction-carDimension").style.display="none";}else{EL("direction-carDimension").style.display="block";}}else{EL("direction-carYear").style.display="block";EL("direction-carDimension").style.display="none";}}else{EL("direction-carMotorPower").style.display="block";EL("direction-carYear").style.display="none";EL("direction-carDimension").style.display="none";}}else{EL("direction-carModel").style.display="block";EL("direction-carMotorPower").style.display="none";EL("direction-carYear").style.display="none";EL("direction-carDimension").style.display="none";}}else{EL("direction-carMaker").style.display="block";EL("direction-carModel").style.display="none";EL("direction-carMotorPower").style.display="none";EL("direction-carYear").style.display="none";EL("direction-carDimension").style.display="none";}}}}function saveMultiFindDimension(firstType){var params="";var el=EL("carMaker");var value=Valraiso.form.getFieldValue(el);if(value!=null){setParamForSearchCookie("carMaker",value);}el=EL("carModel");value=Valraiso.form.getFieldValue(el);if(value!=null){setParamForSearchCookie("carModel",value);}el=EL("carMotorPower");value=Valraiso.form.getFieldValue(el);if(value!=null){setParamForSearchCookie("carMotorPower",value);}el=EL("carYear");value=Valraiso.form.getFieldValue(el);if(value!=null){setParamForSearchCookie("carYear",value);}el=EL("carDimension");value=Valraiso.form.getFieldValue(el);if(value!=null){setParamForSearchCookie("carDimension",value);}el=EL("width");var widthValue=Valraiso.form.getFieldValue(el);var ratioValue=null;var diameterValue=null;var loadValue=null;var speedValue=null;if(widthValue!=null){setParamForSearchCookie("width",widthValue);ratioValue="";diameterValue="";loadValue="";speedValue="";}el=EL("ratio");value=Valraiso.form.getFieldValue(el);if(ratioValue!=null){if(value!=null){ratioValue=value;}setParamForSearchCookie("ratio",ratioValue);}el=EL("diameter");value=Valraiso.form.getFieldValue(el);if(diameterValue!=null){if(value!=null){diameterValue=value;}setParamForSearchCookie("diameter",diameterValue);}el=EL("load");value=Valraiso.form.getFieldValue(el);if(loadValue!=null){if(value!=null){loadValue=value;}setParamForSearchCookie("load",loadValue);}el=EL("speed");value=Valraiso.form.getFieldValue(el);if(speedValue!=null){if(value!=null){speedValue=value;}setParamForSearchCookie("speed",speedValue);}}function setParamForSearchCookie(key,value){var searchCookieValue=createOrUpdateSearchParamCookieValue(key,value);setSearchParamCookie(searchCookieValue);}function getSearchParamCookieValue(){var cookieKey="SEARCH_PARAM";return getCookieValue(cookieKey);}function setSearchParamCookie(value){var date_exp=new Date();date_exp.setTime(date_exp.getTime()+(365*24*3600*1000));document.cookie="SEARCH_PARAM="+escape(value)+";path=/; expires="+date_exp.toGMTString();}function createOrUpdateSearchParamCookieValue(key,value){var cookieValue=getSearchParamCookieValue();if(cookieValue==null){cookieValue=buildEmptySearchParamCookieValue();}var searchParams=cookieValue.split(",");var currentParam="";for(i=0;i<searchParams.length;i++){currentParam=searchParams[i].split(":");if(currentParam[0]==key){searchParams[i]=currentParam[0]+":"+value;}}cookieValue="";for(i=0;i<searchParams.length;i++){cookieValue+=searchParams[i];if(i!=searchParams.length-1){cookieValue+=",";}}return cookieValue;}function buildEmptySearchParamCookieValue(){var params="width:,ratio:,diameter:,load:,speed:,carMaker:,carModel:,carMotorPower:,carYear:,carDimension:,manufacturer:,reinforced:,runFlat:,season:,vehicleType:";if(typeof(defaultSearchCookieValue)!="undefined"&&defaultSearchCookieValue!=null&&defaultSearchCookieValue!=""){params=defaultSearchCookieValue;}return params;}function getCookieValue(cookieKey){var allCookies=document.cookie.split(";");var currentCookie="";var cookieName="";var cookieValue="";for(i=0;i<allCookies.length;i++){currentCookie=allCookies[i].split("=");cookieName=currentCookie[0].replace(" ","");if(cookieName==cookieKey){if(currentCookie.length>1){cookieValue=unescape(currentCookie[1]);}return cookieValue;break;}currentCookie=null;cookieName="";}return null;}function cleanPopUp(value,type){var html;var container=EL(type+"Container");html='<select name="';html+=type;html+='" id="';html+=type;html+='">';html+='   <option value="';html+=value;html+='">...</option>';html+="</select>";container.innerHTML=html;}function doSearch(mode){var ok=doFormSearch(mode);if(ok){var form=EL("searchForm");form.submit();}return false;}function doFormSearch(mode){var width;var ratio;var diameter;var speed;var carMaker;var carModel;var carMotorPower;var carYear;var carDimension;var isError=false;var nbErrorLeftColumn=0;var nbErrorRightColumn=0;var leftColumn=false;var labelError="";var colorError=EL("color-error").value;var colorStand="white";var colorStandItem=EL("color-stand");if(colorStandItem!=null){colorStand=colorStandItem.value;}var callCenterDimension=EL("callCenterDimension");if(callCenterDimension!=null){var value=callCenterDimension.value;value=Valraiso.util.trim(value);if(value!=""){return true;}}if(mode==""||mode=="size"||mode=="brand"){width=EL("width");ratio=EL("ratio");diameter=EL("diameter");speed=EL("speed");if(width.value==""){EL("label-width").style.color=colorError;var labelWidth=EL("label-width").firstChild.nodeValue;labelError+=labelWidth;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-width").style.color=colorStand;}if(ratio.value==""){EL("label-ratio").style.color=colorError;var labelRatio=EL("label-ratio").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelRatio;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-ratio").style.color=colorStand;}if(diameter.value==""){EL("label-diameter").style.color=colorError;var labelDiameter=EL("label-diameter").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelDiameter;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-diameter").style.color=colorStand;}}else{if(mode=="vehicle"){carMaker=EL("carMaker");carModel=EL("carModel");carMotorPower=EL("carMotorPower");carYear=EL("carYear");carDimension=EL("carDimension");if(carMaker.value==""){EL("label-carMaker").style.color=colorError;var labelCarMaker=EL("label-carMaker").firstChild.nodeValue;labelError+=labelCarMaker;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carMaker").style.color="white";}if(carModel.value==""){EL("label-carModel").style.color=colorError;var labelCarModel=EL("label-carModel").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarModel;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carModel").style.color="white";}if(carMotorPower.value==""){EL("label-carMotorPower").style.color=colorError;var labelCarMotorPower=EL("label-carMotorPower").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarMotorPower;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carMotorPower").style.color="white";}if(carYear.value==""){EL("label-carYear").style.color=colorError;var labelCarYear=EL("label-carYear").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarYear;isError=true;nbErrorRightColumn++;}else{EL("label-carYear").style.color="white";}if(carDimension.value==""){EL("label-carDimension").style.color=colorError;var labelCarDimension=EL("label-carDimension").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarDimension;isError=true;nbErrorRightColumn++;}else{EL("label-carDimension").style.color="white";}}else{if(mode=="vehicleWheel"){carMaker=EL("carMaker");carModel=EL("carModel");carMotorPower=EL("carMotorPower");carYear=EL("carYear");carDimension=EL("carDimension");if(carMaker.value==""){EL("label-carMaker").style.color=colorError;var labelCarMaker=EL("label-carMaker").firstChild.nodeValue;labelError+=labelCarMaker;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carMaker").style.color="white";}if(carModel.value==""){EL("label-carModel").style.color=colorError;var labelCarModel=EL("label-carModel").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarModel;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carModel").style.color="white";}if(carMotorPower.value==""){EL("label-carMotorPower").style.color=colorError;var labelCarMotorPower=EL("label-carMotorPower").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarMotorPower;isError=true;leftColumn=true;nbErrorLeftColumn++;}else{EL("label-carMotorPower").style.color="white";}if(carYear.value==""){EL("label-carYear").style.color=colorError;var labelCarYear=EL("label-carYear").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarYear;isError=true;nbErrorRightColumn++;}else{EL("label-carYear").style.color="white";}if(carDimension.value==""){EL("label-carDimension").style.color=colorError;var labelCarDimension=EL("label-carDimension").firstChild.nodeValue;if(isError){labelError+=", ";}labelError+=labelCarDimension;isError=true;nbErrorRightColumn++;}else{EL("label-carDimension").style.color="white";}}}}if(isError){EL("warning-message").style.display="block";var heightError=96;EL("label-error").firstChild.nodeValue=labelError;startDecrease(heightError);}else{return true;}return false;}function startDecrease(heightAsk){div1=EL("warning-message");div1.style.display="block";var speed=0.3;if(navigator.appName=="Microsoft Internet Explorer"){speed=1;}actif=window.setInterval("decrease("+heightAsk+")",speed);}function decrease(heightAsk){div1=EL("warning-message");height=div1.style.height.substring(0,div1.style.height.length-2);if(height<heightAsk){height=(height*1)+1;div1.style.height=height+"px";}else{if(height>heightAsk){height=(height*1)-1;div1.style.height=height+"px";}else{window.clearInterval(actif);if(heightAsk==0){div1.style.display="none";}}}}
