// code for mouse rollovers
if (document.images)  version = "n4";  
else if (navigator.userAgent.indexOf("Mozilla/2.0") != -1) version = "n3";
else version = "n2";

function on_img(imgName) {
	if (version == "n4") {
		img = eval(imgName + "_on.src");
		document[imgName].src = img;
	}
}

function off_img(imgName) {
	if (version == "n4") {
		img = eval(imgName + "_off.src");
		document[imgName].src = img;
	}
}

function message(text) {
	window.status = text;
	return true;
}

/*
timerID = null
function on_img(imagename) {
		if (document.images && loaded == 1) {
				if (timerID) { 
						clearTimeout(timerID);
				}
		if (document.images) {
				document.images[imagename].src = eval(imagename + '_on.src');
		}
	}
}

function off_img(imagename) {
		if (document.images && loaded == 1) {
		if (document.images) {
		document.images[imagename].src = eval(imagename + '_off.src');
		}
	}
}
*/	

var errfound = false;

function ValidLength(item, len) {
	return (item.length >= len);
}

function ValidEmail(item) {
	if (!ValidLength(item, 5)) return false;
	if (item.indexOf ('@', 0) == -1) return false;
	return true;
}

function error(elem, text) {
	if (errfound) return;
		window.alert(text);
		elem.select();
		elem.focus();
		errfound = true;
}

function Validate() {
	errfound = false;
	if (!ValidLength(document.contactform.Company.value,2))
		error(document.contactform.Company,"Please enter your company's name");
	if (!ValidLength(document.contactform.NameFirst.value,2))
		error(document.contactform.NameFirst,"Please enter your full name");
	if (!ValidLength(document.contactform.NameLast.value,2))
		error(document.contactform.NameLast,"Please enter your full name");
	if (!ValidEmail(document.contactform.Email.value,1))
		error(document.contactform.Email, "Please enter a valid email address");
	if (!ValidLength(document.contactform.Phone.value,7))
		error(document.contactform.Phone, "Please enter your phone number - (999) 999-9999");
	
	return !errfound; /* true if there are no errors */
}
