/******************************************************************************
 Data Entry validation routines
	
 $Workfile: $    $Revision:  $

 Overview: 	This file contains code for client side data type validation 
 
 			First in the file are functions names isXXX() the have no user interface
			but simply retrun true or false to indicate validity. 
			You pass in a string only. These functions are intended to be called
			from the ValidXXX() functions (see below).
			
			Later in the file are functions named ValidXXX() that will inform the user
			with popup message box if data is in valid, and will set teh focus 
			to the offeding input field. They also return true or false.
			You pass in a reference to a form input, value required flag, and 
			displayable name for the field.
 
 Written by Charles Karow April 2000
 Copyright 1999 by EventRebels.com, LLC All rights reserved

 Last changed: $Modtime: $ ($Date:  $ by $Author:  $)

Example usage:

1. Add this include to the <HEAD> section of your page: 	
<script LANGUAGE="JavaScript1.2" SRC="Validation.js"></script>

2. Create a function for form input validation. Include one call to a ValidXXX()
function for each input to be validated.

<script LANGUAGE="JavaScript1.2" SRC="Validation.js">
function ValidInput(frm)
{
	if (!ValidCurrency(txtPayment, true, "Amount of Payment")) {return false;}
	if (!ValidDate(txtDate, true, "Date of Payment")) {return false;}	
}
</script>

3. Call your validation function from the form's onSubmit event handler.
<FORM action="MyPage.asp" method="post" onSubmit="return ValidInput(this)">
... inputs ...
</FORM>

******************************************************************************/

// general purpose function to see if a suspected numeric input
// is a positive integer
function isPosInteger(inputVal) 
{
    inputStr = inputVal.toString()
    for (var i = 0; i < inputStr.length; i++) 
        {
        var oneChar = inputStr.charAt(i)
        if (oneChar < "0" || oneChar > "9") 
            {
            return false
            }
        }
    return true
}

// general purpose function to see if a suspected numeric input
// is a positive or negative integer
function isInteger(inputVal) 
{
    inputStr = inputVal.toString()
    for (var i = 0; i < inputStr.length; i++) 
        {
        var oneChar = inputStr.charAt(i)
        if (i == 0 && oneChar == "-") 
            {
            continue
            }
        if (oneChar < "0" || oneChar > "9") 
            {
            return false
            }
        }
    return true
}

// general purpose function to see if a suspected numeric input
// is a positive or negative number
function isNumber(inputVal) 
{
    oneDecimal = false
    inputStr = inputVal.toString()
    for (var i = 0; i < inputStr.length; i++) 
        {
        var oneChar = inputStr.charAt(i)
            if (i == 0 && oneChar == "-") 
            {
            continue
            }
        if (oneChar == "." && !oneDecimal) 
            {
            oneDecimal = true
            continue
            }
        if (oneChar < "0" || oneChar > "9") 
            {
            return false
            }
        }
        
    return true
}

// another general purpose function to see if a suspected numeric input
// is a positive or negative number
function isNumber2(inputValue) 
{
    if (isNaN(parseFloat(inputValue))) 
        {
        alert("The value you entered is not a number.")
        return false
        }
    return true
}

// general purpose function to see if a suspected numeric input
// is a positive number
function isPosNumber(inputVal) 
{
    oneDecimal = false
    inputStr = inputVal.toString()
    for (var i = 0; i < inputStr.length; i++) 
        {
        var oneChar = inputStr.charAt(i)
            
        if (oneChar == "." && !oneDecimal) 
            {
            oneDecimal = true
            continue
            }
        if (oneChar < "0" || oneChar > "9") 
            {
            return false
            }
        }
        
    return true
}

// function to see if input is valid US Social Security Number
function isSSN(strInput)
{
    // SSN should be nnn-nn-nnnn
    
    // Be sure there are two dashes
    var dash1 = strInput.indexOf("-")
    var dash2 = strInput.lastIndexOf("-")
    if (dash1 == -1 || dash1 == dash2)
        {return false}
        
    // Extract the tree paqrts of the SSN
    if (dash1 == 3 && dash2 == 6)
        {
        var SSN1 = parseInt(strInput.substring(0, dash1), 10)
        var SSN2 = parseInt(strInput.substring(dash1+2, dash2), 10)
        var SSN3 = parseInt(strInput.substring(dash2+2, strInput.length), 10)
        if (isNaN(SSN1) || isNaN(SSN2) || isNaN(SSN3)) 
            {
            // there is a non-numeric character in one of the component values
            alert("NaN: The SSN entry is not in an acceptable format.\n\nYou should enter SSN as nnn-nn-nnnn.")
            return false
            }

        }
    else
        {
            // there are no dashes or they are in the wrong places
            alert("Bad Dash: The SSN entry is not in an acceptable format.\n\nYou should enter SSN as nnn-nn-nnnn.")
            return false
         }
    return true;
}

// Replaces the first occurrance of chFind with chReplacement in strInput
// and returns the result.
//
// Used in isDate() and isPhone()
function replaceString(strInput, chFind, chReplacement)
{
    var i = strInput.indexOf(chFind)
    var str = strInput.substring(0, i) + chReplacement + strInput.substring(i + 1, strInput.length)
    
    return str;
}

// date field validation 
function isDate(inputValue) 
{
    var inputStr = inputValue.toString()
  
    // convert hyphen delimiters to slashes
    while (inputStr.indexOf("-") != -1) 
        {
        inputStr = replaceString(inputStr,"-","/")
        }
    // Find the delimiters, if any    
    var delim1 = inputStr.indexOf("/")
    var delim2 = inputStr.lastIndexOf("/")
    if (delim1 != -1 && delim1 == delim2) 
        {
        // there is only one delimiter in the string
       // alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
    
    if (delim1 != -1) 
        {
        // there are delimiters; extract component values
        var mm = parseInt(inputStr.substring(0,delim1), 10)
        var dd = parseInt(inputStr.substring(delim1 + 1, delim2), 10)
        var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length), 10)
        }
    else 
        {
        // there are no delimiters; extract component values
        //var mm = parseInt(inputStr.substring(0, 2), 10)
        //var dd = parseInt(inputStr.substring(2, 4), 10)
        //var yyyy = parseInt(inputStr.substring(4, inputStr.length), 10)
        //alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
        
    if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)) 
        {
        // there is a non-numeric character in one of the component values
        //alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
    
    if (mm < 1 || mm > 12) 
        {
        // month value is not 1 thru 12
        //alert("Months must be entered between the range of 01 (January) and 12 (December).")
        return false
        }
    if (dd < 1 || dd > 31) 
        {
        // date value is not 1 thru 31
        //alert("Days must be entered between the range of 01 and a maximum of 31 (depending on the month and year).")
        return false
        }
        
    // Let's check more specifically for days in month
    if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30) {return false;}
    
    // We'll check Feb, but let's not get into leap years...
    if ((mm == 2) && dd > 29) {return false;}
    
    //Let's prevent unlikely (anything in the past) years
    if (yyyy < 1920) {return false;}
    
    // validate year, allowing for checks between year ranges
    // passed as parameters from other validation functions
    //if (yyyy < 100) 
    //    {
    //    // entered value is two digits, which we don't allow
    //    alert("Year must be four digits (include century).")
    //    return false
    //    }

    return true;
}

// Function to see  if input is valid US phone number
function isPhone(strInput)
{
    // Phone numbers can be 
    // AAA.EEE.NNNN
    
    var inputStr = strInput.toString()
    var strFormatMsg = "The phone entry is not in an acceptable format.\n\nPlease enter phone numbers in the following format nnn.nnn.nnnn."
  
	if (inputStr.length != 12) {return false;}

    // convert dot delimiters to dashes
    /* while (inputStr.indexOf(".") != -1) 
        {
        inputStr = replaceString(inputStr,".","-")
        }
     */   
    // Find the delimiters, if any    
    var delim1 = inputStr.indexOf(".")
    var delim2 = inputStr.lastIndexOf(".")
    if (delim1 != -1 && delim1 == delim2) 
        {
        // there is only one delimiter in the string
        //alert(strFormatMsg)
        return false
        }
        
    // dashes must be in the right places
    if (delim1 != 3 || delim2 != 7)
        {
        //alert(strFormatMsg)
        return false;
        }
    
    if (delim1 != -1) 
        {
        // there are delimiters; extract component values
        var AreaCode = parseInt(inputStr.substring(0, delim1), 10)
        var CO = parseInt(inputStr.substring(delim1 + 1, delim2), 10)
        var Number = parseInt(inputStr.substring(delim2 + 1, inputStr.length), 10)
        }
    else 
        {
        // there are no delimiters; extract component values
        //alert(strFormatMsg)
        return false
        }
        
    if (isNaN(AreaCode) || isNaN(CO) || isNaN(Number)) 
        {
        // there is a non-numeric character in one of the component values
        //alert(strFormatMsg)
        return false
        }
    
    if (AreaCode < 100 || AreaCode > 999) 
        {
        //alert(strFormatMsg)
        return false
        }
    if (CO < 100 || CO > 999) 
        {
        //alert(strFormatMsg)
        return false
        }
	
    if (Number < 0 || Number > 9999) 
        {
        //alert(strFormatMsg)
        return false
        }

    return true;

}

// 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)
{
    var i;

	// whitespace characters
	var whitespace = " \t\n\r";

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

// function to see if input is valid US or Canadian Postal Code
function isPostalCode (s)
{  
	// OK if US Zip Code
	if (s.length == 5 && isPosInteger(s)) {return true;}

	// OK if Canadian Postal Code
	if (s.length == 6) {return true;}

	// Otherwise its not OK!
	return false;
}

//
function isEmail (s)
{     
    // is s whitespace?
    if (isWhitespace(s)) return false;
    
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var nLength = s.length;

    // look for @
    while ((i < nLength) && (s.charAt(i) != "@"))
    { i++
    }
	// The must be something after the @
    if ((i >= nLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < nLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= nLength - 1) || (s.charAt(i) != ".")) return false;
    //else return true;
    
    // We don't allow any embedded spaces. (Somebody once entered "joe@aol.com OR joe@yahoo.com")
    if (s.indexOf(" ") != -1) return false;
    
    // If no problems found, we assume it's A-OK.
    return true;
}

//
// Function isTime()
// Returns true if the given string contains a valid 12 hour time.
//
function isTime(s)
{
	// HH:MM AM or HH:MM am or HH:MM PM or HH:MM pm
	// HH = 1 - 12, MM = 0 - 59

	var aApP = "aApP"
	
	// Find colon and space -- be sure they're in the right places	
    var iColon = s.indexOf(":")
    var iSpace = s.lastIndexOf(" ")    

	// h:mm am or hh:mm am
	if ((iColon != 2 && iColon != 1) || iSpace != 5 && iSpace != 4) {return false;}

	// Get the hours, minutes and am/pm	
    var hh = parseInt(s.substring(0, iColon), 10)
    var mm = parseInt(s.substring(iColon + 1, iSpace), 10)
    var ap = s.charAt(iSpace + 1)  
	
    if (isNaN(hh) || isNaN(mm)) 
        {
        // there is a non-numeric character in one of the component values
        return false
        }
        
	// Be sure values are in range  
	if (hh < 1 || hh > 12) { return false; }
    if (mm < 0 || mm > 59) { return false; }
    if (aApP.indexOf(ap) == -1) return false;
	
	return true;
}

function isCurrency(s)
{
	// Allow $ -- ignore it
	return isNumber(replaceString(s, "$", ""));
}


//*****************************************************************************
//  User interface functions (ValidXXX())
//*****************************************************************************
function ValidText(Field, bRequired, sFieldName)
{
	if (bRequired && isWhitespace(Field.value))	
	//if (bRequired && (Field.value == ""))
		{
		alert("Field '" + sFieldName + "' is required.");
		if (Field.type != "hidden") {
			Field.focus();
		}
		return false;
		}
		
	return true;
}

function ValidPositiveNumber(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (!isPosNumber(Field.value))
		{
		alert("You must supply a valid number" + sName + ".");            
		Field.focus();
		Field.select();
		return false;
		}

	return true;
}

function ValidDate(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
		{
		if (!isDate(Field.value))
			{
			alert("You must supply a valid date" + sName + ". (MM/DD/YYYY)");            
			Field.focus();
			Field.select();
			return false;
			}
		}
	return true;
}

function ValidSSN(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
			if (!isSSN(Field.value))
				{
				alert("You must supply a valid Social Security Number" + sName + ". The format is NNN-NN-NNNN");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidPhoneNumber(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
/* For now we allow anything -- we want to accommodate international numbers of any format.
    -- CSK July 2001
	if (Field.value != "")
			{
			if (!isPhone(Field.value))
				{
				alert("You must supply a valid phone number" + sName + ". The format should be NNN.NNN.NNNN");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
*/
	return true;
}

function ValidPositiveInteger(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
			if (!isPosInteger(Field.value))
				{
				alert("You must supply a valid number" + sName + ".");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidInteger(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
			if (!isInteger(Field.value))
				{
				alert("You must supply a valid number" + sName + ".");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidPostalCode(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
			if (!isPostalCode(Field.value))
				{
				alert("You must supply a valid postal code" + sName + ".");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidEmail(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
    var sValue;
	sValue = Trim(Field.value);
	if (bRequired && isWhitespace(sValue))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (sValue != "")
			{
			if (!isEmail(sValue))
				{
				alert("You must supply a single valid email address" + sName + ". (<user>@<organization>.<domain)>");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidCurrency(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (!isCurrency(Field.value))
		{
		alert("You must supply a valid currency value" + sName + ".>");            
		Field.focus();
		Field.select();
		return false;
		}

	return true;
}

function ValidTime(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
			if (!isTime(Field.value))
				{
				alert("You must supply a valid time" + sName + ". (HH:MM AM)>");            
				Field.focus();
				Field.select();
				return false;
				}
			} 
	return true;
}

function ValidStateText(Field, sTxtField, bRequired, sFieldName, nStateFormat) {
	if (!bRequired) return true;

	if (nStateFormat == 0) {
		if (Field.selectedIndex == 0) {
			alert("Please choose a value for " + sFieldName);
			Field.focus();
			return false;
		}
		return true;
	}

	if (nStateFormat == 1) {
		if (Field.selectedIndex == 0) {
		 	 if (isWhitespace(sTxtField.value)) {
				alert("Field '" + sFieldName + "' is required.");
				return false;
			 }
		}
	}

	if (nStateFormat == 2) {
 	 if (isWhitespace(sTxtField.value)) {
		alert("Field '" + sFieldName + "' is required.");
		sTxtField.focus();
		return false;
	 }
	}
	
	return true;
}



function ValidPassword(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
			{
            var s = Field.value;
        	// Disallowed characters
        	var achDisallow = "\"<>'";
        
            // Search through string's characters one by one
            // until we find a disallowed character.
            // When we do, return false; if we don't, return true.
            for (var i = 0; i < s.length; i++)
                {   
                // Check the current character
                var c = s.charAt(i);
                if (achDisallow.indexOf(c) >= 0)
                    {
    				alert("Your entry" + sName + " must not contain any of these characters: " + achDisallow);            
    				Field.focus();
    				Field.select();
    				return false;
                    }
                }
        
			} 
	return true;
}

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function


// date field validation 
function isEuropeDate(inputValue) 
{
    var inputStr = inputValue.toString()
  
    // convert hyphen delimiters to slashes
    while (inputStr.indexOf("-") != -1) 
        {
        inputStr = replaceString(inputStr,"-","/")
        }
    // Find the delimiters, if any    
    var delim1 = inputStr.indexOf("/")
    var delim2 = inputStr.lastIndexOf("/")
    if (delim1 != -1 && delim1 == delim2) 
        {
        // there is only one delimiter in the string
       // alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
    
    if (delim1 != -1) 
        {
        // there are delimiters; extract component values
        var dd = parseInt(inputStr.substring(0,delim1), 10)
        var mm = parseInt(inputStr.substring(delim1 + 1, delim2), 10)
        var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length), 10)
        }
    else 
        {
        // there are no delimiters; extract component values
        //var mm = parseInt(inputStr.substring(0, 2), 10)
        //var dd = parseInt(inputStr.substring(2, 4), 10)
        //var yyyy = parseInt(inputStr.substring(4, inputStr.length), 10)
        //alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
        
    if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)) 
        {
        // there is a non-numeric character in one of the component values
        //alert("The date entry is not in an acceptable format.\n\nYou can enter dates in the following formats: mm/dd/yyyy, or mm-dd-yyyy.")
        return false
        }
    
    if (mm < 1 || mm > 12) 
        {
        // month value is not 1 thru 12
        //alert("Months must be entered between the range of 01 (January) and 12 (December).")
        return false
        }
    if (dd < 1 || dd > 31) 
        {
        // date value is not 1 thru 31
        //alert("Days must be entered between the range of 01 and a maximum of 31 (depending on the month and year).")
        return false
        }
        
    // Let's check more specifically for days in month
    if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30) {return false;}
    
    // We'll check Feb, but let's not get into leap years...
    if ((mm == 2) && dd > 29) {return false;}
    
    //Let's prevent unlikely (anything in the past) years
    if (yyyy < 1920) {return false;}
    
    // validate year, allowing for checks between year ranges
    // passed as parameters from other validation functions
    //if (yyyy < 100) 
    //    {
    //    // entered value is two digits, which we don't allow
    //    alert("Year must be four digits (include century).")
    //    return false
    //    }

    return true;
}

function ValidEuropeDate(Field, bRequired, sFieldName)
{
	var sName = sFieldName
	if (sFieldName == "") {sName = ""} else {sName = " for " + sFieldName}
	
	if (bRequired && isWhitespace(Field.value))
		{
		alert("A value is required" + sName + ".");
		Field.focus();
		return false;
		}
		
	if (Field.value != "")
		{
		if (!isEuropeDate(Field.value))
			{
			alert("You must supply a valid date" + sName + ". (DD/MM/YYYY)");            
			Field.focus();
			Field.select();
			return false;
			}
		}
	return true;
}


// End of Validation.js

