// preload and mouseover functions
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

// div swap script functions
var layerVisible = 0;
	
function showLayerNumber(number){
	var layerToShow = number;
	hideLayer(eval('"side'+layerVisible+'"'));
	showLayer(eval('"side'+layerToShow+'"'));
	layerVisible = layerToShow;
}
function showLayer(layerName){
	if (navigator.appName == "Netscape"){
		layerRef = "document.layers";
		styleSwitch = "";
	} else {
		layerRef = "document.all";
		styleSwitch = ".style";
	}
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
function hideLayer(layerName){
	if (navigator.appName == "Netscape"){
		layerRef = "document.layers";
		styleSwitch = "";
	} else {
		layerRef = "document.all";
		styleSwitch = ".style";
	}
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}

// url jump script
function goURL() {
	var url = document.urlSelect.urlList.options[document.urlSelect.urlList.selectedIndex].value;
	if (url != "none") { location = url; }
}

// popup window script
function openWindow (earl,name,chrome) {
	popupWin = window.open (earl, name, chrome);
	popupWin.opener.top.name = "opener";
	popupWin.focus();
}

/************************************************
	functions used with forms
************************************************/

// change the background color of a form control when the control 
// gains and losses focus
function gotFocus(ctrl) {
	ctrl.style.background="#ffffcc";
}
function lostFocus(ctrl) {
	ctrl.style.background="#ffffff";
}

// validates search form submission
function validSearch(form) {
	if (form.Criteria.value.length == 0) {
		alert("Please enter your search term(s) before continuing.");
		form.Criteria.focus();
		return false;
	}
}

function showError(ctrl, msg) {
	ctrl.focus();
	alert(msg);
}
