var isNetscape = (navigator.appName == "Netscape");

var bVer=parseInt(navigator.appVersion);
var NS4 = (document.layers) ? true : false;
var IE4 = ((document.all) && (bVer>=4)) ? true : false;
var NS6 = ((isNetscape==true) && (bVer>=5)) ? true : false;

var collectObj = (IE4) ? "all." : "";
var styleObj = (IE4)||(NS6) ? ".style" : "";

function getObj( objName )
{
	if (NS6) { var theObj = document.getElementById(objName).style;}
	else { var theObj = eval( "document." + collectObj + objName + styleObj )}

	return theObj;
}

function getFormObj( formName,objName )
{
	if (NS6) { var theObj = document.getElementById(objName);}
	else {
		if (NS4)
			{ var theObj = eval( "document.forms." + formName + "." + objName)}
		else
			{ var theObj = eval( "document." + formName + "." + objName)}
	}

	return theObj;
}

// common JavaScript to check required fields.

// BOI, followed by one or more whitespace characters, followed by EOI.
var reWhitespace = /^\s+$/

// Check whether string s is empty.
function isEmpty(s){   
	return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace (s){   // Is s empty?

    return (isEmpty(s) || reWhitespace.test(s));
}

function requireEntry (objTxtBox, msg){ 
    
	if (objTxtBox.disabled)
		return true;
	if ( isWhitespace(objTxtBox.value) )
	{
		alert(msg);
		objTxtBox.select();
		objTxtBox.focus();
		return true;
	}
	return false;
}

function requireSelection (objList, blankValue, msg){  
	if (objList.disabled)
		return true;
	
	if ( objList.options[objList.selectedIndex].value==blankValue )
	{
		alert(msg);
		objList.focus();
		return true;
	}
	return false;
}

function requireOneOfSelection (objList1,objList2, blankValue, msg){  
	if ((objList1.disabled) && (objList2.disabled))
		return true;
	
	if (( objList1.options[objList1.selectedIndex].value==blankValue ) && ( objList2.options[objList2.selectedIndex].value==blankValue ))
	{
		alert(msg);
		objList1.focus();
		return true;
	}
	return false;
}


function moveFocus(focfld) {
	getFormObj('selectForm',focfld).focus()
}

function requireOption (FormName, RadioGroup, objText, objFocus, alertMsg){
	var objGroup = eval("document." + FormName + "." + RadioGroup)
	radioOption = -1;
	for (counter=0; counter < objGroup.length; counter++) {
		if (objGroup[counter].checked) radioOption = counter;
	}
	if (radioOption == -1) {
		alert(alertMsg);
		objFocus.select();
		objFocus.focus();
		objText.color  = "#FF0000";
		return true;
	} 
	else {
		return false;
	}
}