﻿function validate()
{			
	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.value.match('^[0-9]{4}$')) 	
	{
			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 && !txtPhone.value.match('^([0-9]{2}\-?\ ?\/?[0-9]*)$')) 
	{
			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;
}	