<!-- Begin

function validateform(which) {
	var msg = ""
	var check = ""
	var counter = 0
	with(document.form2){
	

		var txtName = new Array(7);
			txtName[0] = "UserName";
			txtName[1] = "Password";
			txtName[2] = "PasswordConfirm";
			txtName[3] = "FirstName";
			txtName[4] = "LastName";
			txtName[5] = "Age";
			txtName[6] = "Email";
		
		var errName = new Array(7);
			errName[0] = "User Name";
			errName[1] = "Password";
			errName[2] = "Password Confirm";
			errName[3] = "First Name";
			errName[4] = "Last Name";
			errName[5] = "Age";
			errName[6] = "Email";

	
	
		for(var x=0; x < 7; x++){
			check = "document.form2." + txtName[x] + ".value";
			if (eval(check) == ""){msg = msg + errName[x] + " is a required field.\n";}
		}


		if ((Password.value!="")&&(PasswordConfirm.value!="")) {
			if(Password.value != PasswordConfirm.value) {msg += "The Password and Confirm Password fields msut be identical.\n";}
		}

		if(Age.value!=""){
			if(IsNumeric(Age.value) == false){msg += "The Age must be numeric.\n";}
		}


		//////////////////////////////////////////////////////////////////
		//Check the email format
		if(Email.value != ""){
			var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})(;([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4}))*$/;
			if (!filter.test(Email.value)) {msg += "The Email Address is not a correct format.\n"}
		}
		//////////////////////////////////////////////////////////////////


		


		//////////////////////////////////////////////////////////////////
		//print the msg or submit the function
		if(msg!=""){
			alert(msg);
			return false;
		}else{
			return true;
		}
		//////////////////////////////////////////////////////////////////
	}
}


//-----------------------------------------------------

//function to check for numeric string
function IsNumeric(sText){
	var ValidChars = "0123456789";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++){
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) {
			IsNumber = false;
        }
	}
	return IsNumber;
}



//-->

