﻿// JavaScript Document

function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}

// function clear on focus
function clear_on_focus(e,o){
	if(o.firstTime){return}
	o.firstTime=true
	o.value=""
}

//Function to check form fields

function checkrequired(which) {
	var pass=true;

	if (document.images) {
		for (i=0;i<which.length;i++) {
			var tempobj=which.elements[i];
			if (document.tempobj.name.substring(0,8)=="required") {
				if (((document.tempobj.type=="text"||document.tempobj.type=="textarea")&&
				document.tempobj.value=='')||(document.tempobj.type.toString().charAt(0)=="s"&&
				document.tempobj.selectedIndex==0)) {
					pass=false;
					break;
				}
			}
		}
	}
	if (!pass) {
		shortFieldName=document.tempobj.name.substring(8,30).toUpperCase();
		alert("Please make sure the "+shortFieldName+" field was properly completed.");
		return false;
	}
	else
	return true;
}