function isFieldNumeric(strString){var strValidChars="0123456789.-";var strChar;var blnResult=true;if(strString.length===0){return false;}for(i=0;i<strString.length&&blnResult===true;i++){strChar=strString.charAt(i);if(strValidChars.indexOf(strChar)==-1){blnResult=false;}}return blnResult;}function GetAddress(){var house_number='';var post_code='';var params;var xmlHttp=null;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}else{xmlHttp=new XMLHttpRequest();}if(!xmlHttp){document.getElementById("address_error").innerHTML='Sorry. We are experiencing problems checking postcodes. Please try again or enter your details below.';}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var Response=xmlHttp.responseText;if(Response=="TOOMANYATTEMPTS"){document.getElementById("address_error").innerHTML="Sorry. Can only look up 10 postcodes. Please enter your full details below.";return;}else if(Response=="NOTFOUND"){document.getElementById("address_error").innerHTML="Sorry. Address not found. Please enter your full details below.";return;}else if(Response=="ERROR"){document.getElementById("address_error").innerHTML="Sorry. We are experiencing problems looking up your postcode. Please enter your full details below.";return;}else{Response=Response.replace(/\r|\n|\r\n/g,"");results=Response.split(",");if(results[0]=='MATCH'){if(results[1]!==''){document.getElementById('address1').value=results[1];if(results[2]!==''){document.getElementById('address2').value=results[2];document.getElementById('address3').value=results[3];}else{document.getElementById('address2').value=results[3];}}else{document.getElementById('address1').value=results[2];document.getElementById('address2').value=results[3];}document.getElementById('towncity').value=results[4];document.getElementById('county').value=results[5];document.getElementById('postcode').value=results[6];document.getElementById("address_error").innerHTML='Please check address details below before proceeding.';}else if(results[0]=='LIST'){var listresdisp;document.checkoutform.lstAddresses.options.length=0;document.getElementById("address_error").innerHTML='Please choose address from below list.';listres=Response.split("|");for(var i=0;i<listres.length;i++){listresdisp=listres[i].replace("LIST,,","");listresdisp=listresdisp.replace("LIST,","");listresdisp=listresdisp.replace(/,,/g,",");listresdisp=listresdisp.replace(/,/g,", ");var newOption=new Option(listresdisp,listres[i]);document.checkoutform.lstAddresses.options[document.checkoutform.lstAddresses.options.length]=newOption;}document.getElementById('listaddresses').style.display='block';}}}};document.getElementById('listaddresses').style.display='none';house_number=document.getElementById("find_housenumber").value;post_code=document.getElementById("find_postcode").value;document.getElementById("address1").value='';document.getElementById("address2").value='';document.getElementById("address3").value='';document.getElementById("towncity").value='';document.getElementById("county").value='';if(house_number!==''&&post_code!==''){params='Lookfor='+house_number+','+post_code+'&mode=1';xmlHttp.open("POST","action.php?cdd=proxymatchcode",true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(params);}else{params='Lookfor='+post_code+'&mode=2';xmlHttp.open("POST","action.php?cdd=proxymatchcode",true);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(params);}}function UseAddress(){document.getElementById("address1").value='';document.getElementById("address2").value='';document.getElementById("address3").value='';document.getElementById("towncity").value='';document.getElementById("county").value='';document.getElementById("postcode").value='';results=document.checkoutform.lstAddresses.options[document.checkoutform.lstAddresses.selectedIndex].value.split(",");if(results[1]!==''){document.getElementById('address1').value=results[1];if(results[2]!==''){document.getElementById('address2').value=results[2];document.getElementById('address3').value=results[3];}else{document.getElementById('address2').value=results[3];}}else{document.getElementById('address1').value=results[2];document.getElementById('address2').value=results[3];}document.getElementById('towncity').value=results[4];document.getElementById('county').value=results[5];document.getElementById('postcode').value=results[6];document.getElementById("address_error").innerHTML='Please check address details below before proceeding.';}function ShowPopup(hoveritem){var pu;pu=document.getElementById("popup");pu.style.top=hoveritem.offsetTop+18;pu.style.left=hoveritem.offsetLeft+20;pu.style.visibility="Visible";}function HidePopup(){document.getElementById("popup").style.visibility="Hidden";}function HighLightField(id){document.getElementById(id).style.backgroundColor='#CC0000';document.getElementById(id).style.color='#FFF';}function UnHighLightField(id){document.getElementById(id).style.backgroundColor='#FFF';document.getElementById(id).style.color='#000';}function PostcodeChanged(oldpostcodefield,newpostcodefield){var oldpostcode='';var newpostcode='';var params;var xmlHttp=null;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}else{xmlHttp=new XMLHttpRequest();}if(!xmlHttp){alert("Sorry. We are experiencing problems. Please try again or contact us.");}xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){var Response=xmlHttp.responseText;if(Response=="OK"){document.getElementById('pchk').value='0';}else{document.getElementById('pchk').value='1';}}};oldpostcode=document.getElementById(oldpostcodefield).value;newpostcode=document.getElementById(newpostcodefield).value;params='oldpostcode='+escape(oldpostcode)+'&newpostcode='+escape(newpostcode)+'&mode=proxycapscanpostcode';xmlHttp.open("POST","action.php",false);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(params);}