//function to automatically find the first field on a form and focus on it...
function formFocus() {
	//default to selecting the first form on the page
  if(document.forms[0]) {
	if(document.forms[0] && document.forms[0].name != 'confirmation'){
		for(var i=0; i < document.forms[0].elements.length; i++) {
			currentElement = document.forms[0].elements[i];
			//alert(currentElement.type);
			if(currentElement.disabled == false &&  currentElement.type != "textarea" && (currentElement.type == "select-one" || currentElement.type == "submit" || (currentElement.readOnly == false && currentElement.type == "text"))) {
				currentElement.focus();
				//alert(currentElement.name);
				break;
			}
		}
	}
	else if(document.forms[0].name == 'confirmation'){
		document.forms[0].guests.focus();
	}
  }// End cheking for the a form
}
// Function to check caps lock is not on when people log on.
// To call add onKeyPress="checkCapsLock(event)" to any password form field.
function checkCapsLock( e ) {
	var myKeyCode=0;
	var myShiftKey=false;
	var myMsg='Caps Lock is On.\n\nTo prevent entering your password incorrectly,\nyou should press Caps Lock to turn it off.';

	// Internet Explorer 4+
	if ( document.all ) {
		myKeyCode=e.keyCode;
		myShiftKey=e.shiftKey;

	// Netscape 4
	} else if ( document.layers ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	// Netscape 6
	} else if ( document.getElementById ) {
		myKeyCode=e.which;
		myShiftKey=( myKeyCode == 16 ) ? true : false;

	}

	// Upper case letters are seen without depressing the Shift key, therefore Caps Lock is on
	if ( ( myKeyCode >= 65 && myKeyCode <= 90 ) && !myShiftKey ) {
		alert( myMsg );

	// Lower case letters are seen while depressing the Shift key, therefore Caps Lock is on
	} else if ( ( myKeyCode >= 97 && myKeyCode <= 122 ) && myShiftKey ) {
		alert( myMsg );

	}
}
/* Nav History Functions */
//Show the Nav History!
function showHistory()
{
	document.all["historyDropDown"].style.visibility="visible";
	//hide all select boxes so they don't overlap the menu...
	var ids = Array();
	ids = document.getElementsByTagName("select");
	for (j=0; j<ids.length; ++j) {
	  ids[j].style.visibility = "hidden";
	}
}

//Hide the Nav History!
function hideHistory()
{
	document.all["historyDropDown"].style.visibility="hidden"
	//show all select boxes again...
	var ids = Array();
	ids = document.getElementsByTagName("select");
	for (j=0; j<ids.length; ++j) {
	  ids[j].style.visibility = "visible";
	}
}
/* End Nav History Functions */

/* Menu Functions */
//Show the popup menu!!!
function showmenu(elmnt)
{
	document.all(elmnt).style.visibility="visible";
	//hide all select boxes so they don't overlap the menu...
	var ids = Array();
	ids = document.getElementsByTagName("select");
	for (j=0; j<ids.length; ++j) {
	  ids[j].style.visibility = "hidden";
	}
	//remove focus from any input box
	this.focus();
}

//Hide the popup menu!!!
function hidemenu(elmnt)
{
	document.all(elmnt).style.visibility="hidden"
	//show all select boxes again...
	var ids = Array();
	ids = document.getElementsByTagName("select");
	for (j=0; j<ids.length; ++j) {
	  ids[j].style.visibility = "visible";
	}
}
/* End Menu Functions */
