function checkZip(checkStr) {
	if(checkStr.length == 0)
		return false;	
	if(checkStr == null || checkStr == "" || isNaN(checkStr) || checkStr.length != 5){
		alert("Please enter a valid 5 digit Zip code without\ndashes or other punctuation.");
		document.ConsultForm.Zip.select();
		document.ConsultForm.Zip.focus();
		return false;
	}	
}
function validateEmail(field){
	var regEx = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([a-zA-Z]{2,3})|(aero|coop|info|museum|name))$/;
	var isValid = regEx.test(field.value);
	if (!isValid) {
	 	alert("Please enter a valid email address.");
	 field.select();
	 field.focus();
	 field.value = '';
	 return false;
	}
	else return true;
}
function capProper(field) {
	if (field.value.length == 0)
		return false;
	var tmpStr=field.value;
	var newStr='';
	var ltr;
	var count = 0;
	var cap=1;
	while (count < tmpStr.length) {
		ltr = tmpStr.substring(count,count+1);
		if (cap == 1) {
			newStr += ltr.toUpperCase();
		}
		else {
			newStr += ltr;
		}
		if (ltr == ' ') {
			cap=1;
		}
		else {
			cap=0;
		}
		count += 1;
	}
	if (newStr.length < 2) {
		alert("Please enter the field completely.");
		field.select();
		field.focus();
		return false;
	}
	else {
		field.value = newStr;
		return true;
	}
}
function checkPhone(field) {
	if (field.value.length == 0)
		return false;
	var checkStr = field.value;
	checkStr = checkStr.replace(/\D/g,'');
	if (checkStr.length < 10 ||
	 (checkStr.length > 11 && checkStr.indexOf('011') != 0) ||
	  (checkStr.length == 11 && checkStr.search(/^1/) != 0 ) ) {
		alert("Please enter a valid phone number including area code.\nInternational phone numbers must start with 011 and the country code.");
		field.select();
		field.focus();
		return false;
	}
	else {
		if (checkStr.length > 11) {
			field.value = checkStr.replace(/(.{3})(.{2})(.*)/,'$1-$2-$3');
		}
		else {
			field.value = checkStr.replace(/(1?)(.{3})(.{3})(.{4})/,'$2-$3-$4');
		}
		return true;
	}
}
function checkSSN(field) {
	if (field.value.length == 0)
		return false;
	var checkStr = field.value;
	checkStr = checkStr.replace(/\D/g,'');
	if (checkStr.length != 9 ) {
		alert("Please enter a valid ssn number.");
		field.select();
		field.focus();
		return false;
	}
	else {
		field.value = checkStr.replace(/(.{3})(.{2})(.{4})/,'$1-$2-$3');
		return true;
	}
}
function checkMoney(field) {
	field.value = field.value.replace(/[^0-9\.]/g,'');
	if (field.value == '') 
		field.value = 0;
}
function newsletterSubmit() {
	var f = document.getElementById('aForm');;
	msg ='';
	if (f.email.value == '') msg = msg + "Email is required\n";
	if (f.fname.value == '') msg = msg + "First Name is required\n";
	if (f.lname.value == '') msg = msg + "Last Name is required\n";
	if (msg != '') {
		alert(msg);
		return false;
	}
	var jsonRequest = new Request.JSON({url: "webJax.php", onSuccess: function(results, resultText){
		var r = results.bindings[0];
		if (r.success) {
			document.getElementById('aForm').style.display='none';
			document.getElementById('emailFormConf').innerHTML="<b>Newsletter Registration Submited</b><br /><p>Thank you.  Please check your email in the next few minutes to confirm your email address by clicking on the included link.</p><p>You may also want to make sure our emails are not put into your junk mail folder.</p>";
			document.getElementById('emailFormConf').style.display='block';
		}
	}}).post($('aForm'));
	return false;
}