<!--

// -- dsmith 7/22/2003 - NOTE!!! major change! I took out the gbSubmittedOnce flag
// cause it was dumb
// you can now submit form multiple times

// dsmith was here - 8/11/2001
// look for my comments below

// MAR 10/23/2002 -	Added functionality to the client validation that allows 
//							the caller to disable field validation on disabled fields
//
// MAR 12/3/2002  -	Added the DATE_TIME data type to allow a user to enter a
//							date and time value
//
// VERSION 2.0
// MAR 12/04/2002 -	Added code to validate all of the characters in the text
//							editable
//
//
// 2.2
// coz - updated URL with the newest reg exp from the calendar that mike did
//	   - added URL_RELATIVE

  //=============== Data Validation Functions ==========================================
		var isNav = true;
		var isIE = false;
		
		//Create an array to hold the Validator objects
		var arrValidData = new Array();
		
		//Create an array to hold the validation initialization statements
		var arrInitializationCodes = new Array();
		
		//Create an object to hold a function object that performs any extra validation on the form
		var ExtraValidationFunction;
		
		//Create an object to hold a function to initialize the validation elements
		var initializeValidationElements;
		
		// dsmith was here - 8/11/2001
		// initializing global "submitted once" variable!
		//var gbSubmittedOnce = false;

		//MAR 10/23/2002 - Global flag that determines if disabled elements should be validated
		//default is set to true so the client validation will work the same for current projects
		//utilizing it
		var gbValidateDisabledElements = true;
		
		//MAR 10/23/2002 - This function sets the value of the global Validate Disabled Elements flag
		// must be a boolean value of true or false
		function setValidateDisabledElementsFlag(bValue){
			gbValidateDisabledElements = bValue;
		}
		
		//MAR 12/04/2002 - This global determines if the checkData, checks
		//and replaces invalid characters in the text elements of the form
		//default it to true (on)
		var gbValidateTextCharacters = true;
		
		//============  DataValidation Class definition ==========================================
		//Constructor function
		function DataValidation(sDataType){
			//DataValidation Properties:
			//
			//this.p -	(Pattern) This is the pattern the final value is compared against
			//			when it is validated.
			//
			//this.c -	(Caption) This is the text that is diplayed to the user if an invalid
			//			datatype is entered.  Example: a value of 'currency' was expected.
			//
			//this.e -	(Examples) This is a string that contains a list of examples.
			//
			//this.v -	(Validator Function) This is a function that is executed in cases where
			//			simple regular expression data validation isn't enough.  This function
			//			will only run if the pattern is set to null.
			//
			//this.k -	(Keystroke Filter) - This is a regular expression object that filters
			//			out invalid keystrokes.
			//
			//this.f -	(Format Function) - This function runs on the onchange event of the input
			//			box.  This function takes the value that the user entered in the
			//			input box and formats it according to the type of value required.
			//			For example, if the input is type 'CURRENCY' and the user types in a
			//			value of 1234, this function will format the value to look like a
			//			standard currency value: 1234.00 by appending the '.00' to the end of
			//			the entry
			this.d = sDataType.toUpperCase();
			switch (this.d){
				
				case 'CHECKBOX':
					this.p = null;
					this.c = "Must choose one";
					this.e = null;
					this.f = null;
					this.v = null;
					this.k = null;
					this.valueType = null;
					break;
					
				//Telephone area code and phone number combined
				case 'AREA_CODE_PHONE':
					this.p = /^\d{3}-\d{3}-\d{4}$/i;
					this.c = "10 digit value";
					this.e = "555-555-5555";
					this.f  = function(objSrc)	{
													var objRegExp = /\d+/g
													var arrMatches;
													var sFilteredString = "";
													var i;
													
													//If the user has entered a value
													if(objSrc.value.length > 0){
														//filter the string for number only
														arrMatches = objSrc.value.match(objRegExp)
															
														//concatinate all of the number filtered pieces
														for(i=0; i<arrMatches.length; i++){
															sFilteredString = sFilteredString + arrMatches[i];
														}
															
														//If the number is greater than 7 characters
														if(sFilteredString.length > 10){
															//truncate the number to 10 numbers
															sFilteredString = sFilteredString.substr(0,10);
														}
															
														//format the number with a dash
														if(sFilteredString.length > 3 && sFilteredString.length < 8){
															sFilteredString = sFilteredString.substr(0,3) + "-" + sFilteredString.substr(3,sFilteredString.length-3);
														}
															
														//format the number with a dash
														else if(sFilteredString.length > 7 && sFilteredString.length < 11){
															sFilteredString = sFilteredString.substr(0,3) + "-" + sFilteredString.substr(3,3) + "-" + sFilteredString.substr(6,sFilteredString.length-6);
														}

														//write the formated value back to the text box
														objSrc.value = sFilteredString;
													}
												};
					this.v = null;
					this.k = /[0-9]|\-|[\b]/i;
					this.valueType = "INTEGER";
					break;
				
				//Telephone area code value
				case 'AREA_CODE':
					this.p = /^\d\d\d$/i;
					this.c = "three digit value";
					this.e = "503,218,407,...";
					this.f = function(objSrc)	{
													//If the user has entered a value
													if(objSrc.value.length > 0){
															//If the number is greater than 3 characters
														if(objSrc.value.length > 3){
															//truncate the number to 3 numbers
															objSrc.value = objSrc.value.substr(0,3);
														}
													}
												};
					this.v = null;
					this.k = /[0-9]|[\b]/i;
					this.valueType = "INTEGER";
					break;
						
				case 'FLOAT':
					this.p = /\d+\.{1}\d+/i; 
					this.c = "float";
					this.e = "7.0, 3.25, 5.5,...";
					this.f = function(objSrc)	{
													//Create a regular expression that looks for the decimal point
													var pattern = /\./i;
														
													//If the user has entered a value
													if(objSrc.value.length > 0){
														//If a decimal point isn't found in the string
														if (!pattern.test(objSrc.value)){
															//append a decimal point and zero to the value
															objSrc.value = objSrc.value += ".0";
														}
														//else if the rightmost character is a decimal point
														else if(objSrc.value.charAt(objSrc.value.length-1) == "."){
															//append a zero to the value
															objSrc.value = objSrc.value += "0";
														}
														
														//if the left most character is a decimal
														if(objSrc.value.charAt(0) == "."){
															//prefix the number with a zero
															objSrc.value = "0" + objSrc.value;
														}
													}
												};
					this.v = null;
					this.k = /[0-9\.]|[\b]/i;
					this.valueType = "FLOAT";
					break;
										
				//7 digit phone number
				case 'PHONE_NUMBER':
					this.p = /^\d{3}-\d{4}$/i;
					this.c = "standard phone number format";
					this.e = "123-4567,555-5555,...";
					this.f = function(objSrc)	{
													var objRegExp = /\d+/g
													var arrMatches;
													var sFilteredString = "";
													var i;
													
													//If the user has entered a value
													if(objSrc.value.length > 0){
														//filter the string for number only
														arrMatches = objSrc.value.match(objRegExp)
															
														//concatinate all of the number filtered pieces
														for(i=0; i<arrMatches.length; i++){
															sFilteredString = sFilteredString + arrMatches[i];
														}
															
														//If the number is greater than 7 characters
														if(sFilteredString.length > 7){
															//truncate the number to 7 numbers
															sFilteredString = sFilteredString.substr(0,7);
														}
															
														//format the number with a dash
														if(sFilteredString.length > 3){
															sFilteredString = sFilteredString.substr(0,3) + "-" + sFilteredString.substr(3,sFilteredString.length-3);
														}
															
														//write the formated value back to the text box
														objSrc.value = sFilteredString;
													}
												};
					this.v = null;
					this.k = /[0-9]|\-|[\b]/i;
					this.valueType = "STRING";
					break;
					
				
				
				//This is a url string
				case 'URL_DOMAIN_REQUIRED':
						
					//MAR 7/26/2002  this.p = /^[hH][tT]{2}[pP](s|S)?:\/\/(([a-zA-Z0-9-_]+)\.)*([a-zA-Z0-9-_]+)(:\d+)?(\/|\/([^\\\/:*<>|\.])+((\.|\/)?([^\\\/:*<>|\.])+)*\/?)?$/;

					//COZ 7/28/2003  updated from mikes code in calendar -
					//COZ 7/29/2003	 made changes to support query strings again

					this.p = /^[hH][tT]{2}[pP](s|S)?:\/\/([a-zA-Z0-9-_]+)\.(([a-zA-Z0-9-_]+)\.([a-zA-Z0-9-_]+)(:\d+)?)?(\/?|\/?([a-zA-Z0-9-_%])+((\.|\/)?([a-zA-Z0-9-_%])+)*\/?)?((\?$)|\?([a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)(\&[a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)*)?$/i;
					this.c = "url"
					this.e = "http://www.domain.com, https://domain.com/page.html?test=test2,..."
					this.f = null;
					this.v = null;
					this.k = /./i;
					this.valueType = "STRING";
					break;

				//This is a URL WITHOUT domain required! with a query string
				case 'URL_DOMAIN_OR_RELATIVE':

					//COZ 7/28/2003  updated from mikes code in calendar -
					//COZ 7/29/2003	 made changes to support query strings again

					this.p = /^([hH][tT]{2}[pP](s|S)?:\/\/([a-zA-Z0-9-_]+)\.(([a-zA-Z0-9-_]+)\.)*([a-zA-Z0-9-_]+)(:\d+)?)?(\/?|\/?([a-zA-Z0-9-_%])+((\.|\/)?([a-zA-Z0-9-_%])+)*\/?)?((\?$)|\?([a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)(\&[a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)*)?$/i;
					this.c = "url"
					this.e = "http://www.domain.com, https://domain.com/page.html?test=test2,..."
					this.f = null;
					this.v = null;
					this.k = /./i;
					this.valueType = "STRING";
					break;

				//This is a URL WITHOUT http://domain.com. Must start with either / or start of filename
				case 'URL_RELATIVE_REQUIRED':

					this.p = /^(\/?|\/?([a-zA-Z0-9-_%])+((\.|\/)?([a-zA-Z0-9-_%])+)*\/?)?((\?$)|\?([a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)(\&[a-zA-Z0-9-_%;\|,]+=?[a-zA-Z0-9-_%;\|,]*)*)?$/i;
					this.c = "url"
					this.e = "http://www.domain.com, https://domain.com/page.html?test=test2,..."
					this.f = null;
					this.v = null;
					this.k = /./i;
					this.valueType = "STRING";
					break;


				//any value other than a zero length string
				case 'NOT_NULL':
				
					this.p = /.+/i;
					this.c = "any character";
					this.e = "abc, 123, 1bc,...";
					this.f = null;
					this.v = null;
					this.k = /./i;
					this.valueType = 'STRING';
					break;
				
				//any printable ASCII value other than a zero length string
				case 'PRINTABLE_ASCII':
					this.p = /^[\x20-\x7E]+$/;
					this.c = "any printable character";
					this.e = "abc, 123, 1bc,...";
					this.f = null;
					this.v = null;
					this.k = /^[\x20-\x7E]+$/;
					this.valueType = null;
					break;
				
				//four digit year starting with 19,20, or 21
				case 'YEAR':
					this.p = /^(19|20|21)\d\d$/i;
					this.c = "four digit year value";
					this.e = "1900-2199";
					this.f = null;
					this.v = null;
					this.k = /[0-9]|[\b]/i;
					this.valueType = "INTEGER";
					break;

				//any positive integer value. can have leading zeros
				case 'NUMERIC':
					this.p = /^\d+$/i;
					this.c = "numeric value";
					this.e = "123, 04561, 2...";
					this.f = null;
					this.v = null;
					this.k = /[0-9]|[\b]/i;
					this.valueType = "INTEGER";
					break;

				//any positive or negative numeric value. 
				case 'ALL_NUMERIC':
					this.p = /^\-?([1-9]{1}[0-9]{0,2}(\,[0-9]{3})*(\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\.[0-9]{0,2})?|0(\.[0-9]{0,2})?|(\.[0-9]{1,2})?)$/i;
					this.c = "positive or negative numeric value";
					this.e = "-1.00, -1, 123, 45.23, 2...";
					this.f = null;
					this.v = null;
					this.k = /\-|[0-9]|\.|[\b]/i;
					this.valueType = "FLOAT";
					break;


				//currency value. if there is a decimal point it must be followed
				//by two digits
				case 'CURRENCY':
					this.p = /^\d{1,3}((\,{0,1}\d{3})|(\d{1,3}))*(\.(\d\d)?)?$/i;
					this.c = "currency";
					this.e = "123, 1,243.50, 12.00...";
					this.f = function(objSrc)	{
													var iDecimalPosition;
													var objRegExp = /-?[0-9]+\.[0-9]{2}$/;
  													var objRegExp2 = /^-/;
  				
													//If the user has entered a value
													if(objSrc.value.length > 0){
														//look for the decimal in the value
														iDecimalPosition = objSrc.value.lastIndexOf(".");
														
														//If the decimal point wasn't found
														if(iDecimalPosition == -1){
															//append two zeros and the decimal point
															objSrc.value = objSrc.value += ".00";
														}
														else{
															//If the decimal point is the last character
															if(iDecimalPosition == (objSrc.value.length - 1)){
																//append two zeros and the decimal point
																objSrc.value = objSrc.value += "00";
															}
															
															//If the decimal point is the next to last character
															if(iDecimalPosition == (objSrc.value.length - 2)){
																//append two zeros and the decimal point
																objSrc.value = objSrc.value += "0";
															}
														}
														if( objRegExp.test(objSrc.value)) {
															//Remove the commas from the string (in case its messed up)
															objSrc.value = removeCommas(objSrc.value)
															
															//Add commas to the string
															objSrc.value = addCommas(objSrc.value);
      
															//If the string starts with a negatve sign
															// NOTE: Currently disabled
															//if (objRegExp2.test(strValue)){
															//	//put parathesis arounf the value
															//	strValue = '(' + strValue + ')';
      														//}
      
															//return the value with a dollar sign
															//NOTE: Currently disabled
      														//return '$' + strValue;
														}
													}
												};
					this.v = null;
					this.k = /[0-9\.\,]|[\b]/i;
					this.valueType = "FLOAT";
					break;
					
					
				//Natural numbers. Greater than zero	
				//Added 10-11-01 by JB
				case 'NATURAL_NUMBER':
					this.p = /^[\+]?[123456789](\d+)?(.\d+)?$/i;
					this.c = "positive number";
					this.e = "123, 4561, zero is not allowed";
					
					//added 10-11-01 by Jon(w/ assistance from Mike)
					//strips leading zero's from number 
					this.f = function(objSrc){
					
						var intTemp;
 
					    //If there is a value in the source element
					    if(objSrc.value.length > 0){
					        //Convert the element to an integer
					        intTemp = parseInt(objSrc.value);
					        //If a number was returned
					        if(intTemp != NaN){
					            //convert the number back to a string
					            objSrc.value = intTemp.toString();
					        }
					    }
					};
					
					this.v = null;
					this.k = /[0-9]|[\b]/i;
					this.valueType = "INTEGER";
					break;
				
				
				
				//positive integers.  no leading zeros
				case 'POSITIVE_INTEGER':
					this.p = /^\d+$/i;
					this.c = "positive integer";
					this.e = "0, 1, 2...";
					
					//modified 10-11-01 by JB(w/ assistance from Mike)
					//strips leading zero's from number 
					this.f = function(objSrc){
					
						var intTemp;
 
					    //If there is a value in the source element
					    if(objSrc.value.length > 0){
					        //Convert the element to an integer
					        intTemp = parseInt(objSrc.value);
					        //If a number was returned
					        if(intTemp != NaN){
					            //convert the number back to a string
					            objSrc.value = intTemp.toString();
					        }
					    }
					};
					
					this.v = null;
					this.k = /[0-9]|[\b]/i;
					this.valueType = "INTEGER";
					break;
				
				//us or canadian postal codes.  us codes can have an optional
				//four digit number
				case 'US_ZIP_AND_CANADIAN_POSTAL_CODE':
					this.p = /(^\d{5}$|^\d{5}-\d{4}$)|(^[a-zA-Z]\d[a-zA-Z]\s\d[a-zA-Z]\d$)/i;
					this.c = "us zip or canadian postal code";
					this.e = "97000,12345-1234,Z2S 3F4...";
					this.f = null;
					this.v = null;
					this.k = /[a-zA-Z0-9\-\s]|[\b]/i;
					this.valueType = "STRING";
					break;
				
				//standard email format but with multiple email addresses
				//^[\w-_.]*[\w-_.]@[\w].+[\w]+[\w](;[\w-_.]*[\w-_.]@[\w].+[\w]+[\w])*$
				case 'MULTIPLE_EMAIL':
					//MAR 4/16/2003 - Changed the regular expression
					//this.p = /^[\w-_.]*[\w-_.]@[\w].+[\w]+[\w](;[\w-_.]*[\w-_.]@[\w].+[\w]+[\w])*$/i;
					this.p = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})(;([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))*$/i;
					this.c = "standard email format";
					this.e = "someone@somwhere.com";
					this.f = null;
					this.v = null;
					this.k = /[\w-_.@\;]|[\b]/;
					this.valueType = "STRING";
					break;
					
				//standard email address format
				case 'EMAIL':
					//this.p = /^[\w-_.]*[\w-_.]@[\w].+[\w]+[\w]$/i;
					this.p = /^[\w.-]+\@[\w.-]+\.[a-zA-Z]+$/i;
					this.c = "standard email format";
					this.e = "someone@somwhere.com";
					this.f = null;
					this.v = null;
					this.k = /[\w-_.@]|[\b]/;
					this.valueType = "STRING";
					break;
				
				//us zip code.  can have optional four digit extension
				case 'ZIP_CODE':
					this.p = /^\d{5}(-\d{4})?$/i;
					this.c = "zip code";
					this.e = "12345,12345-0001,...";
					this.f = null;
					this.v = null;
					this.k = /[0-9\-]|[\b]/i;
					this.valueType = "STRING";
					break;
				
				//us zip code with wild cards
				case 'ZIP_CODE_WITH_WILD_CARD':
					this.p = /^(\d{5}(-\d{4})?)|(\%{0,1}\d{1,4}\%{0,1})$/i;
					this.c = "zip code";
					this.e = "12345,12345-0001,98%,...";
					this.f = null;
					this.v = null;
					this.k = /[0-9\-\%]|[\b]/i;
					this.valueType = "STRING";
					break;
					
				//social security number: NNN-NN-NNNN	
				case 'SSN':
					this.p = /\d{3}-\d{2}-\d{4}/i;
					this.c = "social security number";
					this.e = "555-55-5555";
					this.f = function(objSrc)	{
														var objRegExp = /\d+/g;
														var arrMatches;
														var sFilteredString = "";
														var i;
														
														//If the user has entered a value
														if(objSrc.value.length > 0){
															//filter the string for number only
															arrMatches = objSrc.value.match(objRegExp);

															//concatinate all of the number filtered pieces
															for(i=0; i<arrMatches.length; i++){
																sFilteredString = sFilteredString + arrMatches[i];
															}

															//If the number is greater than 9 characters
															if(sFilteredString.length > 9){
																//truncate the number to 9 numbers
																sFilteredString = sFilteredString.substr(0,9);
															}

															//format the number with a dash
															if(sFilteredString.length > 5){
																sFilteredString = sFilteredString.substr(0,3) + "-" + sFilteredString.substr(3,2) + "-" + sFilteredString.substr(5,sFilteredString.length-5);
															}
															else if(sFilteredString.length > 3){
																sFilteredString = sFilteredString.substr(0,3) + "-" + sFilteredString.substr(3,sFilteredString.length-3);
															}

															//write the formated value back to the text box
															objSrc.value = sFilteredString;
														}
													};
					this.v = null;
					this.k = /[0-9\-]|[\b]/i;
					this.valueType = "STRING";
					break;
				
				//Interest value N.N
				case 'INTEREST':
					this.p = /\d+\.{1}\d+/i; 
					this.c = "interest rate";
					this.e = "7.0, 3.25, 5.5,...";
					this.f = function(objSrc)	{
													//Create a regular expression that looks for the decimal point
													var pattern = /\./i;
														
													//If the user has entered a value
													if(objSrc.value.length > 0){
														//If a decimal point isn't found in the string
														if (!pattern.test(objSrc.value)){
															//append a decimal point and zero to the value
															objSrc.value = objSrc.value += ".0";
														}
														//else if the rightmost character is a decimal point
														else if(objSrc.value.charAt(objSrc.value.length-1) == "."){
															//append a zero to the value
															objSrc.value = objSrc.value += "0";
														}
														
														//if the left most character is a decimal
														if(objSrc.value.charAt(0) == "."){
															//prefix the number with a zero
															objSrc.value = "0" + objSrc.value;
														}
													}
												};
					this.v = null;
					this.k = /[0-9\.]|[\b]/i;
					this.valueType = "FLOAT";
					break;
					
				//Time Value (Minutes Resolution) HH:MM [A|P]M
				case 'TIME':
					this.p = null;
					this.c = "time";
					this.e = "2:45 PM,23:25,12:30:25,...";
					this.k = /[0-9\:aApPmM\s]|[\b]/i;
					this.valueType = "TIME";
					this.f = function(objSrc)	{   //This function formats the time string
									var iMilliseconds;
									var sFormatedDate;
									var datTheDate;
									var sHours;
									var sMinutes;
									var sSeconds;
									var sAMPMIndicator;
									
									//get the string value from the input box
									sFormatedDate = objSrc.value;
									
									//Get today's date
									datTheDate = new Date();
									
									//Format the date with today's date and the time string passed in by the user
									sFormatedDate = (datTheDate.getMonth()+1) + "/" + datTheDate.getDate() + "/" + datTheDate.getFullYear() + " " + sFormatedDate;
									
									//convert the string into a date magnitude
									iMilliseconds = Date.parse(sFormatedDate);
									
									//if a valid time was entered
									if(!isNaN(iMilliseconds)){
										//Set the time to the date object
										datTheDate.setTime(iMilliseconds)
										
										//Determine how to display the hours
										if(datTheDate.getHours() == 0){
											sHours = "12";
											sAMPMIndicator = "AM";
										}
										
										if(datTheDate.getHours() > 0 && datTheDate.getHours() < 12){
											sHours = datTheDate.getHours()
											sAMPMIndicator = "AM";
										}
										if(datTheDate.getHours() == 12){
											sHours = "12"
											sAMPMIndicator = "PM";
										}
										if(datTheDate.getHours() > 12){
											sHours = datTheDate.getHours() - 12
											sAMPMIndicator = "PM";
										}
									
										//Format the minutes string
										sMinutes = datTheDate.getMinutes().toString();
										if(sMinutes.length == 1){
											sMinutes = "0" + sMinutes;
										}
										
										//Format the seconds string
										sSeconds = datTheDate.getSeconds().toString();
										if(sSeconds.length == 1){
											sSeconds = "0" + sSeconds;
										}
										
										//Format the time string properly
										objSrc.value = sHours + ":" + sMinutes + ":" + sSeconds + " " + sAMPMIndicator;
										
										return true;
									}
									else{
										return true;
									}
								}
					this.v = function(sValue, objSrc){//This function validates the time string
									var sFormatedDate;
									var datTheDate;
									var iMilliseconds;
									
									//get the string value from the input box
									sFormatedDate = sValue;
									
									//Get today's date
									datTheDate = new Date();
									
									//Format the date with today's date and the time string passed in by the user
									sFormatedDate = (datTheDate.getMonth()+1) + "/" + datTheDate.getDate() + "/" + datTheDate.getFullYear() + " " + sFormatedDate;
									
									//convert the string into a date/time magnitude
									iMilliseconds = Date.parse(sFormatedDate);
									
									//if a valid time was entered
									if(!isNaN(iMilliseconds)){
										return true;
									}
									else{
										return false;
									}
								}
					break;
					
				//Date value: MM/DD/YYYY	
				case 'DATE':
					this.p = null;
					this.c = "date";
					this.e = "1-12-2001, 10/12/1999,...";
					this.k = /[0-9\/\-]|[\b]/i;
					this.valueType = "DATE";
					this.f = function(objSrc)	{
													var pattern = /\-/g;
													var iMilliseconds;
													var sFormatedDate;
													var dDate = new Date();
													var iMonth = 0;
													var sMonth = "";
													var iDay = 0;
													var sDay = "";

													//MAR  9-6-2001 : Revision - The following variable holds the
													//position of the last slash
													var iLastSlashPos = 0;
													
													//replace the dashes with slashes														
													sFormatedDate = objSrc.value.replace(pattern, '/'); 

													//convert the string into a date magnitude
													iMilliseconds = Date.parse(sFormatedDate);

													//if there was a successful conversion
													if(!isNaN(iMilliseconds)){
														//MAR 9-6-2001 : Added the following code to check for a
														//two digit date. If the year is less than 4 digits, alert the user.
														if(sFormatedDate.length - sFormatedDate.lastIndexOf('/') <= 4){
															alert("Please enter a four digit year.");
															
															return false;
														}
														
														//set the date
														dDate.setTime(iMilliseconds);

														//Get the month number from the date
														iMonth = dDate.getMonth() + 1;
														sMonth = iMonth.toString();

														//If a single digit, prefix it with a zero
														if(sMonth.length == 1){
															sMonth = "0" + sMonth;
														}

														//Get the day of the month
														iDay = dDate.getDate();
														sDay = iDay.toString();

														//If it is a single digit prefix it with a zero
														if(sDay.length == 1){
															sDay = "0" + sDay;
														}

														//Format the value of the input box with the default value
														objSrc.value = sMonth + "/" + sDay + "/" + dDate.getFullYear();
													}
												};

					this.v = function(sValue, objSrc){	
														var sFormatedDate;
														var iMilliseconds;
														var dDate = new Date();
														var pattern = /\-/g;
														
														//Replace the dashes with slashes
														sFormatedDate = sValue.replace(pattern, '/');

														//Convert the date string into a date value
														iMilliseconds = Date.parse(sFormatedDate);

														//If the date string parses
														if(!isNaN(iMilliseconds)){
															//set the date
															dDate.setTime(iMilliseconds);
															
															//If the year is less than 1800
															if(dDate.getFullYear() < 1800){
																return false;
															}
															else{
																return true;
															}
														}
														else{
															return false;
														}
													};
					break;
			
				//MAR 12/3/2002 - Added Date/Time value: MM/DD/YYYY HH:MM:SS AM
				case 'DATE_TIME':
					this.p = null;
					this.c = "date/time";
					this.e = "1-12-2001 12:30 AM, 10/12/1999 7:35:34 PM,...";
					this.k = /[0-9\/\-\:aApPmM\s]|[\b]/i;
					this.valueType = "DATE";
					this.f = function(objSrc)	{
													var pattern = /\-/g;
													var iMilliseconds;
													var sFormatedDate;
													var dDate = new Date();
													var iMonth = 0;
													var sMonth = "";
													var iDay = 0;
													var sDay = "";
													var iHour = 0;
													var sHour = "";
													var iMinute = 0;
													var sMinute = "";
													var iSecond = 0;
													var sSecond = "";
													var sAMPM = ""
													
													//MAR  9-6-2001 : Revision - The following variable holds the
													//position of the last slash
													var iLastSlashPos = 0;
													
													//replace the dashes with slashes														
													sFormatedDate = objSrc.value.replace(pattern, '/'); 

													//convert the string into a date magnitude
													iMilliseconds = Date.parse(sFormatedDate);

													//if there was a successful conversion
													if(!isNaN(iMilliseconds)){
														//MAR 9-6-2001 : Added the following code to check for a
														//two digit date. If the year is less than 4 digits, alert the user.
														if(sFormatedDate.length - sFormatedDate.lastIndexOf('/') <= 4){
															alert("Please enter a four digit year.");
															
															return false;
														}
														
														//set the date
														dDate.setTime(iMilliseconds);
														
														//Get the month number from the date
														iMonth = dDate.getMonth() + 1;
														sMonth = iMonth.toString();

														//If a single digit, prefix it with a zero
														if(sMonth.length == 1){
															sMonth = "0" + sMonth;
														}

														//Get the day of the month
														iDay = dDate.getDate();
														sDay = iDay.toString();

														//If it is a single digit prefix it with a zero
														if(sDay.length == 1){
															sDay = "0" + sDay;
														}
														
														//get the hour of the day
														iHour = dDate.getHours();
														if(iHour == 0){
															sAMPM = "AM"
															sHour = "12";
														}
														else if(iHour < 12){
															sAMPM = "AM"
															sHour = iHour.toString();
														}
														else if(iHour == 12){
															sAMPM = "PM"
															sHour = iHour.toString();
														}
														else{
															sAMPM = "PM"
															iHour = iHour - 12
															sHour = iHour.toString();
														}
														
														//Get the minute
														iMinute = dDate.getMinutes();
														sMinute = iMinute.toString();

														//If it is a single digit prefix it with a zero
														if(sMinute.length == 1){
															sMinute = "0" + sMinute;
														}
														
														//get the seconds
														iSecond = dDate.getSeconds();
														sSecond = iSecond.toString();
														//If it is a single digit prefix it with a zero
														if(sSecond.length == 1){
															sSecond = "0" + sSecond;
														}
														
														//Format the value of the input box with the default value
														objSrc.value = sMonth + "/" + sDay + "/" + dDate.getFullYear() + " " + sHour + ":" + sMinute + ":" + sSecond + sAMPM;

														
													}
												};

					this.v = function(sValue, objSrc){	
														var sFormatedDate;
														var iMilliseconds;
														var dDate = new Date();
														var pattern = /\-/g;
														
														//Replace the dashes with slashes
														sFormatedDate = sValue.replace(pattern, '/');

														//Convert the date string into a date value
														iMilliseconds = Date.parse(sFormatedDate);

														//If the date string parses
														if(!isNaN(iMilliseconds)){
															//set the date
															dDate.setTime(iMilliseconds);
															
															//If the year is less than 1800
															if(dDate.getFullYear() < 1800){
																return false;
															}
															else{
																return true;
															}
														}
														else{
															return false;
														}
													};
					break;
			}
		}

		//Define the Validator class get functions
		DataValidation.prototype.getDataType = function(){return this.d;};
		DataValidation.prototype.getPattern = function(){return this.p;};
		DataValidation.prototype.getCaption = function(){return this.c;};
		DataValidation.prototype.getExample = function(){return this.e;};
		DataValidation.prototype.getFunctionValidate = function(sValue, objSrc)	{
																					if(this.v != null){
																						return this.v(sValue, objSrc);
																					}
																					else{
																						return true;
																					}
																				};
		DataValidation.prototype.getFilterPattern = function(){return this.k;};
		DataValidation.prototype.getValueType = function(){return this.valueType;};
		DataValidation.prototype.getFormatFunction = function(objSrc)	{	if(this.f != null){
																				return this.f(objSrc);
																			}
																		};

		//============  End DataValidation Class definition =======================================
			
		//============  Validator Class definition ===========================================
		//Constructor function
		function Validator(sCaption, sFormName, sElementName, bRequired, objDataValidation, iMin, iMax){
			this.v = false;
			this.c = sCaption;
			this.f = sFormName;
			this.n = sElementName;
			this.r = bRequired;
			this.d = objDataValidation;
			this.o = null;
			this.min = iMin;
			this.max = iMax;
		}
			
		//Define the function that test value against the defined data type.
		Validator.prototype.test = function(sTestValue){															
															var vMax;
															var vMin;
															//alert(sTestValue);
															
															this.v = false;
															
															//If a regular expression hasn't been assigned 	
															if(this.d.getPattern() == null){
																//then validate against the built in function
																this.v = this.d.getFunctionValidate(sTestValue, this.o);
															}
															else{
																//else validate against the regular expression
																this.v = this.d.getPattern().test(sTestValue);
			                                               	}
			                                               	//alert(this.v);
			                                               	
			                                               	//if the input item contains a valid value (then test the max value)
															if(this.v){
																//get the max value from the object
																vMax = this.max;
			
																//If a max value has been set
																if(vMax != null){
																	//determine the type of value
																	switch(this.d.getValueType()){
																		case 'INTEGER':
																			//if vMax is anumber
																			if(isNaN(vMax) == false){
																				//if the test value is greater than the max
																				if(parseInt(sTestValue) > vMax){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'FLOAT':
																			//if vMax is anumber
																			if(isNaN(vMax) == false){
																				//if the test value is greater than the max
																				if(parseFloat(sTestValue) > vMax){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'DATE':
																			//convert the value (string date) into a date
																			vMax = Date.parse(vMax);
																			
																			//If it contained a valid date
																			if(isNaN(vMax) == false){
																				//If the user entered a value greater than the max
																				if(Date.parse(sTestValue) > vMax){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'STRING':
																			//If the test value is greater than the maximum
																			if(sTestValue.length > vMax){
																				//then return false to the caller
																				this.v = false;
																			}
																			break;
																	}
																}
															}
															
															//if the input item still contains a valid value (then test the min value)
															if(this.v){
																//get the max value from the object
																vMin = this.min;
			
																//If a max value has been set
																if(vMin != null){
																	//determine the type of value
																	switch(this.d.getValueType()){
																		case 'INTEGER':
																			//if vMin is anumber
																			if(isNaN(vMin) == false){
																				//if the test value is less than the max
																				if(parseInt(sTestValue) < vMin){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'FLOAT':
																			//if vMin is a number
																			if(isNaN(vMin) == false){
																				//if the test value is greater than the max
																				if(parseFloat(sTestValue) < vMin){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'DATE':
																			//convert the value (string date) into a date
																			vMin = Date.parse(vMin);
																			
																			//If it contained a valid date
																			if(isNaN(vMin) == false){
																				//If the user entered a value less than the min
																				if(Date.parse(sTestValue) < vMin){
																					//then return false
																					this.v = false;
																				}
																			}
																			break;
																		case 'STRING':
																			break;
																	}
																}
															}
															return this.v;
														}
			
		//Define the function that filters keystrokes for a given validator
		Validator.prototype.filter = function(sChar){
														//If a filter pattern has been defined 

														if(this.d.getFilterPattern() != null){
															//test this character against the filter regular expression
															return this.d.getFilterPattern().test(sChar);

														}
														else{
															return true;
														}
													}
		//Define the Validator class get functions
		Validator.prototype.getValid = function(){return this.v;};
		Validator.prototype.getCaption = function(){return this.c;};
		Validator.prototype.getElementName = function(){return this.n;};
		Validator.prototype.getRequired = function(){return this.r;};
		Validator.prototype.getDataValidator = function(){return this.d;};
		Validator.prototype.getSource = function(){return this.o;};
		Validator.prototype.getFormName = function(){return this.f;};
		Validator.prototype.getMax = function(){return this.max;};
		Validator.prototype.getMin = function(){return this.min;};
		
		
		//Define the Validator set functions
		Validator.prototype.setValid = function(bValid){this.v = bValid;};
		Validator.prototype.setCaption = function(sCaption){this.c = sCaption;};
		Validator.prototype.setElementName = function(sElementName){this.n = sElementName;};
		Validator.prototype.setRequired = function(bRequired){this.r = bRequired;};
		Validator.prototype.setDataValidator = function(objDataValidator){this.d = objDataValidator;};
		Validator.prototype.setSourceObject = function(objSrc){this.o = objSrc;};

		//============  End Validator Class definition =======================================

		//Add an inirtialization statement to the array of initialization statements
		function addInitialization(sInitialization){
			//Add the initialization string to the array of staements to be run when the page is initialized
			arrInitializationCodes[arrInitializationCodes.length] = sInitialization;	
		}
		
		//Adds the validation object for a form element to the validation array
		function addElementToValidationArray(sCaption, sFormName, sSourceName, bRequired, sDataType){

			//Get the element that is to be validated
			var checkFormElement = document.forms[sFormName].elements[sSourceName];

			//If this element wasn't found on the form
			if(checkFormElement == null){
				//Print a message letting the developer know something is wrong.
				alert('Input Element Not found\nForm: ' + sFormName + '\nElement: ' + sSourceName);
				return false;
			}
			
			// ds - 10-31-2001 	- fixed to work on ie4
			//if (checkFormElement.value == undefined){
			if ((checkFormElement.type + '') == 'undefined'){
				//alert('found it');
	
				tmpFormName = sFormName;
				tmpElementName = sSourceName;
				//
				//alert(tmpFormName + "  " + tmpElementName);

			}

			var iMin = null;
			var iMax = null;

			if(arguments.length > 5){
				iMin = arguments[5];
			}
			
			if(arguments.length > 6){
				iMax = arguments[6];
			}
			arrValidData[arrValidData.length] = new Validator(sCaption, sFormName, sSourceName, bRequired, sDataType, iMin, iMax);

			//tmp = objSrc ;

			//alert(tmp);
		}


	//Data Validation Function - This function loops through all of the enabled elements of the array
	//and outputs an alert message if any of the elements on the form
	//contain invalid data. If the bExtraValidation contains a true
	//then validation occurs on the form level.  If it contains
	//false, then the function assumes there is problems on the form
	//and skips validation of the form elements
	function checkData(objFormToValidate, bExtraValidation){


		var sMessage = "";
		var iProblemNumber = 0;
		var sExample = "";

		//MAR 12/4/2002 - Added these variables to allow for content character checking
		var iForm;
		var iElement;
		var objForm;
		var objElement;
		var sText;
		var objREMatch = /\%u/gi;
		var arrMatches;
		var bInvalidCharacters = false;
		
		//If the extra validation parameter is true
		if(bExtraValidation){

			// Loop through all of the validator objects
			for (var i = 0; i < arrValidData.length; i++){

				//MAR 10/23/2002 - If the client validation is setup to validate disabled elements
				//or the element is currently enabled
				if(gbValidateDisabledElements == true || objFormToValidate.elements[arrValidData[i].getElementName()].disabled == false){

					//If this element is a member of the form being validated
					if(objFormToValidate.elements[arrValidData[i].getElementName()] != null){
						
						//Test the value of this form element
						validateData(objFormToValidate.elements[arrValidData[i].getElementName()]);
					
						//check to see if the incoming element's attribute 'value' is 'undefined' ...i.e. "it's a checkbox"
						// ds - 10-31-2001 	- fixed to work on ie4
		//	Old Code	if(objFormToValidate.elements[arrValidData[i].getElementName()].value == undefined){
						if((objFormToValidate.elements[arrValidData[i].getElementName()].type+'') == 'undefined'){


						// set the tmpElementName back to the element we are checking
						tmpElementName = arrValidData[i].getElementName();

							//set up counter to track number of checkboxes we've already looked at
							var iCount2 = 0;

							//get the object
							
//							var checkbox = document.forms(tmpFormName).item(tmpElementName);
//							var checkbox = document.all(tmpElementName);
							
							// [dbh] changed for cross-browser compatibility
							var checkbox = document.forms[tmpFormName].elements[tmpElementName];
							
							//loop through the checkboxes
							for (iCount1 = 0;iCount1 < checkbox.length; iCount1++){

								// if they are not checked 
								if (!checkbox[iCount1].checked){
									//increment the counter
									iCount2 += 1;
									//if the number unchecked equals the total number	
									if((iCount2 == checkbox.length) && (iCount1 == (checkbox.length - 1))){
								
										//Increment the problem number
										iProblemNumber++;
								
										//Add this to the list of problems on the page
										sMessage = sMessage + iProblemNumber.toString() + ")\t" + "The " + arrValidData[i].getCaption() + " is a required field.  Please enter a value.\n";
								
							
									}
								}
							}
						}							

						//if the element is not a checkbox
						else{

							//If this element requires a value and the value is empty
							if (arrValidData[i].getRequired() == true && objFormToValidate.elements[arrValidData[i].getElementName()].value.length == 0) {
								//Increment the problem number
								iProblemNumber++;
								
								//Add this to the list of problems on the page
								sMessage = sMessage + iProblemNumber.toString() + ")\t" + "The " + arrValidData[i].getCaption() + " is a required field.  Please enter a value.\n";
							}
							else{
								//if the length is greater than zero
								if(objFormToValidate.elements[arrValidData[i].getElementName()].value.length > 0){
									//Make sure this element contains a valid value
									if (arrValidData[i].getValid() == false){
										//Increment the problem number
										iProblemNumber++;
								
										//If the min and max are both null
										if((arrValidData[i].getMax() == null) && (arrValidData[i].getMin() == null)){
											sExample = "eg: " + arrValidData[i].getDataValidator().getExample();
										}
										else{
											//if a min value has been set
											if(arrValidData[i].getMin() != null){
												sExample = ">=" + arrValidData[i].getMin();
												//if a max value has also been set
												if(arrValidData[i].getMax() != null){
													//put the word and between the two values
													sExample = sExample + " and "
												}
											}

											//If a max value has been set
											if(arrValidData[i].getMax() != null){
												sExample = sExample + "<=" + arrValidData[i].getMax();
											}
										}
									
										//Add this problem to the list of problems
										sMessage = sMessage + iProblemNumber.toString() + ")\t" + "The " + arrValidData[i].getCaption() + " requires a value of: " + arrValidData[i].getDataValidator().getCaption() + " (" + sExample + ").\n";
									}
								}
							}
						}
					}
				}
			}
			//If there are problems in the form
			if (sMessage.length > 0){
				//Let the user know
				alert("The following is a list of form data problems:\n" + sMessage + "\n");
				return false;
			}
			else{
				//MAR 12/04/2002 - If the caller has enabled character checking
				if(gbValidateTextCharacters){
					//MAR 12/04/2002 - Added check for all elements of the form
					for(iForm = 0; iForm < document.forms.length; iForm++){
						//get the form object
						objForm = document.forms[iForm];

						//for each element on this form
						for(iElement = 0; iElement < objForm.elements.length; iElement++){
							//get the element
							objElement = objForm.elements[iElement];
						
							//if this is an element that requires content checking (text or text area)
							if(objElement.type == 'text' || objElement.type == 'textarea'){
								//escape the data
								sText = escape(objElement.value);

								//This check is for Netscape 6.2 and earlier.  Apparantly when we tested with
								//Netscape 6.2, the unescape function stops processing after the first
								//invalid character it finds.  As a result, the emaining code doesn't work
								//because only the first part of the string is returned from the unescape function.
								//This function may be fixed in later versions of the Netscape browser.
								//For now, Netscape users will be unable to enter smart quotes into
								//the text box.
								if(objElement.value.length != unescape(sText).length){
									//set the invalid character flag
									bInvalidCharacters = true;	
								}
								//else, the unescape function worked properly
								else{
									//replace all of the known invalid characters, valid characters
									sText = sText.replace(/\%u201C/gi,'%22');
									sText = sText.replace(/\%u201D/gi,'%22');
									sText = sText.replace(/\%u2019/gi,'%27');
									sText = sText.replace(/\%u2026/gi,'...');
									sText = sText.replace(/\%u2014/gi,'-');
							
									// ===== ADD MORE KNOWN CHARACTERS HERE =====

									//search for other invalid characters
									arrMatches = sText.match(objREMatch);

									//if invalid characters where still found in the data
									if(arrMatches != null){
										//set the invalid characters flag
										bInvalidCharacters = true;
									}
								
									//unescape the data
									sText = unescape(sText);

									//write fixed data back to the element							
									objElement.value = sText;
								}
							}
						}
					}
				}
				
				//if invalid characters where found
				if(bInvalidCharacters){
					//output an error message to the user
					alert('Invalid characters where found in some of the data.\nPlease fix them before submitting the data.');
					return false;
				}
				

			
				//If the caller has supplied some extra validation code
				if (ExtraValidationFunction != null){
					//run the validation code
					return ExtraValidationFunction();
				}
				else{
					return true;
				}
			}
		}
		//Else, the extra validation parameter was false
		else{
			return false;
		}
				
	}

	//Data Validation Function - This function initializes data validation.  It needs to be called from the BODY onLoad event.
	function initializeValidation(){
		var objSrc;
		var isNavName;
		var iInit;

		if(navigator.appName == "Microsoft Internet Explorer"){
			isNavName = "IE";
		}
		else{
			isNavName = "Navigator";
		}
		
		//determine the browser being used
		if(isNavName == "IE"){
			isNav = false;
			isIE = true;	
		}
		else{
			isNav = true;
			isIE = false;
		}

		//If the user has setup a initializevalidation function
		if(initializeValidationElements != null){
			//setup all of the 
			initializeValidationElements();
		}
		
		//loop through all of the forms
		for(iInit = 0;iInit < arrInitializationCodes.length; iInit++){
			eval(arrInitializationCodes[iInit]);
		}	
		//loop through each data validator object
		for(var i = 0; i < arrValidData.length; i++){
			objSrc = document.forms[arrValidData[i].getFormName()].elements[arrValidData[i].getElementName()];
			//===== DEBUG CODE: THIS CAN BE REMOVED ONCE TESTING IS COMPLETE =====
			//if(objSrc == null){
			//	alert("Javascript Error!");
			//	alert("Couldn't find the following source element:\nForm: " + arrValidData[i].getFormName() + "\nElement:" + arrValidData[i].getElementName());
			//}
			//====================================================================
			objSrc.onkeypress = function(event){return filterKeystrokes(this, event);self.focus();};
			objSrc.onchange = function(){return getArrayElement(this.name).getDataValidator().getFormatFunction(this);};

			//if(isNav){
			//	objSrc.addEventListener("keypress",filterKey,true);
			//}
			//else{
			//	objSrc.onkeypress = function(event){return filterKeystrokes(this, event);self.focus();};
			//}

			//set the object to the data validator
			arrValidData[i].setSourceObject(objSrc);

			//=== DEBUG CODE =====
			//var checkbox = document.forms[0].item(checkboxName);
			//alert(objSrc.name);
		
		}
	}

	//Data Validation Function - Returns the array element for a given control name
	function getArrayElement(sElementName){
		//loop through each item in the array
		for (var i = 0; i < arrValidData.length; i++){
			//If a match is found
			if (arrValidData[i].getElementName() == sElementName){

				//Return the array element and stop searching
				return arrValidData[i];
				break;
			}
		}
	}

	//Data Validation Function - Validates the data for a given control element.
	//objSrc - contains a pointer to the current object.
	function validateData(objSrc){
		var arrElement;

		//Get this data validator array element
		arrElement = getArrayElement(objSrc.name);

		//If the array element was found								
		if (arrElement != null){
			//test the value of the form element
			arrElement.test(objSrc.value);

			//MAR 7/29/2002 - return the result of the test
			return arrElement.getValid();
		}
	}
	
	//function filterKey(evt){
	//	evt.preventDefault();
	//}
	
	
	//Data Validation Function - This function filters out non-integer keypresses
	function filterKeystrokes(objSrc, evt){
				
		var iKeyCode;
		var sChar;

		//If this is netscape navigator
		if (isNav) {
			iKeyCode = evt.which;
		}
		//else, assume IE
		else{
			iKeyCode = window.event.keyCode;
		}
				
		//Convert the keycode into a character
		sChar = String.fromCharCode(iKeyCode);

		//Get this data validator array element
		arrElement = getArrayElement(objSrc.name);

		//If the array element was found
		if (arrElement != null){

			//MAR 5/2/2002 Test the length of the string
			if(arrElement.d.getValueType() == 'STRING'){
				//if a max length is setup
				if(arrElement.getMax() != null && arrElement.getMax() > 0){

					if(objSrc.value.length >= arrElement.getMax()){
						objSrc.value = objSrc.value.substr(0,arrElement.getMax());
						return false;
					}	
				}
			}
			//filter the value of the form element
			return arrElement.filter(sChar);

		}
		else{

			return true;

		}
	}
	
	function removeCommas( strValue ) {
		var objRegExp = /,/g; //search for commas globally
 
		//replace all matches with empty strings
		return strValue.replace(objRegExp,'');
	}


	function addCommas( strValue ) {
		
		var objRegExp  = new RegExp('(-?[0-9]+)([0-9]{3})'); 

		//check for match to search criteria
		while(objRegExp.test(strValue)) {
			//replace original string with first group match, 
			//a comma, then second group match
			strValue = strValue.replace(objRegExp, '$1,$2');
		}
		return strValue;
	}
			
	//Added by JB 10-12-01
	function validateCheckboxes(checkboxName, formName){

		//set up counter to track number of checkboxes we've already looked at
		var iCount = 0;

		//get the object
		var checkbox = document.forms[0].item(checkboxName);

		//loop through the checkboxes
		for (i = 0;i < checkbox.length; i++){
			// if they are not checked 
			if (!checkbox[i].checked){
				//increment the counter
				iCount += 1;
				//if the number unchecked equals the total number	
				if((iCount == checkbox.length) && (i == (checkbox.length - 1))){
					//alert the user
					alert("Please choose an Advertiser");
					
				validateData(checkbox);
					
					return true;
				}
			}
		}
	};

//-->