
function validate_Reg(Theform)
{

if(!IsNumeric('User_id',Theform))
	return false;

if((Theform.user_type.checked==false)&&(Theform.user_type1.checked==false)&&(Theform.user_type2.checked==false)){
alert("please Select the types of trainings you'd like to provide to PHII students");
Theform("user_type").focus();
return(false);
}

if(Theform.user_type1.checked==true){
if (Theform.Exist.value == 0) {
		var msg;
		if (Theform.user_type1.value == 4) {
			msg = "There is no Course currently offered in any of the Facility.\n" ;
			msg = msg + "Please try registering in this user type later on." ;
		}
		alert(msg);
		return(false);
	}
else if (!check(Theform, 'FacilityCodes', 'Class Room Facility Name', 3, 20, 'dropdown', 'mandatory'))
	return(false);
}	
	
if(Theform.user_type2.checked==true){
if (Theform.Exist1.value == 0) {
		var msg;
		 if (Theform.user_type2.value == 5) {
			msg = "There is no Seminar currently offered in any of the Facility.\n" ;
			msg = msg + "Please try registering in this user type later on." ;
		}		
		alert(msg);
		return(false);
	}
else if(!check(Theform, 'SEFacilityCodes', 'Seminar Facility Name', 3, 20, 'dropdown', 'mandatory'))
	return(false);
}

if(!check(Theform, 'Fname','First Name', 1, 30, 'characters','\' ', 'mandatory'))
	return(false);

if(!check(Theform, 'Lname','Last Name ', 1, 30, 'characters','\' ', 'mandatory'))
		return(false);

if(!check(Theform, 'DOB_MM','Date of Birth - Month', 3, 20, 'dropdown', 'mandatory'))
	return(false);	

if(!check(Theform, 'DOB_DD','Date of Birth - Day', 3, 20, 'dropdown', 'mandatory'))
	return(false);	
	
DOB_MM = Theform("DOB_MM").value;
DOB_DD = Theform("DOB_DD").value;

DOB = DOB_MM + "/" + DOB_DD //+ "/" + DOB_YYYY;

if(DOB_MM==2){
		if(DOB_DD>29){
			alert("Please enter valid Birth date...");
			Theform("DOB_DD").focus();
			return(false);
		}
	else {
		if(DOB_DD>28){
			alert("Please enter valid Birth date...");
			Theform("DOB_DD").focus();
			return(false);
		}
	}
}
else if(DOB_MM==4 | DOB_MM==6 | DOB_MM==9 | DOB_MM==11) {
	if (DOB_DD>30) {
		alert("Please enter valid Birth date...");
		Theform("DOB_DD").focus();
		return(false);
	}
}

if(!check(Theform, 'Email','Email Address', 5, 200, 'email', '_-', 'mandatory'))
		return(false);
if(!check(Theform, 'Phone','Phone', 5, 20, 'digits','ex- ()+_', 'mandatory'))
		return(false);
if(!check(Theform, 'cell','Cell Phone', 5, 20, 'digits', 'ex- ()+_','optional'))
		return(false);
if(!check(Theform, 'fax','Fax no', 5, 20, 'digits', 'ex- ()+_','optional'))
		return(false);
if(!check(Theform, 'work','Work phone', 5, 20, 'digits', 'ex- ()+_','optional'))
		return(false);
if(!check(Theform, 'Address','Address', 5, 400, 'none', 'mandatory'))
		return(false); 
		if(Theform("country").value==0){
alert("please select country");
return(false);
}	
if(!check(Theform, 'City','City', 2, 50, 'characters', ' -_', 'mandatory'))
		return(false);		
if(!check(Theform, 'State','State', 3, 20, 'dropdown', 'mandatory'))
	return(false);		
if(!check(Theform, 'Zip','Zip', 5, 10, 'characters', '1234567890 _-', 'mandatory'))
		return(false);

if(!check(Theform, 'CmpName','Company Name', 3, 100, 'characters', '1234567890, ./&', 'mandatory'))
		return(false);
if(!check(Theform, 'CmpPhone','Phone', 5, 20, 'digits','ex- ()+_', 'mandatory'))
		return(false);
if(!check(Theform, 'CmpCity','City', 2, 50, 'characters', ' ', 'mandatory'))
		return(false);

if(!check(Theform, 'CmpState','State', 3, 20, 'dropdown', 'mandatory'))
	return(false);		

if(!check(Theform, 'CmpState','State', 2, 20, 'dropdown', 'mandatory'))
		return(false);
if(!check(Theform, 'CmpAddress','Company Address', 5, 400, 'none', 'mandatory'))
		return(false);
if(!check(Theform, 'Cmpzip','Zip', 5, 10, 'characters', '1234567890 _-', 'mandatory'))
		return(false);

if(!check(Theform, 'Tuition','Tuition', 1, 4, 'characters', '1234567890', 'mandatory'))
		return(false);
		
if(Theform('CmpEducationalBackground').value==""){
		alert("Educational Background field is required.");
		Theform('CmpEducationalBackground').focus();
		return(false);
}else if ( Theform('CmpEducationalBackground').value.length > 8000) {
	alert("Educational Background should not be more then 8000.");
	Theform('CmpEducationalBackground').focus();
	return(false);
}

if(Theform('CmpExperience').value==""){
		alert("Experience field is required.");
		Theform('CmpExperience').focus();
		return(false);
}else if ( Theform('CmpExperience').value.length > 8000) {
	alert("Professional Experience should not be more then 8000.");
	Theform('CmpExperience').focus();
	return(false);
}
//if(Theform('cmpSkills').value==""){
//		alert("Skills field is required.");
//		Theform('cmpSkills').focus();
//		return(false);
//}else if (Theform('cmpSkills').value.length > 8000) {
//	alert("Skills should not be more then 8000 characters.");
//	Theform('cmpSkills').focus();
//	return(false);
//}

if (Theform('ExistingUser_Type').value == "") {
	if (Theform('ExistingUser_Type').value == "") {
		if(!check(Theform, 'User_id','User id', 4, 70, 'characters', '1234567890_', 'mandatory'))
				return(false);
		if(!check(Theform, 'Password','Password', 6, 15, 'characters', '1234567890', 'mandatory'))
				return(false);
		if(!check(Theform, 'A_Password','Re-type Password ', 6, 15, 'characters', '1234567890', 'mandatory'))
				return(false);

		if (Theform.Password.value != Theform.A_Password.value)  {
			alert("Given passwords do not match. Please re-type your password and then try again.");
			return(false);
		}
	}
}
Theform.action = 'Agreement.asp';
Theform.submit();
return(true);
}		

