$(function(){
	
	//Sets up the hover for the submit Button
	$(".submitButton").hover(function () {
			$(this).addClass("submitButtonHover");
		},
		function () {
			$(this).removeClass("submitButtonHover");
	});

});

//Set the Agent ID here
//Please set the AgentID number that has been provided for you 		
var agentID="1302";

// UK Postcode validation - John Gardner - http://www.braemoor.co.uk/software/postcodes.shtml
function checkPostCode(tC){var a1="[abcdefghijklmnoprstuwyz]",a2="[abcdefghklmnopqrstuvwxy]",a3="[abcdefghjkstuw]",a4="[abehmnprvwxy]",a5="[abdefghjlnpqrstuwxyz]",pX=new Array();pX.push(new RegExp("^("+a1+"{1}"+a2+"?[0-9]{1,2})(\\s*)([0-9]{1}"+a5+"{2})$","i"));pX.push(new RegExp("^("+a1+"{1}[0-9]{1}"+a3+"{1})(\\s*)([0-9]{1}"+a5+"{2})$","i"));pX.push(new RegExp("^("+a1+"{1}"+a2+"?[0-9]{1}"+a4+"{1})(\\s*)([0-9]{1}"+a5+"{2})$","i"));pX.push(/^(GIR)(\s*)(0AA)$/i);pX.push(/^(bfpo)(\s*)([0-9]{1,4})$/i);pX.push(/^(bfpo)(\s*)(c\/o\s*[0-9]{1,3})$/i);pX.push(/^([A-Z]{4})(\s*)(1ZZ)$/i);var pC=tC,v=false;for(var i=0;i<pX.length;i++){if(pX[i].test(pC)){pX[i].exec(pC);pC=RegExp.$1.toUpperCase()+" "+RegExp.$3.toUpperCase();pC=pC.replace(/C\/O\s*/,"c/o ");v=true;break;}};return(v)?pC:false;}
 
//redirect to Energyhelpline and a valid UK postcode...       
function redir()
{
	
   var ehl_pcode= document.getElementById('ehl_postcode').value;
   if (agentID !=null)
   {
		if (!checkPostCode(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;
 }