/*
	Module Name:- Be a Photographer
	File Name  :- be_photographer.js
	Create Date:- 03-Oct-2006
	Intially Create By :- 0014
	Update History:
*/

function frm_validate()
{
	with(document.frm_app)
	{
		if(trim(txtname.value) == "")
		{
			alert("Please enter photographer name.");
			txtname.select();
			txtname.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(txturl.value) == "")
		{
			alert("Please enter website url");
			txturl.focus();
			return false;				
		}
		else
		{
			if(isValidUrl(trim(txturl.value)) == false)
			{
				txturl.select();
				txturl.focus();
				return false;
			}
		}
		if(trim(file_head_image.value) == "")
		{
			alert("Please select photographer photograph # 1.");
			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(file_head_image1.value) == "")
		{
			alert("Please select photographer photograph # 2.");
			file_head_image1.focus();
			return false;
		}
		else
		{
			if(checkExt(trim(file_head_image1.value))==false)
			{
				file_head_image1.select();
				file_head_image1.focus();
				return false;
			}
		}
		
		if(trim(ta_desc.value) == "")
		{
			alert("Please enter background details.");
			ta_desc.focus();
			return false;
		}
				
		 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 photography types.");
			return false;
		}		

	
		//if(trim(txt_code.value) == "")
		//{
		//	alert("Please enter secret code.");
		//	txt_code.focus();
		//	return false;
		//}
		
		if(chk_agree.checked == false)
		{
			alert("Please read the site terms & conditions agree to the terms specified.");
			chk_agree.focus();
			return false;
		}
	}
	return true;
}

function show_details(url)
{
	window.open(url,'siteterms','left=50,top=20,scrollbars=yes,width=630,height=550,resizable=yes');
	return false;
}