function validate_required(field,alerttxt){
with (field){
if (value==null||value=="")
  {alert(alerttxt);return false}
else {return true}}}

function validate_email(field,alerttxt){
with (field){
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}}}

function isNumberKey(evt){
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}

function isAlphaKey(e) {
var k;
document.all ? k = e.keyCode : k = e.which;
return ((k > 64 && k < 91) || (k > 96 && k < 123) || k == 8);
}
function extractAlpha(str) {
return str.replace(/[^a-z]/gi,"");
}

//start validation for application
function validate_contact(thisform){with (thisform){
	
//name
if (validate_required(name,"Your name is required!")==false)
{name.focus();return false}

//email
if (validate_email(email,"Your email is required!")==false)
{email.focus();return false}

//street address
if (validate_required(address,"What is your Street Address?")==false)
{address.focus();return false}

//city
if (validate_required(city,"What City do you live in?")==false)
{city.focus();return false}

//state
if (state.value.length < 2){
alert("What State do you live in?");
state.focus();
return (false);}

//zip
if (zip.value.length < 5){
alert("What is your Zip Code?");
zip.focus();
return (false);}

//phone
if (phone.value.length < 10){
alert("What is the best number to get a hold of you?");
phone.focus(); return (false);}

//message
if (validate_required(message,"Please leave your message")==false)
{message.focus();return false}

}
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)}