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 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;
	}
}

function requireCheckBox (objCheckBox1, objCheckBox2, objFocus1, objFocus2, msg){ 
    
	if (objCheckBox1.disabled)
		return true;
	if (objCheckBox1.checked) return false;
	if (objCheckBox2.checked) return false;
	else
	{
		alert(msg);
		objCheckBox1.select();
		objCheckBox1.focus();
		objFocus1.color  = "#FF0000";
		objFocus2.color  = "#FF0000";
		return true;
	}
}

function clearStyle(textName){
	if (formCheck) {
		getObj(textName).color = "#000000"
	}
}

function checktab(maxf,f,f1) {
	bar = getFormObj('selectForm',f).value;
	if (bar.length >= maxf) {
		getFormObj('selectForm',f1).select();
		getFormObj('selectForm',f1).focus(); }
}

function moveFocus(focfld) {
	getFormObj('infoRequest',focfld).focus()
}

function setSourceCategory(source) {

	if (source == "OTHER") {
		if (document.layers){
			document.forms.infoRequest.SearchEngine.options[0].selected = 1 }
		else {
			document.forms.infoRequest.SearchEngine.options(0).selected = 1 }
	}
	if (source == "SEARCH ENGINE") {
		if (document.layers){
			document.forms.infoRequest.CanadianMagazine.options[0].selected = 1 }
		else {
			document.forms.infoRequest.CanadianMagazine.options(0).selected = 1 }
	}

	if (source != "US MAGAZINE") {
		document.forms.infoRequest.SourceCategory.value = source;
	}

}

function setCountry() {
	if (document.layers){
		for (var i=0; i < document.forms.infoRequest.Province.length; i++){
			if (document.forms.infoRequest.Province[i].selected) {
				delState = document.forms.infoRequest.Province[i].text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.Country[1].checked = false;
			document.forms.infoRequest.Country[0].checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.Country[0].checked = false;
			document.forms.infoRequest.Country[1].checked = true; }
	}
	else if (document.all){
		for (var i=0; i < infoRequest.Province.options.length; i++){
			if (infoRequest.Province.options(i).selected) {
				delState = document.forms.infoRequest.Province.options(i).text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.Country(1).checked = false;
			document.forms.infoRequest.Country(0).checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.Country(0).checked = false;
			document.forms.infoRequest.Country(1).checked = true; }
	}
}

function setShCountry() {
	if (document.layers){
		for (var i=0; i < document.forms.infoRequest.ShProvince.length; i++){
			if (document.forms.infoRequest.ShProvince[i].selected) {
				delState = document.forms.infoRequest.ShProvince[i].text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.ShCountry[1].checked = false;
			document.forms.infoRequest.ShCountry[0].checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.ShCountry[0].checked = false;
			document.forms.infoRequest.ShCountry[1].checked = true; }
	}
	else if (document.all){
		for (var i=0; i < infoRequest.ShProvince.options.length; i++){
			if (infoRequest.ShProvince.options(i).selected) {
				delState = document.forms.infoRequest.ShProvince.options(i).text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.ShCountry(1).checked = false;
			document.forms.infoRequest.ShCountry(0).checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.ShCountry(0).checked = false;
			document.forms.infoRequest.ShCountry(1).checked = true; }
	}
}

function setCCCountry() {
	document.forms.infoRequest.CCSameAsContact.checked = false;
	if (document.layers){
		for (var i=0; i < document.forms.infoRequest.CCProvince.length; i++){
			if (document.forms.infoRequest.CCProvince[i].selected) {
				delState = document.forms.infoRequest.CCProvince[i].text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.CCCountry[1].checked = false;
			document.forms.infoRequest.CCCountry[0].checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.CCCountry[0].checked = false;
			document.forms.infoRequest.CCCountry[1].checked = true; }
	}
	else if (document.all){
		for (var i=0; i < infoRequest.CCProvince.options.length; i++){
			if (infoRequest.CCProvince.options(i).selected) {
				delState = document.forms.infoRequest.CCProvince.options(i).text }
		}
		delStateAbbr = delState.substr(0,2)
		if ((delStateAbbr == "CT") || (delStateAbbr == "DE") || (delStateAbbr == "MI") || (delStateAbbr == "NJ") ||
			(delStateAbbr == "AL") || (delStateAbbr == "AR") || (delStateAbbr == "DC") || (delStateAbbr == "IL") ||
			(delStateAbbr == "IN") || (delStateAbbr == "IA") || (delStateAbbr == "KS") || (delStateAbbr == "KY") ||
			(delStateAbbr == "MD") || (delStateAbbr == "OH") || (delStateAbbr == "PA") || (delStateAbbr == "RI") ||
			(delStateAbbr == "SC") || (delStateAbbr == "TN") || (delStateAbbr == "WV") || (delStateAbbr == "WI") ||
			(delStateAbbr == "NY") || (delStateAbbr == "AK") || (delStateAbbr == "HI") ||
			(delStateAbbr == "AZ") || (delStateAbbr == "FL") || (delStateAbbr == "GA") || (delStateAbbr == "ME") ||
			(delStateAbbr == "MA") || (delStateAbbr == "MI") || (delStateAbbr == "MN") || (delStateAbbr == "MO") ||
			(delStateAbbr == "NE") || (delStateAbbr == "NH") || (delStateAbbr == "NM") || (delStateAbbr == "ND") ||
			(delStateAbbr == "OK") || (delStateAbbr == "SD") || (delStateAbbr == "TX") || (delStateAbbr == "UT") ||
			(delStateAbbr == "VT") || (delStateAbbr == "VA") ||
			(delStateAbbr == "CO") || (delStateAbbr == "LA") || (delStateAbbr == "MS") || (delStateAbbr == "MT") ||
			(delStateAbbr == "NV") || (delStateAbbr == "WY") ||
			(delStateAbbr == "CA") || (delStateAbbr == "ID") || (delStateAbbr == "OR") || (delStateAbbr == "WA")) {
			document.forms.infoRequest.CCCountry(1).checked = false;
			document.forms.infoRequest.CCCountry(0).checked = true; }
		if ((delStateAbbr == "AB") || (delStateAbbr == "BC") || (delStateAbbr == "MB") || (delStateAbbr == "NB") ||
			(delStateAbbr == "NF") || (delStateAbbr == "NS") || (delStateAbbr == "NT") || (delStateAbbr == "ON") ||
			(delStateAbbr == "PE") || (delStateAbbr == "QC") || (delStateAbbr == "SK") || (delStateAbbr == "YT")) {
			document.forms.infoRequest.CCCountry(0).checked = false;
			document.forms.infoRequest.CCCountry(1).checked = true; }
	}
}