function showEmail(div,pre){
var d='aewoodward.co.uk';
var a=document.getElementById(div)
a.href="mailto:"+pre+"@"+d
a.innerHTML=pre+"@"+d
}

function menuOn(id){
var i=document.getElementById(id)
i.src=i.getAttribute("srcover");
document.getElementById("banner").src="images/banner-home.jpg";
}

function setBox(isChecked,div,lbl){
    if(isChecked==true){
    document.getElementById(div).style.display="block";
    document.getElementById(lbl).style.fontWeight="bold";
    }else{
    document.getElementById(div).style.display="none";
    document.getElementById(lbl).style.fontWeight="normal";
    }
}

    var account_code='GETSM11111';
    var license_code='ZX52-JB52-GX91-MT48';
    var machine_id='';


function pcaByPostcodeBegin()
       {
	      var postcode = document.getElementById("ctl00_ContentPlaceHolder2_txtPostcode").value;
          var scriptTag = document.getElementById("pcaScriptTag");
          var headTag = document.getElementsByTagName("head").item(0);
          var strUrl = "";
          
          document.getElementById("divLoading").style.display = '';          
          //Build the url
          strUrl = "http://services.postcodeanywhere.co.uk/inline.aspx?";
          strUrl += "&action=lookup";
          strUrl += "&type=by_postcode";
          strUrl += "&postcode=" + escape(postcode);
          strUrl += "&account_code=" + escape(account_code);
          strUrl += "&license_code=" + escape(license_code);
          strUrl += "&machine_id=" + escape(machine_id);
          strUrl += "&callback=pcaByPostcodeEnd";
          
          //Make the request
          if (scriptTag)
             {
                //The following 2 lines perform the same function and should be interchangeable
                headTag.removeChild(scriptTag);
                //scriptTag.parentNode.removeChild(scriptTag);
             }
          scriptTag = document.createElement("script");
          scriptTag.src = strUrl
          scriptTag.type = "text/javascript";
          scriptTag.id = "pcaScriptTag";
          headTag.appendChild(scriptTag);                              
       }
       
       function pcaByPostcodeEnd()
       {
	      document.getElementById("divLoading").style.display = 'none';
    	  
          //Test for an error
          if (pcaIsError)
             {
                //Show the error message
                document.getElementById("select1").style.display = 'none';
                document.getElementById("btnFetch").style.display = 'none';
                alert(pcaErrorMessage);
             }
          else
             {
                //Check if there were any items found
                if (pcaRecordCount==0)
                   {
                      document.getElementById("select1").style.display = 'none';
				      document.getElementById("Button1").style.display = 'none';
                      alert("Sorry, no matching items found. Please try another postcode.");
                   }
                else
                   {
				      document.getElementById("select1").style.display = '';
				      document.getElementById("Button1").style.display = '';
    				  
				      for (i=document.getElementById("select1").options.length-1; i>=0; i--){
					      document.getElementById("select1").options[i] = null;
					    }
				      for (i=0; i<pca_id.length; i++){
                        document.getElementById("select1").options[document.getElementById("select1").length] = new Option(pca_description[i], pca_id[i]);
                      }
                   }
             }
       }

    function pcaFetchBegin()
       {
	      var address_id = document.getElementById("select1").value;
          var scriptTag = document.getElementById("pcaScriptTag");
          var headTag = document.getElementsByTagName("head").item(0);
          var strUrl = "";

          //Build the url
          strUrl = "http://services.postcodeanywhere.co.uk/inline.aspx?";
          strUrl += "&action=fetch";
          strUrl += "&id=" + escape(address_id);
          strUrl += "&account_code=" + escape(account_code);
          strUrl += "&license_code=" + escape(license_code);
          strUrl += "&machine_id=" + escape(machine_id);
          strUrl += "&callback=pcaFetchEnd";

          //Make the request
          if (scriptTag)
             {
                //The following 2 lines perform the same function and should be interchangeable
                headTag.removeChild(scriptTag);
                //scriptTag.parentNode.removeChild(scriptTag);
             }
          scriptTag = document.createElement("script");
          scriptTag.src = strUrl
          scriptTag.type = "text/javascript";
          scriptTag.id = "pcaScriptTag";
          headTag.appendChild(scriptTag);
          
          document.getElementById("select1").style.display = 'none';
          document.getElementById("Button1").style.display = 'none';
       }

    function pcaFetchEnd()
       {
          //Test for an error
          if (pcaIsError)
             {
                //Show the error message
                alert(pcaErrorMessage);
             }
          else
             {
                //Check if there were any items found
                if (pcaRecordCount==0)
                   {
                      alert("Sorry, no matching items found");
                   }
                else
                   {
				      /*document.forms[1]["company"].value = '' + pca_organisation_name[0];
				      document.forms[1]["line1"].value = '' + pca_line1[0];
				      document.forms[1]["line2"].value = '' + pca_line2[0];
				      document.forms[1]["line3"].value = '' + pca_line3[0];
				      document.forms[1]["line4"].value = '' + pca_line4[0];
				      document.forms[1]["line5"].value = '' + pca_line5[0];*/
				      document.getElementById("ctl00_ContentPlaceHolder2_txtAddress1").value = '' + pca_line1[0];
				      document.getElementById("ctl00_ContentPlaceHolder2_txtTown").value = '' + pca_post_town[0];
				      document.getElementById("ctl00_ContentPlaceHolder2_txtCounty").value = '' + pca_county[0];
				     // document.getElementById("postcode").value = '' + pca_postcode[0];				     			      
                   }
             }
       }