//###################################### FILE : CHECKFORM.JS #######################################
//# CREATE BY		: 	BizPotential Developer Team.
//# COMPANY			:	BizPotential Co.,Ltd.
//# JS VERSION		: 	1.2 or UP Level Version.
//# PROJECT			: 	ASAHITHAI.COM
//# CODE VERSION	: 	CHECKFORM.JS
//# CODE UPDATE	: 	None
//# FILE NAME			: 	CHECKFORM.JS
//# LICENSE				: 	BizPotential Co.,Ltd.
//######################################################################################################

//###################################### FUNCTION checkform(frm) ############################################
//# FUNCTION NAME			:	checkform(frm)
//# PHP Version					:	1.2 and Up
//# Create Data					:	4 October 2004
//# Last Update					:	4 October 2004
//# Class Desc					:	
//#######################################################################################################
	function checkform(frm)
	{    
		var u=0;
		var y=0;
		if(frm.FNameTh.value=='')
		{
			alert("โปรดกรอกชื่อภาษาไทย");
			frm.FNameTh.focus();
			return false;
		}else
		if(frm.LastnameTh.value=='')
		{
			alert("โปรดกรอกนามสกุลภาษาไทย");
			frm.LastnameTh.focus();
			return false;
		}else
	    if(frm.FNameEng.value=='')
		   {
			   alert("โปรดกรอกชื่อภาษาอังกฤษ");
			   frm.FNameEng.focus();
			   return false;
		   }else 
		if(frm.LastnameEng.value=='')
		{
			alert("โปรดกรอกนามสกุลภาษาอังกฤษ");
			frm.LastnameEng.focus();
			return false;
	   }else	
		if(frm.Age.value=='')
		{
			alert("โปรดกรอกอายุ");
			frm.Age.focus();
			return false;
	  }else 
	 
	   if(frm.Address.value=='')
	   {
		   alert("โปรดกรอกที่อยู่");
		   frm.Address.focus();
		   return false;
	   }else
		if(frm.Moo.value=='')
		{
		   alert("โปรดกรอกชั้นหรือหมู่");
		   frm.Moo.focus();
		   return false;
		}else
	 	if(frm.Soi.value=='')
		{
		   alert("กรุณากรอกชื่อตรอก/ซอย");
		   frm.Soi.focus();
			return false; 
		}else
		if(frm.Road.value=='')
		{
		   alert("กรุณากรอกชื่องถนน");
		   frm.Road.focus();
			return false; 
		}else
		if(frm.State.value=='')
		{
		   alert("กรุณากรอกตำบล/แขวง");
		   frm.State.focus();
			return false; 
		}else
	   if(frm.Amphur.value=='')
		{
			alert("กรุณากรอกชื่ออำเภอ ");
			 frm.Amphur.focus();
			return false;
		}else
		if(frm.province_sel.value=='0')
		{
			alert("กรุณากรอกชื่อจังหวัด");
			return false;
		}else
		if(frm.Zipcode.value=='')
		{
			alert("กรุณากรอกรหัสไปรษณีย์");
			frm.Zipcode.focus();
			return false; 
		}else
	   if(frm.Telephone.value=='')
	   {
		   alert("โปรดกรอกเบอร์โทรศัพท์");
		   frm.Telephone.focus();
		   return false;
		}else 
	   if(frm.Mobile.value=='')
	   {
		   alert("โปรดกรอกเบอร์โทรศัพท์มือถือ")
		   frm.Mobile.focus();
		   return false;
	   }else 
	   if(frm.Email.value=='')
	   {
		   alert("โปรดกรอกE-mail")
		   frm.Email.focus();
		   return false;
	   }else 
	   if(!isEmail(frm.Email.value))
	   {
		   alert("กรุณากรอกรูปแบบemailให้ถูกต้อง");
		   frm.Email.focus();
		   return false;  	
		}else
		if(frm.Price1.value=='' && frm.Price2.value=='')
		{
		   alert("โปรดกรอกราคาที่ต้องการซื้อง หรือ ราคาค่าเช่า")
		   frm.Price1.focus();
		   return false;
		}else 
	  
	  /*}else if(frm.Year.value==''){
		   alert("โปรดกรอกระยะเวลาที่ต้อง")
		   frm.Year.focus();
			return false;*/

	   /* if(frm.front.value=='')
		{
			alert("โปรดกรอกความกว้างด้านหน้า")
			frm.front.focus();
			return false;

		 } else
		 if(frm.deep.value=='')
		 {
			 alert("โปรดกรอกระยะความลึก")
			 frm.deep.focus();
			 return false;

		 }else 
		 if(frm.floor.value=='')
		 {
			 alert("โปรดกรอกจำนวนชั้น")
			 frm.floor.focus();
			 return false;
		 }else 
		 if(frm.bedroom.value=='')
		 {
			 alert("โปรดกรอกจำนวนห้องนอน")
			 frm.bedroom.focus();
			 return false;
		 }else
		 if(frm.bathroom.value=='')
		 {
			 alert("โปรดกรอกจำนวนห้องน้ำ")
			 frm.bathroom.focus();
			 return false;
		  }else 
		  if(frm.Maidroom.value=='')
		  {
			 alert("โปรดกรอกจำนวนห้องคนร้บใช้")
			 frm.Maidroom.focus();
			 return false;
		  }else 
		  if(frm.livingroom.value=='')
		  {
			alert("โปรดกรอกจำนวนห้องรับแขก")
			frm.livingroom.focus();
			return false;
		  }else
		  if(frm.carpark.value=='')
		  {
			alert("โปรดกรอกจำนวนที่จอดรถ")
			frm.carpark.focus();
			return false:
		  }else 
		  if(frm.air.value=='')
		  {
			alert("โปรดกรอกเครื่องปรับอากาศ")
			frm.air.focus();
			return false;
		   }else
		   if(frm.North.value=='')
		  {
			alert("โปรดกรอกขนาดสนามหญ้า")
			frm.North.focus();
			return false;
		  }else 
		  if(frm.locations.value=='')
		  {
			 alert("โปรดกรอกสถานที่ใกล้เคียง")
			 frm.locations.focus();
			 return false;

		  }else
		  if(frm.Star.value=='')
		 {
			alert("โปรดกรอกราคาดาวน์")
			frm.Star.focus();
			return false;

		  }else 
		  if(frm.Yearfinish.value=='')
		  {
			 alert("โปรดกรอกระยะเวลาที่สร้างเสร็จ")
			 frm.Yearfinish.focus();
			 return false;

		}else 
		if(frm.detail.value=='')
		{
			alert("โปรดกรอกรายละเอียด")
			frm.detail.focus();
			return false;

		}else */
		if(frm.resource.checked==true && frm.other.value=='')
		{
			alert("โปรดกรอกรายละเอียดอื่น");
			frm.other.focus();
			return false;

		}else 
		if(frm.area[0].checked==true && frm.area1.value=='')
		{
			alert("โปรดกรอกขนาดพื้นที่ ตร.ว");
			frm.area1.focus();
			return false;

		}else 
		if(frm.area[1].checked==true && frm.area2.value=='')
		{
			alert("โปรดกรอกขนาดพื้นที่ ตร.ม");
			frm.area2.focus();
			return false;
	  }

							


	}

//###################################### FUNCTION Popup_Full(pname,purl,w,h,s)  ############################################
//# FUNCTION NAME		:	Popup_Full(pname,purl,w,h,s)
//# PHP Version					:	1.2 and Up
//# Create Data					:	1 September 2004
//# Last Update					:	None
//# Class Desc					:	Function Popup_Full is create window  full screen popup

	function check_radio(frm)
	{
		  if(frm.checked==true){
			document.getElementById('resourceother').disabled=false;
		}else{
		  document.getElementById('resourceother').disabled=true;
		}

	}
	

//###################################### FUNCTION CheckImageType(myfiles))  ############################################
//# FUNCTION NAME				:	CheckImageType(myfiles)
//# PHP Version					:	1.2 and Up
//# Create Data					:	20 October 2004
//# Last Update					:	None
//# Class Desc					:	CheckImageType(myfiles)


	function CheckImageType(myfiles)
		{
				myfile=myfiles.value;
				myfile = myfile.toLowerCase();
				Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
				if(Temp!='.jpg' && Temp!='.gif' && Temp!='jpeg') {
					alert('กรุณาใส่ขนิดไฟล์รูปภาพให้ถูกต้อง');
					myfiles.value="";
					return false;
				}
		}
			function CheckImageType_vdo(myfiles)
		{
				myfile=myfiles.value;
				myfile = myfile.toLowerCase();
				Temp = myfile.charAt(myfile.length-4) + myfile.charAt(myfile.length-3) + myfile.charAt(myfile.length-2) + myfile.charAt(myfile.length-1);
				if(Temp!='.wmv') {
					alert('กรุณาใส่ขนิดไฟล์รูปภาพให้ถูกต้อง');
					myfiles.value="";
					return false;
				}
		}
