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 setAllCountry(f) {
		d = getFormObj('infoRequest',f + 'Province').options[getFormObj('infoRequest',f + 'Province').selectedIndex].value;
		if ((d == "CT") || (d == "DE") || (d == "NC") || (d == "NJ") ||
			(d == "AL") || (d == "AR") || (d == "DC") || (d == "IL") ||
			(d == "IN") || (d == "IA") || (d == "KS") || (d == "KY") ||
			(d == "MD") || (d == "OH") || (d == "PA") || (d == "RI") ||
			(d == "SC") || (d == "TN") || (d == "WV") || (d == "WI") ||
			(d == "NY") || (d == "AK") || (d == "HI") ||
			(d == "AZ") || (d == "FL") || (d == "GA") || (d == "ME") ||
			(d == "MA") || (d == "MI") || (d == "MN") || (d == "MO") ||
			(d == "NE") || (d == "NH") || (d == "NM") || (d == "ND") ||
			(d == "OK") || (d == "SD") || (d == "TX") || (d == "UT") ||
			(d == "VT") || (d == "VA") ||
			(d == "CO") || (d == "LA") || (d == "MS") || (d == "MT") ||
			(d == "NV") || (d == "WY") ||
			(d == "CA") || (d == "ID") || (d == "OR") || (d == "WA")) {
				if (NS4) {
					document.forms.infoRequest.Country[1].checked = false;
					document.forms.infoRequest.Country[0].checked = true;}
				else	{
					getFormObj('infoRequest',f + 'Country2').checked = false;
					getFormObj('infoRequest',f + 'Country1').checked = true;}
			}
		if ((d == "AB") || (d == "BC") || (d == "MB") || (d == "NB") ||
			(d == "NF") || (d == "NS") || (d == "NT") || (d == "ON") ||
			(d == "PE") || (d == "QC") || (d == "SK") || (d == "YT")) {
				if (NS4) {
					document.forms.infoRequest.Country[1].checked = true;
					document.forms.infoRequest.Country[0].checked = false;}
				else	{
					getFormObj('infoRequest',f + 'Country2').checked = true;
					getFormObj('infoRequest',f + 'Country1').checked = false;}
			}
}

function setSourceCategory(source) {
	if (source == "OTHER") {
		getFormObj('infoRequest','SearchEngine').options[0].selected = 1
	}
	if (source == "SEARCH ENGINE") {
		getFormObj('infoRequest','Other').options[0].selected = 1 
	}
}