
			
			//Set the Agent ID here
			//Please set the AgentID number that has been provided for you 		
			var agentID="1302";
			
			//validate a postcode...
			function validate(pcode)
		    {
              var rx = /[A-Z]{1,2}[0-9R][0-9A-Z]? *[0-9][A-Z]{2}/ ;
              var matches = rx.exec(pcode) ;
              return (matches != null && pcode == matches[0]) ;
            }
             
            //redirect to Energyhelpline and a valid UK postcode...       
            function redir()
            {
           
			   var ehl_pcode= document.getElementById('ehl_postcode').value;
			   if (agentID !=null)
			   {
			        if (!validate(ehl_pcode.toUpperCase()))
			        {
			            alert('Please enter a valid UK postcode');
					    return false;
					}
					else
					{
					    window.location = "http://www.energyhelpline.com?aid=" + agentID + "&postcode=" + ehl_pcode;
					}
			    }
				return false;
			 }
