﻿function validate()
{		
	
	if (document.input.terms_conditions_agreement.checked==false)
	{
	alert('You must agree to terms and conditions.');
		document.location.href = '#';
	return false;}
   
	txtZip = document.getElementById("txtZip");			
	txtPhone = document.getElementById("txtPhone");			
	divLblErrorMessageGeneral = document.getElementById("lblErrorMessageGeneral");
	divLblErrorMessageZipCodeInvalid = document.getElementById("lblErrorMessageZipCodeInvalid");
	divLblErrorMessagePhoneNumberInvalid = document.getElementById("lblErrorMessagePhoneNumberInvalid");
	divLblErrorMessageGeneral.className = 'nodisplay';	
	
	if (txtZip != null && txtZip.length == 0 )
	{
			if (divLblErrorMessageGeneral != null)
			{
				divLblErrorMessageGeneral.className = 'error';
			}
			if (divLblErrorMessageZipCodeInvalid != null)
			{
				divLblErrorMessageZipCodeInvalid.className = 'error';
			}
			if (divLblErrorMessagePhoneNumberInvalid != null)
			{
				divLblErrorMessagePhoneNumberInvalid.className = 'nodisplay';
			}			
			document.location.href = '#top';
			return false;
	}
	
	if (txtPhone != null && txtZip.length == 0 )
	{
			if (divLblErrorMessageGeneral != null) 
			{
				divLblErrorMessageGeneral.className = 'error';
			}
			if (divLblErrorMessageZipCodeInvalid != null)
			{
				divLblErrorMessageZipCodeInvalid.className = 'nodisplay';
			}
			if (divLblErrorMessagePhoneNumberInvalid != null)
			{
				divLblErrorMessagePhoneNumberInvalid.className = 'error';
			}
			document.location.href = '#top';
			return false;
	} 		
	
	return true;
}	
