/*
	Module Name:- modModelSearch
	File Name  :- mdl_add.js
	Create Date:- 27-FEB-2006
	Intially Create By :- 0023Shivani
	Update History:
*/

function frm_validate()
{
	with(document.frm_mdl_app)
	{
		if(trim(txtname.value) == "")
		{
			alert("Please enter model name.");
			txtname.select();
			txtname.focus();
			return false;
		}
		if(trim(cbo_hfeet.value) == "")
		{
			alert("Please select height in feet.");
			cbo_hfeet.focus();
			return false;
		}
		if(trim(cbo_hinch.value) == "")
		{
			alert("Please select height in inch.");
			cbo_hinch.focus();
			return false;
		}
		if(trim(cbo_wlbs.value) == "")
		{
			alert("Please select weight.");
			cbo_wlbs.focus();
			return false;
		}
		if(trim(cbo_ms1.value) == "")
		{
			alert("Please select bust size.");
			cbo_ms1.focus();
			return false;
		}
		if(trim(cbo_ms2.value) == "")
		{
			alert("Please select cup size.");
			cbo_ms2.focus();
			return false;
		}
		if(trim(cbo_ms3.value) == "")
		{
			alert("Please select waist size.");
			cbo_ms3.focus();
			return false;
		}
		if(trim(cbo_ms4.value) == "")
		{
			alert("Please select hip size.");
			cbo_ms4.focus();
			return false;
		}
		if(trim(cbo_age.value) == "")
		{
			alert("Please select age.");
			cbo_age.focus();
			return false;
		}
		if(trim(txtethnic.value) == "")
		{
			alert("Please enter ethnicity.");
			txtethnic.select();
			txtethnic.focus();
			return false;
		}
		if(trim(txtloct.value) == "")
		{
			alert("Please enter city.");
			txtloct.select();
			txtloct.focus();
			return false;
		}
		if(trim(txtemail.value) == "")
		{
			alert("Please enter email address.");
			txtemail.select();
			txtemail.focus();
			return false;
		}
		if(sValidateMailAddress(trim(txtemail.value)) == false)
		{
			alert("Please enter valid email address. Format:email@domain.com");
			txtemail.select();
			txtemail.focus();
			return false;
		}
		if(trim(txtphone.value) == "")
		{
			alert("Please enter phone number.");
			txtphone.select();
			txtphone.focus();
			return false;
		}
		
		/// Validate that Atleast one Skill selected
		var i,flagCheck,int_arr_ubound;
		 flagCheck = false;	 
		 int_arr_ubound = elements['cb_skill[]'].length;	 
		 if(int_arr_ubound)
		 {
			 for(i=0;i<int_arr_ubound;i++)
			 {
				if(elements['cb_skill[]'][i].checked)
				{
					flagCheck = true;			
				}
			 }	 
		 }
		 else
		 {
		 		 if(elements['cb_skill[]'].checked)
				 {
					flagCheck = true;			
				 } 
		 }
		if(flagCheck==false)
		{
			alert("Please select at least one work availibility & skills.");
			return false;
		}
		//////////////////////////////////////////////////////////////		
		/// Validate that Atleast one Cover Interest selected
		 var i,flagCheck,int_arr_ubound;
		 flagCheck = false;	 
		 int_arr_ubound = elements['cb_skillcover[]'].length;	 
		 if(int_arr_ubound)
		 {
			 for(i=0;i<int_arr_ubound;i++)
			 {
				if(elements['cb_skillcover[]'][i].checked)
				{
					flagCheck = true;			
				}
			 }	 
		 }
		 else
		 {
		 		 if(elements['cb_skillcover[]'].checked)
				 {
					flagCheck = true;			
				 } 
		 }
		if(flagCheck==false)
		{
			alert("Please select at least one Cover Interests");
			return false;
		}
		
		/*if(trim(txturl.value) == "")
		{
			alert("Please enter Website and/or url.");
			txturl.select();
			txturl.focus();
			return false;			
		}

		if(isValidUrl(trim(txturl.value)) == false)
		{
			txturl.select();
			txturl.focus();
			return false;
		}*/

		if(trim(file_head_image.value) == "")
		{
			alert("Please select main image.");
			file_head_image.select();
			file_head_image.focus();
			return false;
		}
		else
		{
			if(checkExt(trim(file_head_image.value))==false)
			{
				file_head_image.select();
				file_head_image.focus();
				return false;
			}
		}
		
		if(trim(txt_purl1.value) != "")
		{
			if(isValidUrl(trim(txt_purl1.value)) == false)
			{
				txt_purl1.select();
				txt_purl1.focus();
				return false;
			}
		}
		
		if(trim(file_body_image.value) == "")
		{
			alert("Please select image #2.");
			file_body_image.select();
			file_body_image.focus();
			return false;
		}
		else
		{
			if(checkExt(trim(file_body_image.value))==false)
			{
				file_body_image.select();
				file_body_image.focus();
				return false;
			}
		}
		
		if(trim(txt_purl2.value) != "")
		{
			if(isValidUrl(trim(txt_purl2.value)) == false)
			{
				txt_purl2.select();
				txt_purl2.focus();
				return false;
			}
		}
		
//		if(trim(txt_code.value)=="")
//		{
//			alert("Please enter secret code.");
//			txt_code.select();
//			txt_code.focus();
//			return false;
//		}
		if(chkagree.checked == false)
		{
			alert("Please read and understand the terms & conditions for participating in competition.\nThen check the check box for agreement.");
			chkagree.focus();
			return false;
		}
	}
	return true;
}
