if (navigator.platform.indexOf("Win")!=-1){
isWin=1;
} else { if (navigator.platform.indexOf("Mac")!=-1){
isMac=1;
}}



function checkForm(the_form) {
	var throwit;
	throwit=0;
	var throwit2;
	throwit2=0;
	var msg;
	msg=0;
	var msg2;
	msg2=0;
	if (the_form.firstname.value.length<2){
		the_form.firstname.style.background="orange";
		throwit=1;
	}
	
	if (the_form.lastname.value.length<2){
		the_form.lastname.style.background="orange";
		throwit=1;
	}
	
	if ((the_form.email.value.length<3) || (the_form.email.value.indexOf('@')==-1) || (the_form.email.value.indexOf('.')==-1)){
		the_form.email.style.background="orange";
		throwit=1;
	}
	
	var part1="WIN";
	var part2="NER";
	if (the_form.captcha.value != part1+part2){
		the_form.captcha.style.background="orange";
		throwit2=1;
	}
	
		if (throwit2) {
		    msg="Please enter the correct word from the image in the Verification section. Note that this is case-sensitive.\n\n";
			if (!throwit){
				alert(msg);
				return false;
			}
		}
	
		if (throwit) {
			msg2="Please fill out all required (*) fields.\n\nBe sure you entered a valid email address.\n";
			if (msg){
			alert(msg+msg2);
		} else { alert(msg2);}
			return false;
		} else {
			return true;
		}
}




 function noYellow(this_field) {
		this_field.style.background="white";
}
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}

function getIntegerString(strIn) {
	return strIn.replace(/[0-9,<,>,?,#,*,(,),$]/g, "");
}

function checkField(hField) {
	hField.value = getIntegerString(hField.value);
}

function getIntegerStringEmail(strIn) {
	return strIn.replace(/[<,>,!,(,)]/g, "");
}

function getIntegerStringNotes(strIn) {
	return strIn.replace(/[<>]/g, "");
}

function getIntegerStringPhone(strIn) {
	return strIn.replace(/[^0-9]/g, "");
}

function checkFieldEmail(hField) {
	hField.value = getIntegerStringEmail(hField.value);
}

function checkFieldNotes(hField) {
	hField.value = getIntegerStringNotes(hField.value);
}

function checkPhone(hField) {
	hField.value = getIntegerStringPhone(hField.value);
}