/**
 * @author Administrator
 */

function combobox_get_data(ob_id,ag_id,typeview){
	
	if (ag_id == '') {
		
		
	}
	else {
	
		$.ajax({
			type: "POST",
			url: "ajaxcombo.php",
			data: "type=" + typeview + "&id=" + ag_id,
			success: function(msg){
			
				document.getElementById(ob_id).innerHTML = msg;
				
				
			}
		});
	}
	
} 

function combobox_reset(ob_id,name){
	
	document.getElementById(ob_id).innerHTML = '<select name="'+name+'""><option value="">--โปรดเลือก--</option></select>';
}



function for_get_pass(){
	
	window.open('forgotpass.php','_blank','"status=yes,toolbar=no,scrollbars=no,left=0,top=0,width=250,height=170"');
	
	
}
function isBlank(myObj) {  if(myObj.value=='' ) { return true; } return false; }
function isEmail(str) {
var supported = 0;
if (window.RegExp) {
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if (tempReg.test(tempStr)) supported = 1;
}
if (!supported) 
return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
return (!r1.test(str) && r2.test(str));
}
function verifyhome() {
	with(document.frmhome) {
		if(isBlank(title_head)) {	alert("กรุนาใส่หัวข้อประกาศ"); title_head.focus(); return false; }
		if(isBlank(home_type)) {	alert("เลือกชนิดบ้าน"); home_type.focus(); return false; }
		if(isBlank(prize)) {	alert("กรุนาใส่ราคา"); prize.focus(); return false; }
		if(isBlank(home_size)) {	alert("กรุนาใส่ขนาดบ้าน"); home_size.focus(); return false; }
		//if(isBlank(home_step)) {	alert("กรุนาใส่จำนวนชั้น"); home_step.focus(); return false; }
		//if(isBlank(home_room)) {	alert("กรุนาใส่จำนวนห้อง"); home_room.focus(); return false; }
		//if(isBlank(home_tolit)) {	alert("กรุนาใส่จำนวนห้องน้ำ"); home_tolit.focus(); return false; }
		if(isBlank(geography)) {	alert("กรุนาใส่ภาค"); geography.focus(); return false; }
		if(isBlank(amphur_post)) {	alert("กรุนาใส่อำเภอ"); amphur_post.focus(); return false; }
		if(isBlank(home_address)) {	alert("กรุณาใส่ที่อยู่"); home_address.focus(); return false; }
		if(isBlank(home_post)) {	alert("กรุนาใ่ส่่หรัสไปรษ์ณี");home_post.focus(); return false; }
		if(isBlank(pic1)) {	alert("กรุนาใส่รูปภาพที่1"); pic1.focus(); return false; }
		if(isBlank(latbox)) {	alert("กรุนาขยับหมุดในแผนที่"); latbox.focus(); return false; }
		
		
		
		
	
		
		//if(isBlank(txtMail)) {	alert("กรุณาพิมพ์ e-mail"); txtMail.focus(); return false; }
		//if(!isBlank(txtMail)) { if(!isEmail(txtMail.value)) {	alert("รูปแบบของ e-mail ไม่ถูกต้องค่ะ !!"); txtMail.focus(); return false; } }
		}
	return true;
}
function verifyrent() {
	with(document.frmhome) {
		if(isBlank(title_head)) {	alert("กรุนาใส่หัวข้อประกาศ"); title_head.focus(); return false; }
		if(isBlank(room_type)) {	alert("เลือกชนิดบ้าน"); room_type.focus(); return false; }
		if(isBlank(prize)) {	alert("กรุนาใส่ราคา"); prize.focus(); return false; }
		if(isBlank(home_size)) {	alert("กรุนาใส่ขนาดบ้าน"); home_size.focus(); return false; }
		//if(isBlank(home_step)) {	alert("กรุนาใส่จำนวนชั้น"); home_step.focus(); return false; }
		//if(isBlank(home_room)) {	alert("กรุนาใส่จำนวนห้อง"); home_room.focus(); return false; }
		//if(isBlank(home_tolit)) {	alert("กรุนาใส่จำนวนห้องน้ำ"); home_tolit.focus(); return false; }
		if(isBlank(geography)) {	alert("กรุนาใส่ภาค"); geography.focus(); return false; }
		if(isBlank(amphur_post)) {	alert("กรุนาใส่อำเภอ"); amphur_post.focus(); return false; }
		if(isBlank(home_address)) {	alert("กรุณาใส่ที่อยู่"); home_address.focus(); return false; }
		if(isBlank(home_post)) {	alert("กรุนาใ่ส่่หรัสไปรษ์ณี");home_post.focus(); return false; }
		if(isBlank(pic1)) {	alert("กรุนาใส่รูปภาพที่1"); pic1.focus(); return false; }
		if(isBlank(latbox)) {	alert("กรุนาขยับหมุดในแผนที่"); latbox.focus(); return false; }
		
		
		
		
	
		
		//if(isBlank(txtMail)) {	alert("กรุณาพิมพ์ e-mail"); txtMail.focus(); return false; }
		//if(!isBlank(txtMail)) { if(!isEmail(txtMail.value)) {	alert("รูปแบบของ e-mail ไม่ถูกต้องค่ะ !!"); txtMail.focus(); return false; } }
		}
	return true;
}
