// 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;
	}
}

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 */
}

var winOpts = "toolbar=0,location=0,directories=0,status=1,menubar=1,links=0,scrollbars=1,resizable=1,height=600,width=880,copyhistory=0,"
var smallwindow = null;
function setEvent() {
	return false;
}
function historywin(filename) {
	fileURL = filename;
	if (parseInt(navigator.appVersion) < 4) {
		if (smallwindow != null) smallwindow.close();
	}  
	timerID= setTimeout('opener(fileURL)',100);
}
function windowFocus() {
	if (navigator.appVersion.indexOf("2.") == -1 && navigator.appVersion.indexOf("MSIE") == -1)
		smallwindow.focus();
}
function openit(winName) {
	filename = winName;
	winName = "remotewin"
	smallwindow = window.open(filename,winName,winOpts)
	if (navigator.appVersion.indexOf("(X11") != -1  || navigator.appVersion.indexOf("(Mac") != -1)
		smallwindow = window.open(filename,winName,winOpts)
	if (navigator.appVersion.indexOf("MSIE") == -1)
		smallwindow.mainWin = this;
	windowFocus();
}

function changeDisplay(theChecked,theWhat) {
	var theNode;
	var theDisplay;
	/* alert("in changeDisplay. theWhat=" + theWhat + " theChecked = " + theChecked);  */
	if (theChecked == true)
		theDisplay = "";
	else
		theDisplay = "none";
	for (var i=1; ; i++) {
		/* Check if the getElementById method is available */
		if (document.getElementById) {
			theNode = document.getElementById(theWhat + i);
			/* alert(theNode); */
			if (theNode == null) {
				return;
			}
		} else if (document.all) {
			/* The alert lets me verify that I tested the path. */
			alert("Running an older version of IE." + " May not be able to hide rows");
			theNode = document.all[theWhat+i];
			if (theNode == null){
				return;
			}
		} else {
			alert("Cannot change visibility of the display element." + " Was " + theWhat);
			return;
		}
		theNode.style.display = theDisplay;
	}
}
