
<!--
	function LTrim(strValue) 
	{
		do{
			if(strValue.substring(0, 1) == ' ')
			{
				strValue = strValue.substring(1, strValue.length);
			}
			else
			{
				return strValue;
			}
		}
		while(strValue.length > 0)
	}
	
	function RTrim(strValue) 
	{
		do{
			if(strValue.substring(strValue.length - 1, strValue.length) == ' ')
			{
				strValue = strValue.substring(0, strValue.length - 1);
			}
			else
			{
				return strValue;
			}
		}
		while(strValue.length > 0)
	}

	function Trim(strValue) 
	{
	 	return LTrim(RTrim(strValue));
	}
	
	function CheckMandatory(oForm)
	{
		var oElement;
		var strError = '';
		
		//check each object to see if it is Mandatory
		for(i=0; i<oForm.elements.length; i++)
		{
			oElement = oForm.elements[i];
			
			if(oElement.Mandatory && (oElement.value + '') == '')
			{
				strError = strError + '\n - Please supply a value for `'+oForm.elements[i].Header+'`';
			}
		}
		
		return strError;
	}
	
	function CheckNumeric(oForm)
	{
		var oElement;
		var strError = '';
		
		//check each object to see if it is Mandatory
		for(i=0; i<oForm.elements.length; i++)
		{
			oElement = oForm.elements[i];
			
			if(oElement.Numeric && (oElement.value + '') != '')
			{
				if(isNaN(oElement.value))
				{
					strError = strError + '\n - Please supply a numeric value for `'+oForm.elements[i].Header+'`';
				}
			}
		}
		
		return strError;
	}
	
	function CheckEmail(oForm)
	{
		var oElement;
		var strError = '';
		var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		
		//check each object to see if it is Mandatory
		for(i=0; i<oForm.elements.length; i++)
		{
			oElement = oForm.elements[i];
			
			if(oElement.Email && (oElement.value + '') != '')
			{	
				if(filter.test(oElement.value))
				{
				}
				else
				{
					strError = strError + '\n - Please supply a valid email address in `'+oForm.elements[i].Header+'`';
				}
			}
		}
		
		return strError;
	}
	
	function TransDate_Change()
	{
		var oTransDate = document.f1.TransDate;
		location.href = "Statements.asp?Menuselected=2&StatementDate=" + oTransDate[oTransDate.selectedIndex].text + "&DateIndex="+ oTransDate[oTransDate.selectedIndex].value;
	}

function ValidateLogin()
{

	var strError = '';
	var oEmailAddress = document.f1.EmailAddress;
	var oPassword = document.f1.LoginPassword;

	//check for errors
	if((Trim(oEmailAddress.value) + '') == '')
	{
		strError = strError + '\n - Please fill in `'+oEmailAddress.Header+'`';
	}
	if((Trim(oPassword.value) + '') == '')
	{
		strError = strError + '\n - Please fill in `'+oPassword.Header+'`';
	}
		
	//if there was an error then display it else go to the next page
	if(strError.length == 0)
	{
		document.f1.submit();
	}
	else
	{
		alert('Please correct the following errors:'+strError);
	}
}

//function to check where there is an email address before trying to 
//send the password to a non existant email address
function GetEmail() {
	var strError = '';
	var oEmailAddress = document.f1.EmailAddress;
	var oForgotPassword = document.all.ForgotPassword;
	
	if (Trim(oEmailAddress.value) == '') {
		strError = strError + '\n - Please fill in `'+oEmailAddress.Header+'`';
	}

	//if there was an error then display it else go to the next page
	if (strError.length == 0) {
		oForgotPassword.href = oForgotPassword.href + oEmailAddress.value;
		return true;
	} else {
		alert('Please correct the following errors:'+strError);
		return false;
	}

}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//Validate Date Functions
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
    var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
    var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

 

function daysInFebruary (year){
    // February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}

function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
				if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
				return false
	}
	if (strMonth.length<1 || month<1 || month>12){
				return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
				return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
				return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
				return false
	}
	return true
}

function UpdateDOBField(oField) {
	oField.value = document.getElementById('DOB_Day').value + '/' + document.getElementById('DOB_Month').value + '/' + document.getElementById('DOB_Year').value;
}

	function Validate() {
		ErrMsg = '';

		if (document.getElementById('ContactName').value == '')
		{
				ErrMsg += 'Please enter your name.\n';
		}
		
		if (document.getElementById('ContactName').value == 'your name')
		{
				ErrMsg += 'Please enter your name.\n';
		}
		
		if (document.getElementById("EmailAddress").value == '') {
			ErrMsg += 'Please supply a value for "Email Address".\n';
		} else if ( ( (document.getElementById("EmailAddress").value).indexOf('.') == -1 ) || ( (document.getElementById("EmailAddress").value).indexOf('@') == -1 ) ) {
			ErrMsg += 'Please supply a valid value for "Email Address".\n';
		}

		if (ErrMsg != '') {
			alert(ErrMsg);
			return false;
		}
	}
//-->