function GetXmlHttpObject(){var a=false;if(window.XMLHttpRequest){try{a=new XMLHttpRequest()}catch(b){a=false}}else{if(window.createRequest){try{a=new window.createRequest()}catch(b){a=false}}else{if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){a=false}}}}}return a}var lastCodePostalValue=null;var WaitingForReponse=false;function fillCombo(d,g,a,k){if(!scanToucheNumeric(k)){return}if(!g||!d){return}var j=d.value;var h=/\d{5}/;if(!h.test(j)){initCombo(g);return}if(j==lastCodePostalValue&&g.options.length>1){return}lastCodePostalValue=j;if(g.options.length>1){initCombo(g)}var c=GetXmlHttpObject();if(!c||!a||WaitingForReponse){return}var b="Choisissez";g.options[0].text="chargement...";g.disabled=true;try{c.open("GET",a+"/Controls/Popup/MagasinsProches.ashx?cp="+j+"&nocache="+Math.random(),true);c.onreadystatechange=function(){if(c.readyState==4){if(c.status==200){g.options[0].text=b;g.disabled=false;var e;if(window.ActiveXObject){e=c.responseXML.childNodes[1];for(i=0;i<e.childNodes.length;i++){var m=e.childNodes[i];if(m.childNodes.length==0){continue}var l=document.createElement("option");l.value=m.getElementsByTagName("CODE").item(0).text;l.text=m.getElementsByTagName("NAME").item(0).text;g.add(l)}}else{e=c.responseXML.childNodes[0];for(i=0;i<e.childNodes.length;i++){var m=e.childNodes[i];if(m.childNodes.length==0){continue}var l=document.createElement("option");l.value=m.getElementsByTagName("CODE").item(0).textContent;l.text=m.getElementsByTagName("NAME").item(0).textContent;g.add(l,null)}}}else{alert("Des erreurs sont survenus lors du contact avec le site web!");g.options[0].text=b;g.disabled=false}WaitingForReponse=false}};c.send(null);WaitingForReponse=true}catch(f){WaitingForReponse=false;alert(f)}return}function initCombo(b){try{var d=b.options[0].text;while(b.options.length!=0){b.remove(0)}var a=document.createElement("option");a.text=d;a.selected=true;if(window.ActiveXObject){b.add(a)}else{b.add(a,null)}b.selectedIndex=0}catch(c){alert(c)}return}function pressePapierNS6(c,b){var a=/[cvxz]/i;for(prop in c){if(prop=="ctrlKey"){isModifiers=true}}if(isModifiers){return c.ctrlKey&&a.test(b)}else{return false}}function codeTouche(a){for(prop in a){if(prop=="which"){return(a.which)}}return(a.keyCode)}function scanToucheNumeric(f){var b=/[\x00\x08\x0D\x03\x16\x18\x1A]/;var c=/\d/;var e=codeTouche(f);var a=String.fromCharCode(e);var d=c.test(a)||b.test(a)||pressePapierNS6(f,a);return d}function QueryPage0(d,c){if(!d||!c){return}try{var b=/\d{4}/;if(c.selectedIndex>0&&b.test(c.value)){var a=GetXmlHttpObject();a.open("GET",d+"/Controls/Popup/ProcessPopupData.aspx?a=0&b="+c.value+"&c="+Math.random(),true);a.onreadystatechange=function(){if(a.readyState==4){if(a.status==200){if(a.responseText==""){document.location=cleanedLocationUrl()}else{alert(a.responseText)}document.body.style.cursor="default";c.disabled=false}}};document.body.style.cursor="wait";c.disabled=true;a.send(null)}}catch(f){document.body.style.cursor="default";c.disabled=false;alert(f)}}function QueryPage1(a,c,h,j,k){if(!a||!c||!h||!j){return}try{var f=/\d{4}/;var d=/\d{5}/;if(h.selectedIndex>0&&f.test(h.value)&&d.test(c.value)){var l="";if(k){l=k.value}var b=GetXmlHttpObject();b.open("GET",a+"/Controls/Popup/ProcessPopupData.aspx?a=1&b="+h.value+"&c="+j.checked+"&d="+l+"&e="+Math.random(),true);b.onreadystatechange=function(){if(b.readyState==4){if(b.status==200){if(b.responseText==""){document.location=cleanedLocationUrl()}else{alert(b.responseText)}document.body.style.cursor="default";c.disabled=false;h.disabled=false;j.disabled=false;if(k){k.disabled=false}}}};document.body.style.cursor="wait";c.disabled=true;h.disabled=true;j.disabled=true;if(k){k.disabled=true}b.send(null)}}catch(g){document.body.style.cursor="default";c.disabled=false;h.disabled=false;j.disabled=false;if(k){k.disabled=false}alert(g);console.log(g)}}function QueryPage2(g,c,d,b){if(!g||!d||!b){return}try{var f=GetXmlHttpObject();f.open("GET",g+"/Controls/Popup/ProcessPopupData.aspx?a="+c+"&b="+d.checked+"&c="+Math.random(),true);f.onreadystatechange=function(){if(f.readyState==4){if(f.status==200){if(f.responseText==""){document.location=cleanedLocationUrl()}else{alert(f.responseText)}document.body.style.cursor="default";d.disabled=false;b.disabled=false}}};document.body.style.cursor="wait";d.disabled=true;b.disabled=true;f.send(null)}catch(h){document.body.style.cursor="default";d.disabled=false;b.disabled=false;alert(h)}}function QueryPage3(f,b,d){if(!f||!d){return}try{var c=GetXmlHttpObject();c.open("GET",f+"/Controls/Popup/ProcessPopupData.aspx?a="+b+"&b="+d+"&c="+Math.random(),true);c.onreadystatechange=function(){if(c.readyState==4){if(c.status==200){if(c.responseText==""){document.location=cleanedLocationUrl()}else{alert(c.responseText)}document.body.style.cursor="default"}}};document.body.style.cursor="wait";c.send(null)}catch(g){document.body.style.cursor="default";alert(g)}}function EnterToClick(d,a){var c;var b=document.getElementById(a);if(!d){var d=window.event}if(d.keyCode){c=d.keyCode}else{if(d.which){c=d.which}}if(c==13&&b){if(b.onclick){b.onclick()}else{b.click()}}}function decouvrir(){document.getElementById("ctl00_ContenuPage_tbDecouvrir").value="true";__doPostBack("ctl00$ContenuPage$lRedirection","")}function cleanedLocationUrl(){var b=new String();b=document.location.href;var c=new Array();c=b.split("/");var a=c[c.length-1];var d=0;if((d=a.indexOf("#",0))>=0){d+=b.length-a.length;b=b.substring(0,d)}c=b.split("/");a=c[c.length-1];d=((d=a.indexOf("&nocache",0))>=0)?d:a.indexOf("?nocache",0);if(d>=0){d+=b.length-a.length;b=b.substring(0,d)}b+=(b.indexOf("?",0)>=0?"&":"?")+"nocache="+Math.random();return b};