/*
	Module Name:- Become model
	File Name  :- become_model.js
	Create Date:- 9-June-2006
	Intially Create By :- 0017
	Update History:
*/
function frm_model_validate_add()
{
	with(document.frm_model)
	{
		if(isEmpty(txt_name.value))
		{
			alert("Please enter name.");
			txt_name.select();
			txt_name.focus();
			return false;
		}
		if(isEmpty(txt_location.value))
		{
			alert("Please enter location.");
			txt_location.select();
			txt_location.focus();
			return false;
		}
		if(isEmpty(txt_age.value))
		{
			alert("Please enter age.");
			txt_age.select();
			txt_age.focus();
			return false;
		}
		if(isNaN(txt_age.value))
		{
			alert("Please enter numeric value for age.");
			txt_age.select();
			txt_age.focus();
			return false;
		}
		if(txt_age.value < 18)
		{
			alert("Please enter positive integer greater than 18 for age.");
			txt_age.select();
			txt_age.focus();
			return false;
		}
		if(isEmpty(txt_ethnic.value))
		{
			alert("Please enter ethnicity.");
			txt_ethnic.select();
			txt_ethnic.focus();
			return false;
		}
		if(isEmpty(txt_email.value))
		{
			alert("Please enter email.");
			txt_email.select();
			txt_email.focus();
			return false;
		}
		if (!sValidateMailAddress(txt_email.value))
		{
			alert("Please enter valid email address: Format: emailid@domainname.com");
			txt_email.select();
			txt_email.focus();
			return false;
		}
		if(isEmpty(txt_phone.value))
		{
			alert("Please enter phone number.");
			txt_phone.select();
			txt_phone.focus();
			return false;
		}
		if(txt_url.value=="")
		{
			if((file_head.value=="")&&(file_body.value==""))
			{
				alert("Please enter either url or head and body image or both");
				return false;
			}
		}
		if(txt_url.value!="")
		{
			if(!isValidUrl(txt_url.value))
			{
				txt_url.select();
				txt_url.focus();
				return false;			
			}
		}
		if(trim(file_head.value) != "")
		{
			if(!checkExt(trim(file_head.value)))
			{
				file_head.select();
				file_head.focus();
				return false;
			}
		}
		if(trim(file_body.value) != "")
		{
			if(!checkExt(trim(file_body.value)))
			{
				file_body.select();
				file_body.focus();
				return false;
			}
		}
		if((ta_interest.value.length) > 1024)
		{
			alert("Maximum 1024 character can be entered.");
			ta_interest.select();
			ta_interest.focus();
			return false;
		}
		if(isEmpty(txt_referred.value))
		{
			alert("Please enter referred.");
			txt_referred.select();
			txt_referred.focus();
			return false;
		}


//		if(isEmpty(trim(txt_code.value)))
//		{
//			alert("Please enter secret code.");
//			txt_code.select();
//			txt_code.focus();
//			return false;
//		}

}
	return true;
}
