

		
function ConditionalString(Html,WriteType) {

	var Result             = "";
	var IsNavFour          = IsNavigatorFour();



	if ((IsNavFour==true) && (WriteType=="NN4")) {
		Result = Html;
	} else {
		if ((IsNavFour==false) && (WriteType!="NN4")) {
			Result = Html;
		}
	}

	return Result;


}

function IsNavigatorFour() {
	
	var Result = false;
	if (parseInt(navigator.appVersion.charAt(0)) < 5) {
	   if (navigator.appVersion.indexOf("MSIE") < 0) {
		Result=true;
	   }
	}
	
	return Result;
	
}


function VerifyDelete(FormName) {

	if (confirm('Are you sure you want to DELETE this record?')) {
		document.forms[FormName].action = document.forms[FormName].action + '&del=1';
		document.forms[FormName].submit();
    } else {
		return 0;
    }

}


function ValidateForm(FormName) {

	var ErrorMessage = '';
	var ErrorFlag = false;

	
	
	var ManFld = eval('document.' + FormName + '.MANDATORYFIELDS.value') ;
	
	
	
	if (ManFld != '') {
		var arrManFld = ManFld.split(",");
		var ItemCount = arrManFld.length
	
		for (var i = 0; i < ItemCount; i++) {
			var Test = eval('document' + '.' + FormName + '.' + arrManFld[i] + '.value') ;
			if (Test=="") {
				ErrorMessage = ErrorMessage + '\n' + arrManFld[i] + ' is a mandatory field';
				ErrorFlag = true;
			}
			
		}
	}
	
		
	if (ErrorFlag == true) {
		ErrorMessage = 'Your information contains the following errors:' +  ErrorMessage;
		alert(ErrorMessage);
		return 0;
	} else {
		document.forms[FormName].action = document.forms[FormName].action + '&val=1'
		document.forms[FormName].submit();
	}
}

function ValidateFormSaveAs(FormName) {

	var ErrorMessage = '';
	var ErrorFlag = false;

	
	
	var ManFld = eval('document.' + FormName + '.MANDATORYFIELDS.value') ;
	
	
	
	if (ManFld != '') {
		var arrManFld = ManFld.split(",");
		var ItemCount = arrManFld.length
	
		for (var i = 0; i < ItemCount; i++) {
			var Test = eval('document' + '.' + FormName + '.' + arrManFld[i] + '.value') ;
			if (Test=="") {
				ErrorMessage = ErrorMessage + '\n' + arrManFld[i] + ' is a mandatory field';
				ErrorFlag = true;
			}
			
		}
	}
	
		
	if (ErrorFlag == true) {
		ErrorMessage = 'Your information contains the following errors:' +  ErrorMessage;
		alert(ErrorMessage);
		return 0;
	} else {
		document.forms[FormName].action = document.forms[FormName].action + '&val=1&SaveAs=1'
		document.forms[FormName].submit();
	}
}

function ValidateFormPW(FormName,PasswordFieldName) {

// CWB 11/14/08, variation on ValidateForm() to also include comparison of two password fields

	var ErrorMessage = '';
	var ErrorFlag = false;

	
	
	var ManFld = eval('document.' + FormName + '.MANDATORYFIELDS.value') ;
	
	
	
	if (ManFld != '') {
		var arrManFld = ManFld.split(",");
		var ItemCount = arrManFld.length
	
		for (var i = 0; i < ItemCount; i++) {
			var Test = eval('document' + '.' + FormName + '.' + arrManFld[i] + '.value') ;
			if (Test=="") {
				ErrorMessage = ErrorMessage + '\n' + arrManFld[i] + ' is a mandatory field';
				ErrorFlag = true;
			}
			
		}
	}
	
	if (ErrorFlag != true) {
		var Test = eval('document' + '.' + FormName + '.' + PasswordFieldName + '.value') ;
		if (Test != "") {
			var Test2 = eval('document' + '.' + FormName + '.' + PasswordFieldName + '2' + '.value') ;
			if (Test == Test2) {
			// Ok password verified
			} else {
				ErrorMessage = '\nPasswords entered do not match';
				ErrorFlag = true;
			}
		}
	}
				
	if (ErrorFlag == true) {
		ErrorMessage = 'Your information contains the following errors:' +  ErrorMessage;
		alert(ErrorMessage);
		return 0;
	} else {
		document.forms[FormName].action = document.forms[FormName].action + '&val=1'
		document.forms[FormName].submit();
	}
}

function SwapImage(TargetName,ArrayName,Index) {
	var Img = eval(ArrayName + '[' + Index + '].src'); 
	document.images[TargetName].src = Img;
}

function ComboOnChangeGo(FormName,ControlName) {

	
	// Following doesnt work under Netscape, with Form being a form object, changed to FormName as literal
	//var Selected = Form[ControlName].selectedIndex;
	//var strResult = Form[ControlName].options.value;
	
	var control = eval('document.forms.' + FormName + '.' + ControlName);
	var strResult = control[control.selectedIndex].value;
	
	

	
	
	if (strResult != '') {
		location.href = strResult;
	} else {
		return false;
	}
}

function ComboOnChangeShowDiv(Form,ControlName) {

	
	var ThisDiv = eval('document.' + Form + '.' + ControlName + '.options.value');
	
	
	if (ThisDiv != '') {
		
		ShowDiv(ThisDiv);
	}
}

function HideDiv(DivId) {
	 var ThisDiv = eval(DivId)
	 ThisDiv.style.visibility = 'hidden';
	 ThisDiv.style.display = 'none';
}

function ShowDiv(DivId) {
	var ThisDiv = eval(DivId)
	ThisDiv.style.visibility = 'visible';
	ThisDiv.style.display = 'block';
}

function ShowHideObject(ObjectId,blnComplement) {



	var ThisObject = eval(ObjectId);
	if (blnComplement == true) {
		var ThisObjectComplement = eval(ObjectId+'_WhenHidden');
	}
	if (ThisObject.style.visibility == 'hidden') {
		ThisObject.style.visibility = 'visible';
		ThisObject.style.display = 'block';
		if (blnComplement == true) {
			ThisObjectComplement.style.visibility = 'hidden';
			ThisObjectComplement.style.display = 'none';
		}
	} else {
		ThisObject.style.visibility = 'hidden';
		ThisObject.style.display = 'none';
		if (blnComplement == true) {
			ThisObjectComplement.style.visibility = 'visible';
			ThisObjectComplement.style.display = 'block';
		}
	}
}
		
function HideObject(ObjectId) {

	 var ThisObject = eval(ObjectId);
	 ThisObject.style.visibility = 'hidden';
	 ThisObject.style.display = 'none';
}

function ShowObject(ObjectId) {

	 var ThisObject = eval(ObjectId);
	 ThisObject.style.visibility = 'visible';
	 ThisObject.style.display = 'block';
}

function GoUrl(Url) {

	location.href = Url;
}
