function tblExaminee()
{
	this.ExamineePK = new _F("Examinee", INT, 4, 0, false);
	this.ExamineeID = new _F("Examinee ID", VARCHAR, 25, 0, true);
	this.GEDID = new _F("GED ID", INT, 4, 0, false);
	this.GEDIDTypeFK = new _F("GEDID Type", TINYINT, 1, 0, false);
	this.FirstName = new _F("First Name", VARCHAR, 50, 0, true);
	this.MiddleInitial = new _F("Middle Initial", CHAR, 1, 0, true);
	this.LastName = new _F("Last Name", VARCHAR, 50, 0, false);
	this.NameSuffix = new _F("Name Suffix", VARCHAR, 10, 0, true);
	this.AddressLine1 = new _F("Address Line 1", VARCHAR, 50, 0, true);
	this.AddressLine2 = new _F("Address Line 2", VARCHAR, 50, 0, true);
	this.City = new _F("City", VARCHAR, 50, 0, true);
	this.State = new _F("State", CHAR, 2, 0, true);
	this.ZipCode = new _F("Zip Code", CHAR, 5, 0, true);
	this.ZipCodeExtn = new _F("Zip Code Extension", CHAR, 4, 0, true);
	this.EdNA_CountyFK = new _F("EdNA County", SMALLINT, 2, 0, true);
	this.PhoneNumber = new _F("Phone Number", VARCHAR, 20, 0, true);
	this.PrimaryLanguage = new _F("Primary Language", CHAR, 1, 0, true);
	this.DateofBirth = new _F("Birth Date", SMALLDATETIME, 4, 0, false);
	this.Gender = new _F("Gender", CHAR, 1, 0, true);
	this.GEDEthnicCodeFK = new _F("Ethnic Code", TINYINT, 1, 0, true);
	this.HighestGradeCompleted = new _F("Highest Grade Completed", CHAR, 3, 0, true);
	this.WithdrawalYear = new _F("Withdrawal Year", SMALLINT, 2, 0, true);
	this.PAResidencyInd = new _F("PA Residency Indicator", BIT, 1, 0, false);
	this.SDIssuedDiplomaInd = new _F("Schhol District Issued Diploma Indicator", BIT, 1, 0, false);
	this.PracticeTestInd = new _F("Practice Test Indicator", BIT, 1, 0, false);
	this.CredStatusInd = new _F("Cred Status Indicator", BIT, 1, 0, false);
	this.CredStatusDate = new _F("Cred Status Date", SMALLDATETIME, 4, 0, true);
	this.PassDate = new _F("PassDate", SMALLDATETIME, 4, 0, true);
	this.InstructionalCenterCode = new _F("Instructional Center Code", INT, 4, 0, true);
	this.ThirtyCollegeCreditInd = new _F("Thirty College Credit Indicator", BIT, 1, 0, false);
	this.MailReturnedInd = new _F("Mail Returned Indicator", BIT, 1, 0, false);
	this.TestCenterFK = new _F("Test Center", SMALLINT, 2, 0, true);
	this.DiplomaAuthorization = new _F("Diploma Authorization", CHAR, 1, 0, true);
	this.MilitaryExamineeInd = new _F("Military Examinee Indicator", BIT, 1, 0, false);
}

function tblDiploma()
{
	this.ExamineeFK = new _F("Examinee", INT, 4, 0, false);
	this.DiplomaNumberPK = new _F("Diploma Number", INT, 4, 0, false);
	this.OriginalIssueDate = new _F("Original Issue Date", SMALLDATETIME, 4, 0, true);
	this.LastIssueDate = new _F("Last Issue Date", SMALLDATETIME, 4, 0, true);
	this.DiplomaFirstName = new _F("Diploma First Name", VARCHAR, 50, 0, true);
	this.DiplomaMiddleInitial = new _F("Diploma Middle Initial", CHAR, 1, 0, true);
	this.DiplomaLastName = new _F("Diploma Last Name", VARCHAR, 50, 0, false);
	this.DiplomaSuffix = new _F("Diploma Suffix", VARCHAR, 10, 0, true);
	this.AuditAddDate = new _F("AuditAddDate", DATETIME, 8, 0, false);
	this.AuditAddUserName = new _F("AuditAddUserName", VARCHAR, 24, 0, false);
	this.AuditChangeDate = new _F("AuditChangeDate", DATETIME, 8, 0, false);
	this.AuditChangeUserName = new _F("AuditChangeUserName", VARCHAR, 24, 0, false);
}

function tblTestCenterOL()
{
	this.TestCenterPK = new _F("TestCenterPK", SMALLINT, 2, 0, false);
	this.TestCenterNumber = new _F("TestCenterNumber", INT, 4, 0, false);
	this.TestCenterName = new _F("TestCenterName", VARCHAR, 50, 0, true);
	this.PhoneNumber = new _F("PhoneNumber", VARCHAR, 20, 0, true);
	this.EdNA_CountyFK = new _F("EdNA_CountyFK", SMALLINT, 2, 0, true);
	this.Operations = new _F("Operations", VARCHAR, 255, 0, true);
	this.AddressLine1 = new _F("AddressLine1", VARCHAR, 50, 0, true);
	this.AddressLine2 = new _F("AddressLine2", VARCHAR, 50, 0, true);
	this.City = new _F("City", VARCHAR, 50, 0, true);
	this.State = new _F("State", CHAR, 2, 0, true);
	this.ZipCode = new _F("ZipCode", CHAR, 5, 0, true);
	this.ZipCodeExtn = new _F("ZipCodeExtn", CHAR, 4, 0, true);
	this.EnglishInd = new _F("EnglishInd", BIT, 1, 0, false);
	this.FrenchInd = new _F("FrenchInd", BIT, 1, 0, false);
	this.SpanishInd = new _F("SpanishInd", BIT, 1, 0, false);
}


function tblTestLanguageOL()
{
	this.TestLanguagePK = new _F("TestLanguagePK", TINYINT, 1, 0, false);
	this.Description = new _F("Description", VARCHAR, 50, 0, true);
}


function tblTRAddressOL()
{
	this.TRAddressPK = new _F("TRAddressPK", INT, 4, 0, false);
	this.Attention = new _F("Attention", VARCHAR, 50, 0, true);
	this.Name = new _F("Name", VARCHAR, 100, 0, false);
	this.AddressLine1 = new _F("AddressLine1", VARCHAR, 50, 0, false);
	this.AddressLine2 = new _F("AddressLine2", VARCHAR, 50, 0, true);
	this.City = new _F("City", VARCHAR, 50, 0, false);
	this.State = new _F("State", CHAR, 2, 0, false);
	this.ZipCode = new _F("ZipCode", CHAR, 5, 0, true);
	this.ZipCodeExtn = new _F("ZipCodeExtn", CHAR, 4, 0, true);
	this.AuditDate = new _F("AuditDate", DATETIME, 8, 0, false);
}


function tblTranscriptRequestOL()
{
	this.TranscriptRequestPK = new _F("TranscriptRequestPK", INT, 4, 0, false);
	this.RequestDate = new _F("RequestDate", SMALLDATETIME, 4, 0, false);
	this.AuditDate = new _F("AuditDate", DATETIME, 8, 0, false);
}


function tblTRExamineeAddressOL()
{
	this.TranscriptRequestFK = new _F("TranscriptRequestFK", INT, 4, 0, false);
	this.TRAddressFK = new _F("TRAddressFK", INT, 4, 0, false);
	this.TRExamineeFK = new _F("TRExamineeFK", SMALLINT, 2, 0, false);
	this.AuditDate = new _F("AuditDate", DATETIME, 8, 0, false);
}


function tblTRExamineeAltNamesOL()
{
	this.TranscriptRequestFK = new _F("TranscriptRequestFK", INT, 4, 0, false);
	this.TRExamineeFK = new _F("TRExamineeFK", SMALLINT, 2, 0, false);
	this.SequenceNumber = new _F("SequenceNumber", TINYINT, 1, 0, false);
	this.FirstName = new _F("FirstName", VARCHAR, 50, 0, false);
	this.MiddleInitial = new _F("MiddleInitial", CHAR, 1, 0, true);
	this.LastName = new _F("LastName", VARCHAR, 50, 0, false);
	this.NameSuffix = new _F("NameSuffix", VARCHAR, 10, 0, true);
	this.AuditDate = new _F("AuditDate", DATETIME, 8, 0, false);
}


function tblTRExamineeOL()
{
	this.TranscriptRequestFK = new _F("TranscriptRequestFK", INT, 4, 0, false);
	this.TRExamineePK = new _F("TRExamineePK", SMALLINT, 2, 0, false);
//	this.GEDID = new _F("GEDID", INT, 4, 0, true);
//changed to make consistent with the text on screen	
	this.GEDID = new _F("Social Security Number", INT, 4, 0, true);
	this.FirstName = new _F("FirstName for Examinee", VARCHAR, 50, 0, false);
	this.MiddleInitial = new _F("MiddleInitial", CHAR, 1, 0, true);
	this.LastName = new _F("LastName for Examinee", VARCHAR, 50, 0, false);
	this.NameSuffix = new _F("NameSuffix", VARCHAR, 10, 0, true);
//	this.DateofBirth = new _F("DateofBirth", SMALLDATETIME, 4, 0, true);
//to make birthdate mandatory
	this.DateofBirth = new _F("Date of Birth", SMALLDATETIME, 4, 0, false);
	this.PhoneNumber = new _F("PhoneNumber", VARCHAR, 20, 0, true);
	this.YearOfTest = new _F("YearOfTest", SMALLINT, 2, 0, true);
	this.AddressLine1 = new _F("AddressLine1", VARCHAR, 50, 0, true);
	this.AddressLine2 = new _F("AddressLine2", VARCHAR, 50, 0, true);
	this.City = new _F("City", VARCHAR, 50, 0, true);
	this.State = new _F("State", CHAR, 2, 0, true);
	this.ZipCode = new _F("ZipCode", CHAR, 5, 0, true);
	this.ZipCodeExtn = new _F("ZipCodeExtn", CHAR, 4, 0, true);
	this.AuditDate = new _F("AuditDate", DATETIME, 8, 0, false);
}


var SMALLINT = 1;
var INT = 2;
var VARCHAR = 3;
var CHAR = 4;
var BIT = 5;
var TINYINT = 6;
var DATETIME = 7;
var SMALLDATETIME = 8;


// -------------------------------------------------------------------------------------
var CONFIRM_CANCEL = "Do you want to cancel and loose changes?";
var CONFIRM_DELETE = "Are you sure you want to delete?";
var CONFIRM_DELETE_WITH_PARAM = "Are you sure you want to delete the selected %1?";
var CONFIRM_SUBMIT = "You can't undo this operation. Are you sure you want to continue?";
var CONFIRM_EXAMINEE_REFERENCE_DELETION_WARNING = "All references to the selected Examinee(s) will be deleted.";
var ERR_NONULL = "%1 cannot be blank";
var ERR_NOZERO = "%1 should be greater than ZERO";
var ERR_ZERO = "%1 can't be ZERO";
var ERR_INVALIDDISCOUNTRATE = "%1 less than 0% or more than 100% is not allowed";
var ERR_INVALIDHRS = "%1 is invalid";
var ERR_EXCEEDLEN = "%1 should not have more than %2 characters";
var ERR_EXCEEDVALUE = "%1 should be in the range of %2 and %3";
var ERR_ENTERDOLLARSANDCENTS = "%1 - is in invalid format for money";//"%1 - Enter dollars and cents";
var ERR_INVALIDFORMONEY = "%1 - Invalid for Money";
var ERR_NONEGATIVE = "%1 can't be negative value";
var ERR_NOTANINT = "%1 is not an integer";
var ERR_NOTANUMBER = "%1 is not a number";
var ERR_NOCENTS = "%1 - Enter dollars and cents";
var ERR_INVALID = "Invalid %1";
var ERR_INVALIDDATE = "%1 has an Invalid Date";
var ERR_INVALIDNUMERICSTRING = "%1 has Invalid format. Should be numeric of length %2";
var ERR_DATE_COMPARISON = "%1 can't be greater than %2";
var ERR_ACCEPTEDDATETIMERANGE = "%1 is out of accepted date range";
var ERR_INVALIDEMAIL = "%1 is invalid";
var ERR_TRANSMITTAL_REQUEST_COUNT_ZERO = "At least one request should be included in the transmittal";
var ERR_NO_SEARCH_CRITERIA = "At least one search criterion should be entered";
var ERR_NO_FORM_ID = "Form ID is mandatory if score is entered";
var ERR_MISSING_SUBJECT_SCORE = "Incomplete data for one or more subjects.";
var ERR_NO_SUBJECT_SCORE = "At least one subject score should be entered.";
var ERR_INVALID_PERCENTILE = "Invalid Percentile";
var ERR_INVALID_SUBJECT_SCORE = "Invalid Subject Score";
var ERR_NO_RECORDS_FOUND = "No Records Found for the selection criteria";
var ERR_GEDID_DIGITS = "SSN should be a 9 digit number";
var ERR_DIP_NOT_RETURNED = "The Diploma is Not returned. Do you want to proceed?";
var ERR_DIP_NOT_REQUESTED ="The Diploma was not requested. Do you want to Print the Diploma?";
var ERR_INCORRECT_FEE_AMOUNT = "Incorrect Fee Amount. It should be $%1 for %2 transcripts";
var INF_TR_TRANSMITTAL_PROCESSED = "Transmittal is processed for this request. No modifications can be done except for No Find letters";
var INF_TR_SENT_BACK = "This is a sent back request";
var ERR_ATLEAST_ONE_FILE_REQD = "You need to specify atleast one XML file to upload";
var ERR_NOT_AN_XML_FILE = "One or more files you selected are not XML files";
//var ERR_EXAMINEE_DELETE_CONFIRMATION = "Are you sure you want to delete the selected Examinee(s)?";
//var ERR_TEST_SCORE_DELETION_CONFIRMATION = "Are you sure you want to delete the selected Test Score(s)?";
//var ERR_ADDENDUM_DELETION_CONFIRMATION = "Are you sure you want to delete the selected Addendum(s)?";
//var ERR_CONTACT_DELETION_CONFIRMATION = "Are you sure you want to delete the selected Contact(s)?";

	
	
function GetErrorMessage(ErrorString, param1, param2, param3)
{
	var res = ErrorString;
	if(param1 != null)	res = ReplaceString(res, "%1", param1);
	if(param2 != null)	res = ReplaceString(res, "%2", param2);
	if(param3 != null)	res = ReplaceString(res, "%3", param3);
	return res;
}


function ReplaceString(srcString, findString, repString)
{
	var res = srcString;
	var pos = res.indexOf(findString);
	while(pos >= 0)
	{
		res = res.substring(0,pos) + repString + res.substring(pos + findString.length, res.length);
		pos = res.indexOf(findString);
	}
	return res;
}

function _F(pShortDesc, pDataType, pLength, pScale, pAllowNull)
{
	this.ShortDesc = pShortDesc;
	this.DataType = pDataType;
	this.Length = pLength;
	this.AllowNull = pAllowNull;
	this.Scale = pScale;
	switch(pDataType)
	{
		case SMALLINT:
			this.Validate = _ValidateSmallInt;
			break;
		case VARCHAR:
			this.Validate = _ValidateVarchar;
			break;
		case DATETIME:
			this.Validate = _ValidateDateTime;
			break;
		case TINYINT:
			this.Validate = _ValidateTinyInt;
			break;
		case INT:
			this.Validate = _ValidateInt;
			break;
		case SMALLDATETIME:
			this.Validate = _ValidateSmallDateTime;
			break;
		case CHAR:
			this.Validate = _ValidateChar;
			break;
		case BIT:
			this.Validate = _ValidateBit;
			break;
		case SMALLMONEY:
			this.Validate = _ValidateMoney;
			break;
	}
}


function _ValidateSmallInt(pValue)
{
	if(this.AllowNull && (pValue == null || pValue == "")) return true;
	if(!this.AllowNull)
	{
		if(pValue == null || pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	if(isNaN(pValue))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));		
		return false;
	}
	var intVal = parseInt(pValue);
	if(intVal < 0 || intVal > 32767)
	{
		alert(GetErrorMessage(ERR_EXCEEDVALUE,this.ShortDesc,0,32767));
		return false;
	}	
	
	if (pValue.indexOf(".") >= 0)
	{
		alert(GetErrorMessage(ERR_INVALID,this.ShortDesc,null,null));
		return false;
	}
	
	/*if (pValue == 0)
	{
		alert(GetErrorMessage(ERR_INVALID,this.ShortDesc,null,null));
		return false;
	}*/
	
	/*if(String(pValue) != String(intVal))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));
		return false
	}*/
	return true;
}


function _ValidateVarchar(pValue)
{
	var s = String(pValue);
	if(s.length == 0) s = null;
	if(this.AllowNull && s == null)  return true;
	if(!this.AllowNull)
	{
		if(s == null)
		{
			alert(GetErrorMessage(ERR_NONULL, this.ShortDesc,null,null));
			return false;
		}
	}
	if(pValue.length > this.Length) 
	{
			alert(GetErrorMessage(ERR_EXCEEDLEN, this.ShortDesc, this.Length,null));
			return false;
	}
	return true;
}


function _ValidateDateTime(pValue)
{
	if(this.AllowNull && pValue == "") return true;
	if(!this.AllowNull)
	{
		if(pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	
	var result ;
	var elems = pValue.split("/");
 	
 	result = (elems.length == 3); // should be three components
 	if ( result == false )
	 {
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;	
	   }
 	
 		var month = parseInt(elems[0],10);
  		var day = parseInt(elems[1],10);
 		var year = parseInt(elems[2],10);
	 	result = allDigits(elems[0]) && (month > 0) && (month < 13) &&
					allDigits(elems[1]) && (day > 0) && (day < 32) &&
					allDigits(elems[2]) && ((elems[2].length == 2) || (elems[2].length == 4));
					
	   if ( result == false )
	   {
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;	
	   }
	
		var dt = Date.parse(pValue);
		if(isNaN(dt))
		{
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;
		}
					
	dt = new Date(dt);  // Parse milliseconds to a Date object
	var dd = dt.getDate();
	var mm = dt.getMonth() + 1; // Javascript month is 0-11
	var yyyy = dt.getFullYear();
	
	
	if ( mm != month )
	{
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;
	}
	/*
	if(dd < 10) dd = "0" + dd;
	if(mm < 10) mm = "0" + mm;
	var sDt = mm + "/" + dd + "/" + yyyy;
	
	if(sDt != String(pValue))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}
	*/
	
	if(dt  < new Date("1900","00","01") || dt  > new Date("2079","05","06"))
	{
		alert(GetErrorMessage(ERR_ACCEPTEDDATETIMERANGE,this.ShortDesc,null,null));
		return false;
	}
	return true;
}

/*
function _ValidateDateTime(pValue)
{
	if(this.AllowNull && pValue == "") return true;
	if(!this.AllowNull)
	{
		if(pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	
	var dt = Date.parse(pValue);
	if(isNaN(dt))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}
	dt = new Date(dt);  // Parse milliseconds to a Date object
	var dd = dt.getDate();
	var mm = dt.getMonth() + 1; // Javascript month is 0-11
	var yyyy = dt.getFullYear();
	if(dd < 10) dd = "0" + dd;
	if(mm < 10) mm = "0" + mm;
	var sDt = mm + "/" + dd + "/" + yyyy;
	
	if(sDt != String(pValue))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}
	if(dt  < new Date("1900","00","01") || dt  > new Date("2079","05","06"))
	{
		alert(GetErrorMessage(ERR_ACCEPTEDDATETIMERANGE,this.ShortDesc,null,null));
		return false;
	}
	return true;
}

*/

function _ValidateTinyInt(pValue)
{
	if(this.AllowNull && (pValue == null || pValue == "")) return true;
	if(!this.AllowNull)
	{
		if(pValue == null || pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	if(isNaN(pValue))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));		
		return false;
	}
	
	var intVal = parseInt(pValue);
	if(intVal < 0 || intVal > 255)
	{
		alert(GetErrorMessage(ERR_EXCEEDVALUE,this.ShortDesc,0,255));
		return false;
	}
	 
	if (pValue.indexOf(".") >= 0)
	{
		alert(GetErrorMessage(ERR_INVALID,this.ShortDesc,null,null));
		return false;
	}
	/*if(String(pValue) != String(intVal))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));
		return false
	}*/
	 
	
	return true;
}


function _ValidateInt(pValue)
{
	if(this.AllowNull && (pValue == null || pValue == "")) return true;
	if(!this.AllowNull)
	{
		if(pValue == null || pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	if(isNaN(pValue))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));		
		return false;
	}
	
	var intVal = parseInt(pValue);
	if(intVal < 0 || intVal > 2147483647)
	{
		alert(GetErrorMessage(ERR_EXCEEDVALUE,this.ShortDesc,0,2147483647));
		return false;
	}
	
	if (pValue.indexOf(".") >= 0)
	{
		alert(GetErrorMessage(ERR_INVALID,this.ShortDesc,null,null));
		return false;
	}
	
	/*if (pValue == 0)
	{
		alert(GetErrorMessage(ERR_INVALID,this.ShortDesc,null,null));
		return false;
	}*/
	
	/*if(String(pValue) != String(intVal))
	{
		alert(GetErrorMessage(ERR_NOTANINT,this.ShortDesc,null,null));
		return false
	}*/
	
	
	return true;
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	for (var i=0;i<str.length;i++)
	if (charset.indexOf(str.substr(i,1))<0)
	{
		result = false;
		break;
	}
	return result;
}



function _ValidateSmallDateTime(pValue)
{
	if(this.AllowNull && pValue == "") return true;
	if(!this.AllowNull)
	{
		if(pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	
	var result ;
	var elems = pValue.split("/");
 	
 	result = (elems.length == 3); // should be three components
 	if ( result == false )
	 {
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;	
	   }
 	
 		var month = parseInt(elems[0],10);
  		var day = parseInt(elems[1],10);
 		var year = parseInt(elems[2],10);
	 	result = allDigits(elems[0]) && (month > 0) && (month < 13) &&
					allDigits(elems[1]) && (day > 0) && (day < 32) &&
					allDigits(elems[2]) && ((elems[2].length == 2) || (elems[2].length == 4));
					
	   if ( result == false )
	   {
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;	
	   }
	
		var dt = Date.parse(pValue);
		if(isNaN(dt))
		{
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;
		}
					
	dt = new Date(dt);  // Parse milliseconds to a Date object
	var dd = dt.getDate();
	var mm = dt.getMonth() + 1; // Javascript month is 0-11
	var yyyy = dt.getFullYear();
	
	
	if ( mm != month )
	{
			alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
			return false;
	}
	/*
	if(dd < 10) dd = "0" + dd;
	if(mm < 10) mm = "0" + mm;
	var sDt = mm + "/" + dd + "/" + yyyy;
	
	if(sDt != String(pValue))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}
	*/
	
	if(dt  < new Date("1900","00","01") || dt  > new Date("2079","05","06"))
	{
		alert(GetErrorMessage(ERR_ACCEPTEDDATETIMERANGE,this.ShortDesc,null,null));
		return false;
	}
	return true;
}



/*

function _ValidateSmallDateTime(pValue)
{
	if(this.AllowNull && pValue == "") return true;
	if(!this.AllowNull)
	{
		if(pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL,this.ShortDesc,null,null));
			return false;
		}
		
	}
	
	var dt = Date.parse(pValue);
	if(isNaN(dt))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}

	dt = new Date(dt);  // Parse milliseconds to a Date object
	var dd = dt.getDate();
	var mm = dt.getMonth() + 1; // Javascript month is 0-11
	var yyyy = dt.getFullYear();
	if(dd < 10) dd = "0" + dd;
	if(mm < 10) mm = "0" + mm;
	var sDt = mm + "/" + dd + "/" + yyyy;

	 
	if(sDt != String(pValue))
	{
		alert(GetErrorMessage(ERR_INVALIDDATE,this.ShortDesc,null,null));
		return false;
	}
	 
	if(dt  < new Date("1900","00","01") || dt  > new Date("2079","05","06"))
	{
		alert(GetErrorMessage(ERR_ACCEPTEDDATETIMERANGE,this.ShortDesc,null,null));
		return false;
	}
	return true;
}
*/


function _ValidateChar(pValue)
{
	var s = String(pValue);
	if(s.length == 0) s = null;
	if(this.AllowNull && s == null)  return true;
	if(!this.AllowNull)
	{
		if(s == null)
		{
			alert(GetErrorMessage(ERR_NONULL, this.ShortDesc,null,null));
			return false;
		}
	}
	if(pValue.length > this.Length) 
	{
			alert(GetErrorMessage(ERR_EXCEEDLEN, this.ShortDesc, this.Length,null));
			return false;
	}
	return true;
}


function _ValidateBit(pValue)
{
	return true;
}


function _ValidateMoney(pValue)
{
	if(this.AllowNull && (pValue == null || pValue == "")) return true;
	else if(!this.AllowNull)
	{
		if(pValue == null || pValue == "")
		{
			alert(GetErrorMessage(ERR_NONULL, this.ShortDesc,null,null));
			return false;
		}
	
	//else return true;
	}
	
	if(isNaN(pValue))
	{
		alert(GetErrorMessage(ERR_INVALIDFORMONEY, this.ShortDesc,null,null));
		return false;
	}
	if(parseFloat(pValue) < 0)
	{
		alert(GetErrorMessage(ERR_NONEGATIVE ,this.ShortDesc));
		return false;
	}  
	var sValue = String(pValue);
	var pos = sValue.indexOf(".");
	var sNum = "";
	var sDec = "";
	if(pos >= 0)
	{
		sNum = sValue.substring(0, pos);
		sDec = sValue.substr(pos + 1);
	}
	//else
	//{
	//	alert(GetErrorMessage(ERR_ENTERDOLLARSANDCENTS, this.ShortDesc));
	//	return false;
	//}
	
	
	iNum = parseInt(new String(sNum));
	iDec = parseInt(new String(sDec));
	
	if(iDec > 99) 
	{
		alert(GetErrorMessage(ERR_ENTERDOLLARSANDCENTS ,this.ShortDesc));
		return false;
	}
	sNum = new String(iNum);
	if(iDec < 10)
	{
		sDec = "0" + iDec;
	}
	else
	{
		sDec = new String(iDec);
	}
	
	var sAmount = sNum + "." + sDec;
	if(String(pValue) != sAmount) 
	{
		alert(GetErrorMessage(ERR_ENTERDOLLARSANDCENTS ,this.ShortDesc));
		return false;
	}
	
	/*if(sAmount < -922337203685477.5808 || sAmount > 922337203685476.5808)
	{
		alert(GetErrorMessage(ERR_EXCEEDVALUE ,this.ShortDesc,-922337203685477.5808,-922337203685476.5808));
		return false;
	}*/
		return true;
}
/*------------------------------Other Functions added by Kris / Amal -----------------------------*/

	function CompareDate(fldName1, fldName2, fldValue1, fldValue2)
	{
		var date1 = Date.parse(fldValue1);
		var date2 = Date.parse(fldValue2);
        if (date2 < date1 )
		{
			alert(GetErrorMessage(ERR_DATE_COMPARISON, fldName1 , fldName2, null));
			return false;
		}
		return true;
	}


	function ValidateNumericString(fldName, fldValue, allowNull)
	{
		if(fldValue.length == 0)
		{
			alert(GetErrorMessage(ERR_NONULL, fldName , null, null));
			return false;
		}
		/*if(fldValue.length != fldLen)
		{
			alert(GetErrorMessage(ERR_INVALIDNUMERICSTRING, fldName , fldLen, null));
			return false;
		}
		else
		*/
		for (i = 0; i < fldValue.length; i++)
		{ 
			var c = fldValue.charAt(i);
			if (!IsDigit(c))
			{
				alert(GetErrorMessage(ERR_INVALIDNUMERICSTRING, fldName , null, null));
				return false;
			}
		}
		
		return true;
	}




	function checkemail(email)
	{
		var testresults ;
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
		if (filter.test(email))
		{
			testresults=true ;
		}
		else
		{
			testresults=false ;
		}
		return (testresults);
	}

	function IsDigit (c)
	{
		return ((c >= "0") && (c <= "9"))
	}

	function Trim(inputString) 
	{
		// Removes leading and trailing spaces from the passed string. Also removes
		// consecutive spaces and replaces it with one space. If something besides
		// a string is passed in (null, custom object, etc.) then return the input.
		if (typeof inputString != "string") 
		{
			return inputString; 
		}
		var retValue = inputString;
		var ch = retValue.substring(0, 1);
		while (ch == " ") 
		{ // Check for spaces at the beginning of the string
			retValue = retValue.substring(1, retValue.length);
			ch = retValue.substring(0, 1);
		}
		ch = retValue.substring(retValue.length-1, retValue.length);
		while (ch == " ") 
		{ // Check for spaces at the end of the string
			retValue = retValue.substring(0, retValue.length-1);
			ch = retValue.substring(retValue.length-1, retValue.length);
		}
		while (retValue.indexOf("  ") != -1) 
		{ // Note that there are two spaces in the string - look for multiple spaces within the string
			retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
		}
		return retValue; // Return the trimmed string back to the user
	} 

/***************************Get todays's date in mm/dd/yyyy ************************/
	function GetToday()
	{
		var now = new Date();
		var mm ;
		var dd ; 
		var mmddyyyy ; 
		// get the month in MM format 
		if (now.getMonth() <  10)
		{ 
			mm = now.getMonth() + 1; 
			//			mm = "0" + themonth; 
//changed due to "themonth undefined" error -- 02-Jan-2004
			mm = "0" + mm;
		} 
		else 
		{ 
		
			mm = now.getMonth() + 1 ; 
		} 
		// get the date in DD format 
		if (now.getDate() <  10)
		{ 
			dd = "0" + now.getDate(); 
		} else 
		{ 
			dd = now.getDate(); 
		} // put it all together in YYYYMMDD format 
		mmddyyyy = mm + "/" + dd + "/" +  now.getFullYear() ;
		
		return mmddyyyy ;	

	}
	
	function RaiseChangeEvents()
	{
		var control = document.activeElement;
		var controlName = String(control.id);
		if ((controlName.substring(0,3) == "txt") || (controlName.substring(0,3) == "cbo") || (controlName.substring(0,3) == "txa"))
		{
			if(control.onchange != null)
			{
				control.onchange();
			}
		}
	}

	function CheckAndRaiseEvents()
	{
		if(event.keyCode == 8)
		{
			RaiseChangeEvents();
		}
		if(event.keyCode == 46)
		{
			RaiseChangeEvents();
		}
	}

	document.onkeypress = RaiseChangeEvents;
	document.onkeyup = CheckAndRaiseEvents;


var windowonload = new Array(5);

function AppendWindowOnLoad(x)
{
	windowonload[windowonload.length+1] = x;
}

function AllOnLoads()
{
	//if(window.headerFooterReqd) displayStaticContent();
	for(var i=1;i<=windowonload.length;i++)
	{
		var x = windowonload[i];
		if(x) x();
	}
	if(init) init();
}


window.onload = AllOnLoads;

