function validateNumeric(field) {
		var valid = "0123456789"
		var ok = "yes";
		var temp;
		for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
		}
		if (ok == "no") {
		field.focus();
		field.select();
		return false;
		   }
}

function emailCheck(emailaddr) {
var s=/^(.+)@(.+)\.(.+)$/;
if (emailaddr.match(s)==null) {       
	return false;       
}
return true;
}

// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
	if (isNaN(parseInt(stripped))) {
	   return false; 
	}
	if (!(stripped.length == 10)) {
		return false; 
	} 		
return true;
}	
	
function frmValidate(theForm) {
	var ziplength;

	if (theForm.ServiceID.value == "0") {
		alert("Please select a Service from the drop-down list.");
		theForm.ServiceID.focus();
		return(false);
	}
	
	if (theForm.FName.value == "") {
		alert("First Name is a required field.");
		theForm.FName.focus();
		return(false);
	}
	
	if (theForm.LName.value == "") {
		alert("Last Name is a required field.");
		theForm.LName.focus();
		return(false);
	}
	
	if (theForm.Address.value == "") {
		alert("Address is a required field.");
		theForm.Address.focus();
		return(false);
	}
	
	if (theForm.City.value == "") {
		alert("City is a required field.");
		theForm.City.focus();
		return(false);
	}
	
	if (theForm.State.value == "") {
		alert("State is a required field.");
		theForm.State.focus();
		return(false);
	}
	
	if (theForm.Zip.value == "") {
		alert("Zip Code is a required field.");
		theForm.Zip.focus();
		return(false);
	}				

	if (theForm.Email.value == "") {
		alert("Email address is a required field.");
		theForm.Email.focus();
		return(false);
	}

	if (theForm.DayPhone.value == "") {
		alert("Day Phone is a required field.");
		theForm.DayPhone.focus();
		return(false);
	}

	ziplength = theForm.Zip.value.length;		
	
	if (ziplength != 5){
		alert("Zip Code must be 5-digits");
		theForm.Zip.focus();
		return(false);
	}
		
	if (!(checkPhone(theForm.DayPhone.value))) {
		alert("Please enter a valid 10 digit numeric day phone number.");
		theForm.DayPhone.focus();
		return(false);
	}			
		
	if (!(emailCheck(theForm.Email.value))) {
		alert("Please enter a valid email address.  Example: 'yourname@company.com'.");
		theForm.Email.focus();
		return(false);
	}

	if (theForm.Terms.checked == false){
		alert ('Please click the checkbox to agree to the Terms and Conditions');
		return false;
	}
		
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=600,height=600');");
}