function SubmitAddress()
{
 if( IsValid() )
 {
	 var querystring = "";
	 
	 querystring = "address=" + document.getElementById("dl_addressInput").value + "&zip=" + document.getElementById("dl_zipCodeInput").value;
	 querystring = querystring.replace("#","");
	
	
	 CallDispatch( querystring );
 }
 else if(( document.getElementById("emailMarker").style.display == "block" ) && ( document.getElementById("emailInput").value == "" ))
 {
 alert("Please enter a valid email.");
 }
 else if( document.getElementById("phone").style.display == "block" )
 {
 alert("Please enter a valid phone number.");
 }
 else
 {
 alert("Please enter a valid address and zip code.");
 }
}

function CallDispatch(querystring)
{
 location.href = "http://direct.digitallanding.com/Dispatch.aspx?promoid=5009038&" + querystring;
} 


function IsValid()
{
 var valid = true;
 
 
 if(document.getElementById("dl_addressInput").value == "" || document.getElementById("dl_addressInput").value == "Street Address" )
 {
 	alert("Please enter a valid address");
	 valid = false;
 }


 var zipCode = document.getElementById("dl_zipCodeInput").value.replace(" ","");
 if((zipCode.length < 5 ) || ( isNaN(zipCode)) || zipCode == "Zip Code")
 {
	 alert("Please enter a valid zip code");
	 valid = false;
 }


 return valid;
} 


function SubmitZip(int)
{
 var valid = true;
 var num = int;
 
 
 var zipCode = document.getElementById("dl_zipCodeInput"+num).value.replace(" ","");
 if((zipCode.length < 5 ) || ( isNaN(zipCode)) || zipCode == "Zip Code")
 {
	 alert("Please enter a valid zip code");
	 valid = false;
 }


 if(valid){
 	location.href = "http://direct.digitallanding.com/Dispatch.aspx?promoid=5009038&zip=" + zipCode;
 	//PromoID=5009038
 	//SID=fc7f1f8a-03ed-4267-bc8e-02f97d4747c2
 }
} 