// JavaScript Document
var configInstallRootPath = '/';
var mobileVersion = false;
var configInstallRootPathMobile = '/mobile';

<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
// --> 

function checkNumber(ch){
	var len, digit;
	if(ch == " "){ 
		len=0;
	}else{
		len = ch.length;
	}
	if (len == 0)
		return true;
		
	for(var i=0 ; i<len ; i++)
	{
		digit = ch.charAt(i)
		if( (digit >= "0" && digit <= "9") || (digit >="๑" && digit <="๙") ){
			return true;
		}else{
			; 
		} 
	}  // end for
	
	return false;
}// end function

function getConnectSession() {
	
	$("#connectSession").everyTime(10000, function () {
											   
				$.ajax({
						type : 'GET',
						url : configInstallRootPath + 'ajaxFiles/getConnectSession.php',
						data: "action=connect",
						success : function(data){
							$('#connectSession').html(data);
						},
						error : function(XMLHttpRequest, textStatus, errorThrown) {
							;
						}
				});
		
	});
	
} // end function

function getConnectSessionFront() {
	
	$("#connectSessionFront").everyTime(10000, function () {
											   
				$.ajax({
						type : 'GET',
						url : configInstallRootPath + 'ajaxFiles/getConnectSessionFront.php',
						data: "action=connect",
						success : function(data){
							$('#connectSessionFront').html(data);
						},
						error : function(XMLHttpRequest, textStatus, errorThrown) {
							;
						}
				});
		
	});
	
} // end function

function getCity() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCity.php',
			data: "thai_province_id=" + $('#province_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCity').html(aData[0]);
				
				$('#xlat').val(aData[1]);
				$('#xlng').val(aData[2]);
				
				focusMap();
				
				$('#showCountry').html(aData[3]);
				$('#showOtherCountry').hide();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getCountry() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCountry.php',
			data: "thai_city_id=" + $('#city_id').val(),
			success : function(data){
				
				var aData = data.split('***');
				
				$('#showCountry').html(aData[0]);
				$('#showOtherCountry').hide();
				
				$('#xlat').val(aData[1]);
				$('#xlng').val(aData[2]);
				
				if (document.getElementById('chooseMap').style.display != 'none') {
					
					focusMap();
					
				} // end if				
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function changeSearchMode(mode) {
	
	if (mode == 'mode_1') {
		
		$('#mode_1').show();
		$('#mode_2').hide();
		
		document.getElementById('tab_1').src = '/images/conner/on-search-tab_92.gif';
		document.getElementById('tab_2').src = '/images/conner/search-tap_100.gif';
		
	} else { // end if (mode == 'mode_1') {
		
		$('#mode_1').hide();
		$('#mode_2').show();
		
		document.getElementById('tab_1').src = '/images/conner/search-tap_92.gif';
		document.getElementById('tab_2').src = '/images/conner/on-search-train2.gif';

	} // if (mode == 'mode_1') {
	
} // end function

function changeSearchModePro(mode) {
	
	if (mode == 'mode_1') {
		
		$('#mode_1').show();
		$('#mode_2').hide();
		
		document.getElementById('tab_1').src = '/images/bar-search-promotion_58.gif';
		document.getElementById('tab_2').src = '/images/bar-search-promotion_59.gif';
		
	} else { // end if (mode == 'mode_1') {
		
		$('#mode_1').hide();
		$('#mode_2').show();
		
		document.getElementById('tab_1').src = '/images/bar-off-search-promotion_58.jpg';
		document.getElementById('tab_2').src = '/images/bar-off-search-promotion_59.jpg';

	} // if (mode == 'mode_1') {
	
} // end function

function setSearchForm(frm) {
	
	var aValue = new Array();
	var index = 0;
	for (i = 0; i <= frm.elements.length; i++) {
	   try{
		 if( (frm.elements[i].name == 'a_sType[]') && (frm.elements[i].checked) ) {
			  aValue[index++] = frm.elements[i].value;
		 }
	   } catch(er) {}
   } // end for
   
} // end function


var gItemMis = 0;
function add_TR_instance_mis(instance, btn){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemMis++;
 
		for (var i = 0; i < thisChilds.length; i++){
			
			if (i == 2) {
				
				tmp = '<input name="charge_name[]" type="text" id="charge_name_' + gItemMis + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} else if (i == 4) { // end if (i == 2) {
				
				tmp = '<input name="charge_price[]" type="text" id="charge_price_' + gItemMis + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} // end else if (i == 2)

		} // end for
		checkForLast_font(instance);
		
	} // end if
 
} // end function


var gItemMis_en = 0;
function add_TR_instance_mis_en(instance, btn){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemMis++;
 
		for (var i = 0; i < thisChilds.length; i++){
			
			if (i == 2) {
				
				tmp = '<input name="charge_name_en[]" type="text" id="charge_name_en_' + gItemMis_en + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} else if (i == 4) { // end if (i == 2) {
				
				tmp = '<input name="charge_price_en[]" type="text" id="charge_price_en_' + gItemMis_en + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} // end else if (i == 2)

		} // end for
		checkForLast_font(instance);
		
	} // end if
 
} // end function


var gItemRoom = 0;
var roomDetailFont;
function add_TR_instance_room(instance, btn){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemRoom++;
		

		for (var i = 0; i < thisChilds.length; i++){
			
			tmp = '';
			if (i==0) {
				
				tmp = roomDetailFont.replace(/gItem/g, gItemRoom);
				thisChilds[i].innerHTML = tmp;	
				
			} // end if (i==1) {

		} // end for
		
		checkForLast_font(instance);
		
	} // end if
 
} // end function


var gItemRoom_en = 0;
var roomDetailFont_en;
function add_TR_instance_room_en(instance, btn){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemRoom++;
		

		for (var i = 0; i < thisChilds.length; i++){
			
			tmp = '';
			if (i==0) {
				
				tmp = roomDetailFont_en.replace(/gItem/g, gItemRoom);
				thisChilds[i].innerHTML = tmp;	
				
			} // end if (i==1) {

		} // end for
		
		checkForLast_font(instance);
		
	} // end if
 
} // end function


var a_listDropdownPlace = new Array();

var gItemPlace = 0;
var listDropdownPlace = '';
function add_TR_instance_place(instance, btn, index, section_no){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemPlace++;
 
		for (var i = 0; i < thisChilds.length; i++){
			
			if (i == 0) {
				
				tmp = '<select name="place_id[]" id="place_id_' + gItemPlace + '" onchange="setDisplayItemPlace(this.value, ' + gItemPlace + ')">' + a_listDropdownPlace[index] + '</select> ระยะทาง <input name="distance[]" type="text" id="distance_' + gItemPlace + '" value="" style="width:180px;"> <input type="hidden" name="selectOther[]" id="selectOther_' + gItemPlace + '"><input type="hidden" name="section_no[]" id="section_no_' + gItemPlace + '" value="'+section_no+'"><br><input type="text" name="place_name[]" id="place_name_' + gItemPlace + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} // end else if (i == 0)

		} // end for
		
		checkForLast_font(instance);
		
		setDisplayItemPlace('', gItemPlace);
		
	} // end if
 
} // end function


var a_listDropdownPlace_en = new Array();

var gItemPlace_en = 0;
var listDropdownPlace_en = '';
function add_TR_instance_place_en(instance, btn, index, section_no){
	
var tmp;

	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		var idSuffix = Math.round(Math.random()*1000);
		//var newTr = tr.parentNode.insertBefore(tr.cloneNode(true),tr.nextSibling);
		var newTr = tr.parentNode.appendChild(tr.cloneNode(true));
		thisChilds = newTr.getElementsByTagName('td');
				
		gItemPlace_en++;
 
		for (var i = 0; i < thisChilds.length; i++){
			
			if (i == 0) {
				
				tmp = '<select name="place_id_en[]" id="place_id_en_' + gItemPlace_en + '" onchange="setDisplayItemPlace_en(this.value, ' + gItemPlace_en + ')">' + a_listDropdownPlace_en[index] + '</select> ระยะทาง <input name="distance_en[]" type="text" id="distance_en_' + gItemPlace_en + '" value="" style="width:180px;"> <input type="hidden" name="selectOther_en[]" id="selectOther_en_' + gItemPlace_en + '"><input type="hidden" name="section_no_en[]" id="section_no_en_' + gItemPlace + '" value="'+section_no+'"><br><input type="text" name="place_name_en[]" id="place_name_en_' + gItemPlace_en + '" value="" style="width:180px;">';
				
				thisChilds[i].innerHTML = tmp;					
				
			} // end else if (i == 0)

		} // end for
		
		checkForLast_font(instance);
		
		setDisplayItemPlace_en('', gItemPlace_en);
		
	} // end if
 
} // end function


function drop_TR_instance_font(instance, btn){
	if (document.getElementById) {
		tr = btn;
		while (tr.tagName != 'TR') tr = tr.parentNode;
		tr.parentNode.removeChild(tr);
		checkForLast_font(instance);
	}
}

function checkForLast_font(instance){
// alert(instance);
	btns = document.getElementsByName('drop_' + instance);
// alert('btns.length = ' + btns.length);
	for (i = 0; i < btns.length; i++){
		btns[i].disabled = (btns.length == 1) ? true : false;
	}
}

function setDisplayItemPlace(value, itemNo){
	//document.getElementById('selectOther_' + itemNo).value = 'xxx';
	
	if ( (value == 0) && (value != '') ) { 
		
		$('#place_name_' + itemNo).show(); 
		$('#selectOther_' + itemNo).val('yes');
		
	} else { 
	
		$('#place_name_' + itemNo).hide(); 
		$('#selectOther_' + itemNo).val('no');
	
	}
	
} // end function

function setDisplayItemPlace_en(value, itemNo){
	//document.getElementById('selectOther_' + itemNo).value = 'xxx';
	
	if ( (value == 0) && (value != '') ) { 
		
		$('#place_name_en_' + itemNo).show(); 
		$('#selectOther_en_' + itemNo).val('yes');
		
	} else { 
	
		$('#place_name_en_' + itemNo).hide(); 
		$('#selectOther_en_' + itemNo).val('no');
	
	}
	
} // end function

function checkUsernameForm(ch){
	var len, digit;
	if(ch == " "){ 
		len=0;
	}else{
		len = ch.length;
	}
	if ( len == 0 )
		return false;
		
	for(var i=0 ; i<len ; i++)
	{
		digit = ch.charAt(i)
		if( (digit >= "A" && digit <= "Z") || (digit >= "a" && digit <= "z") || (digit >="0" && digit <="9") || (digit == "_") || (digit == "-") ){
		; 
		}else{
			return false; 
		} 
	}  // end for
	
	return true;
}// end function

/*function checkUsername1() {
	
	if (!checkUsernameForm($('#username').val()) {
		
		alert('Username ต้องเป็นตัวอักษร A-Z, a-z, 0-9, _ , - เท่านั้น !');
		$('#username').focus();
		return false;
		
	} // end if
	
} // end function*/

function checkUsername() {
	
	if ($('#username').val().length > 0) {
		
			$.ajax({
					type : 'POST',
					url : configInstallRootPath + 'ajaxFiles/checkUsername.php',
					data: "username=" + $('#username').val(),
					success : function(data){
						
						if (data != 'ok') {
							$('#showUsernameError').html(data);
							$('#showUsernameError').show();
							$('#username').focus();
							return false;
						} else {
							$('#showUsernameError').html('');
							$('#showUsernameError').hide();
						}
						
					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {
						;
					}
			});
	
	} // end if ($('#username').val().length > 0) {
	
} // end function

function checkApartmentAdd() {
	
	$('#post_city_id').val($('#city_id').val());
	$('#post_country_id').val($('#country_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	
	if ( ($('#username').val().length == 0) || !checkUsernameForm($('#username').val()) ) {
		
		alert('Username ต้องเป็นตัวอักษร A-Z, a-z, 0-9, _ , - เท่านั้น !');
		$('#username').focus();
		return false;
		
	} // end if
	
	if ( ($('#password').val().length == 0) || !checkUsernameForm($('#password').val()) ) {
		
		alert('Password ต้องเป็นตัวอักษร A-Z, a-z, 0-9, _ , - เท่านั้น !');
		$('#password').focus();
		return false;
		
	} // end if
	
	if ( ($('#password').val() != $('#c_password').val()) ) {
		
		alert('Password ของคุณไม่ตรงกัน กรุณายืนยัน Password อีกครัั้ง');
		$('#c_password').focus();
		return false;
		
	} // end if
	
	if ( $('#contact').val().length == 0 ) {
		
		alert('กรุณากรอกชื่อผู้ติดต่อ (ภาษาไทย)');
		$('#contact').focus();
		return false;
		
	} // end if
	
	if ( $('#contact_phone').val().length == 0 ) {
		
		alert('กรุณากรอกเบอร์ผู้ติดต่อ');
		$('#contact_phone').focus();
		return false;
		
	} // end if
	
	if (!(format_mail.test($('#email').val()))) {
		alert('กรุณากรอก Email ให้ถูกต้อง!');	
		$('#email').focus();
		return false;
	} // end if	
		
	if ( $('#apartment_name').val().length == 0 ) {
		
		alert('กรุณากรอกชื่อห้องพัก (ภาษาไทย)');
		$('#apartment_name').focus();
		return false;
		
	} // end if
		
	if ( $('#type_id').val().length == 0 ) {
		
		alert('กรุณาเลือกประเภทห้องพัก');
		$('#type_id').focus();
		return false;
		
	} // end if
	
	if ( $('#province_id').val().length == 0 ) {
		
		alert('กรุณาเลือกจังหวัด');
		$('#province_id').focus();
		return false;
		
	} // end if
	
	if ( $('#country_id').val().length == 0 ) {
		
		if ( $('#other_country').val().length == 0 ) {
		
			alert('กรุณากรอกชื่อ แขวง / ตำบล (ภาษาไทย)');
			$('#other_country').focus();
			return false;
		
		} // end if
		
	} // end if ( $('#country_id').val().length == 0 ) {
	
	if ( $('#telephone1').val().length == 0 ) {
		
		alert('กรุณากรอกหมายเลขโทรศัพท์');
		$('#telephone1').focus();
		return false;
		
	} // end if
	
	if ( ($('#price_min').val().length == 0) || (isNaN($('#price_min').val())) ) {
		
		alert('กรุณากรอกราคาต่ำสุดเป็นตัวเลข');
		$('#price_min').focus();
		return false;
		
	} // end if
	
	/*if ( ($('#price_max').val().length == 0) || (isNaN($('#price_max').val())) ) {
		
		alert('กรุณากรอกราคาสูงสุดเป็นตัวเลข');
		$('#price_max').focus();
		return false;
		
	} // end if*/
	
	if ( ($('#fileMap').val().length > 0) && ($('#fileMap').val().toLowerCase().indexOf('.jpg') < 0) && ($('#fileMap').val().toLowerCase().indexOf('.gif') < 0) && ($('#fileMap').val().toLowerCase().indexOf('.png') < 0) ) {
		
		alert('ไฟล์รูปแผนที่ต้องเป็น .gif, .jpg, .png เท่านั้น');
		$('#fileMap').focus();
		return false;
		
	} // end if
	
	for (var i=1; i<=5; i++) {
		
		if (document.getElementById('fileImg_'+i)) {
			
			if ( ($('#fileImg_'+i).val().length > 0) && ($('#fileImg_'+i).val().toLowerCase().indexOf('.jpg') < 0) && ($('#fileImg_'+i).val().toLowerCase().indexOf('.gif') < 0) && ($('#fileImg_'+i).val().toLowerCase().indexOf('.png') < 0) ) {
				
				alert('ไฟล์รูปภาพที่ต้องเป็น .gif, .jpg, .png เท่านั้น');
				$('#fileImg_'+i).focus();
				return false;
		
	} // end if
			
		} // end if (document.getElementById('fileImg_'+i)) {
		
	} // end for
	
	if ( $('#promotion_name').val().length > 0 ) {
		
		if ($('#promotion_startdate').val().length == 0) {
			
			alert('กรุณาระบุ วันที่เริ่มโปรโมชั่น');
			$('#promotion_startdate').focus();
			return false;
			
		} // end if
		
		if ($('#promotion_stopdate').val().length == 0) {
			
			alert('กรุณาระบุ วันที่สิ้นสุดโปรโมชั่น');
			$('#promotion_stopdate').focus();
			return false;
			
		} // end if
		
	} // end if ( $('#promotion_name').val().length > 0 ) {
	
	
	if(document.getElementById('showFillEng').style.display != 'none') {
		
		if ( $('#apartment_name_en').val().length == 0 ) {
			
			alert('กรุณากรอกชื่อห้องพัก (ภาษาอังกฤษ)');
			$('#apartment_name_en').focus();
			return false;
			
		} // end if
	
		
		/*if ( $('#contact_en').val().length == 0 ) {
			
			alert('กรุณากรอกชื่อผู้ติดต่อ (ภาษาอังกฤษ)');
			$('#contact_en').focus();
			return false;
			
		} // end if*/
		
		if ( $('#country_id').val().length == 0 ) {
			
			if ( $('#other_country_en').val().length == 0 ) {
			
				alert('กรุณากรอกชื่อ แขวง / ตำบล (ภาษาอังกฤษ)');
				$('#other_country_en').focus();
				return false;
			
			} // end if
			
		} // end if ( $('#country_id').val().length == 0 ) {
			
			
		if ( $('#promotion_name').val().length > 0 ) {
			
			if ($('#promotion_name_en').val().length == 0) {
				
				alert('กรุณาระบุ หัวข้อโปรโมชั่น (ภาษาอังกฤษ)');
				$('#promotion_name_en').focus();
				return false;
				
			} // end if
			
		} // end if ( $('#promotion_name').val().length > 0 ) {
	
	} // end if(document.getElementById('showFillEng').style.display != 'none') {
		
		
	$('#showSubmit').hide();
	$('#waitSubmit').show();
	
} // end function

function checkApartmentUpdate() {
	
	$('#post_city_id').val($('#city_id').val());
	$('#post_country_id').val($('#country_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	
	if ( $('#contact').val().length == 0 ) {
		
		alert('กรุณากรอกชื่อผู้ติดต่อ (ภาษาไทย)');
		$('#contact').focus();
		return false;
		
	} // end if
	
	if ( $('#contact_phone').val().length == 0 ) {
		
		alert('กรุณากรอกเบอร์ผู้ติดต่อ');
		$('#contact_phone').focus();
		return false;
		
	} // end if
	
	if (!(format_mail.test($('#email').val()))) {
		alert('กรุณากรอก Email ให้ถูกต้อง!');	
		$('#email').focus();
		return false;
	} // end if	

	if ( $('#apartment_name').val().length == 0 ) {
		
		alert('กรุณากรอกชื่อห้องพัก (ภาษาไทย)');
		$('#apartment_name').focus();
		return false;
		
	} // end if

	if ( $('#country_id').val().length == 0 ) {
		
		if ( $('#other_country').val().length == 0 ) {
		
			alert('กรุณากรอกชื่อ แขวง / ตำบล (ภาษาไทย)');
			$('#other_country').focus();
			return false;
		
		} // end if
		
	} // end if ( $('#country_id').val().length == 0 ) {
	
	if ( $('#telephone1').val().length == 0 ) {
		
		alert('กรุณากรอกหมายเลขโทรศัพท์');
		$('#telephone1').focus();
		return false;
		
	} // end if
	
	if ( ($('#price_min').val().length == 0) || (isNaN($('#price_min').val())) ) {
		
		alert('กรุณากรอกราคาต่ำสุดเป็นตัวเลข');
		$('#price_min').focus();
		return false;
		
	} // end if
	
	/*if ( ($('#price_max').val().length == 0) || (isNaN($('#price_max').val())) ) {
		
		alert('กรุณากรอกราคาสูงสุดเป็นตัวเลข');
		$('#price_max').focus();
		return false;
		
	} // end if*/
	
	if ( ($('#fileMap').val().length > 0) && ($('#fileMap').val().toLowerCase().indexOf('.jpg') < 0) && ($('#fileMap').val().toLowerCase().indexOf('.gif') < 0) && ($('#fileMap').val().toLowerCase().indexOf('.png') < 0) ) {
		
		alert('ไฟล์รูปแผนที่ต้องเป็น .gif, .jpg, .png เท่านั้น');
		$('#fileMap').focus();
		return false;
		
	} // end if


	if ( $('#promotion_name').val().length > 0 ) {
		
		if ($('#promotion_startdate').val().length == 0) {
			
			alert('กรุณาระบุ วันที่เริ่มโปรโมชั่น');
			$('#promotion_startdate').focus();
			return false;
			
		} // end if
		
		if ($('#promotion_stopdate').val().length == 0) {
			
			alert('กรุณาระบุ วันที่สิ้นสุดโปรโมชั่น');
			$('#promotion_stopdate').focus();
			return false;
			
		} // end if
		
	} // end if ( $('#promotion_name').val().length > 0 ) {
	
		
	if ( $('#apartment_name_en').val().length == 0 ) {
		
		alert('กรุณากรอกชื่อห้องพัก (ภาษาอังกฤษ)');
		$('#apartment_name_en').focus();
		return false;
		
	} // end if
	
	if ( $('#country_id').val().length == 0 ) {
		
		if ( $('#other_country_en').val().length == 0 ) {
		
			alert('กรุณากรอกชื่อ แขวง / ตำบล (ภาษาอังกฤษ)');
			$('#other_country_en').focus();
			return false;
		
		} // end if
		
	} // end if ( $('#country_id').val().length == 0 ) {
		
		
	if ( $('#promotion_name').val().length > 0 ) {
		
		if ($('#promotion_name_en').val().length == 0) {
			
			alert('กรุณาระบุ หัวข้อโปรโมชั่น (ภาษาอังกฤษ)');
			$('#promotion_name_en').focus();
			return false;
			
		} // end if
		
	} // end if ( $('#promotion_name').val().length > 0 ) {
		
		
	$('#showSubmit').hide();
	$('#waitSubmit').show();
	
} // end function

function disbleTravelCheckbox(mainObj, allObj, maxSelected) {
	
	var allSelected = 0;
	var aData = new Array();
	var objName = '';
	
	for(var i=1; i<=allObj; i++) {
		
		objName = mainObj + i;
		
		if (document.getElementById(objName).checked) {
			
			allSelected++;
			
		} // end if (document.getElementById(objName).checked) {
		
	} // end for(var i=1; i<=allObj; i++) {
		
	
	if (allSelected >= maxSelected) {
		
			for(var i=1; i<=allObj; i++) {
				
				objName = mainObj + i;
				
				if (document.getElementById(objName).checked) {

					document.getElementById(objName).disabled = false;

				} else { // end if (document.getElementById(objName).checked) {

					document.getElementById(objName).disabled = true;
					
				}
				
			} // end for(var i=1; i<=allObj; i++) {
		
	} else { // end if (allSelected >= maxSelected) {
		
			for(var i=1; i<=allObj; i++) {
				
				objName = mainObj + i;

				document.getElementById(objName).disabled = false;
				
			} // end for(var i=1; i<=allObj; i++) {
		
	} // if (allSelected >= maxSelected) {
	
} // end function

function checkContactFrom(lang) {
	
	var text = '';
	
	if ($('#contact_name').val().length == 0) {
		
		text = (lang=='th') ? 'กรุณากรอกชื่อผู้ติดต่อ' : 'Please Fill Name';
		alert(text);
		$('#contact_name').focus();
		return false;
		
	} // end if
	
	if ($('#contact_phone').val().length == 0) {
		
		text = (lang=='th') ? 'กรุณากรอกเบอร์โทรศัพท์' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone').focus();
		return false;
		
	} // end if
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	
	if ( ($('#contact_email').val().length == 0) || !(format_mail.test($('#contact_email').val())) ) {
		
		text = (lang=='th') ? 'กรุณากรอกอีเมล์ให้ถูกต้อง' : 'Invalid Email';
		alert(text);
		$('#contact_email').focus();
		return false;
		
	} // end if
	
	if ($('#contact_subject').val().length == 0) {
		
		text = (lang=='th') ? 'กรุณากรอกเรื่องที่ติดต่อ' : 'Please Fill Subject';
		alert(text);
		$('#contact_subject').focus();
		return false;
		
	} // end if
	
	if ($('#contact_detail').val().length == 0) {
		
		text = (lang=='th') ? 'กรุณากรอกรายละเอียด' : 'Please Fill Message';
		alert(text);
		$('#contact_detail').focus();
		return false;
		
	} // end if
	
	if ($('#hidden_code').val() != $('#security_code').val()) {
		
		text = (lang=='th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Please Fill Security Code';
		alert(text);
		$('#security_code').focus();
		return false;
		
	} // end if
	
} // end function

function checkLoginFromApartment(lang) {
	
	var text;
	if ( $('#login_username').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Username' : 'Please Fill Username';
		alert(text);
		$('#login_username').focus();
		return false;
		
	} // end if
	
	if ( $('#login_password').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#login_password').focus();
		return false;
		
	} // end if
	
} // end function

function checkApartmentForget(lang) {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	var text;
	
	if (!(format_mail.test($('#femail').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก Email ให้ถูกต้อง' : 'Email Invalid';
		
		alert(text);	
		$('#femail').focus();
		return false;
		
	} // end if	
	
} // end function

<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

function chkAllFont(frm, arr, mark) {
  for (i = 0; i <= frm.elements.length; i++) {
   try{
     if(frm.elements[i].name == arr) {
       frm.elements[i].checked = mark;
     }
   } catch(er) {}
  }
}

function checkChangePass(lang) {
	
	var text;
	
	if ( ($('#old_password').val().length == 0) || (!checkUsernameForm($('#old_password').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รหัสผ่านเดิม' : 'Please Full Old Password';
		alert(text);
		$('#old_password').focus();
		return false;
		
	} // end if
	
	if ( ($('#new_password').val().length == 0) || (!checkUsernameForm($('#new_password').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รหัสผ่านใหม่' : 'Please Full New Password';
		alert(text);
		$('#new_password').focus();
		return false;
		
	} // end if
	
	if ( ($('#new_password').val() != $('#c_password').val()) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ยืนยันรหัสผ่านอีกครั้ง' : 'Please Confirm Password Again';
		alert(text);
		$('#c_password').focus();
		return false;
		
	} // end if
	
} // end function

function checkNewPost_1(lang) {
	
	$('#post_city_id').val($('#city_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject').focus();
		return false;
		
	} // end if	
	
	if ( document.getElementById('type_other').checked && ($('#apartment_type_other').val().length == 0) ) {
		
		text = (lang == 'th') ? 'กรุณาระบุประเภท' : 'Please Fill Type';
		alert(text);
		$('#apartment_type_other').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price').val().length == 0) || (isNaN($('#from_price').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price').val().length == 0) || (isNaN($('#to_price').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price').focus();
		return false;
		
	} // end if	
	
	if ( $('#description').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email').focus();
		return false;
		
	} // end if	
	
	if ( $('#password_del').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#password_del').focus();
		return false;
		
	} // end if	
	
	if ($('#hidden_code').val() != $('#security_code').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code').focus();
		return false;
		
	} // end if	

} // end function

function checkNewPost_2(lang) {
	
	$('#post_city_id').val($('#city_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_from').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_from').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_to').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_to').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price').val().length == 0) || (isNaN($('#from_price').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price').val().length == 0) || (isNaN($('#to_price').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price').focus();
		return false;
		
	} // end if	
	
	if ( $('#description').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email').focus();
		return false;
		
	} // end if	
	
	if ( $('#password_del').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#password_del').focus();
		return false;
		
	} // end if	
	
	
	if ($('#hidden_code').val() != $('#security_code').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code').focus();
		return false;
		
	} // end if	

} // end function


function getCityAdd() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCityAdd.php',
			data: "thai_province_id=" + $('#province_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCity').html(aData[0]);
				$('#showCountry').html(aData[1]);
				$('#showOtherCountry').hide();
				
				if (document.getElementById('city_id').options.length == 0) {
					
					document.getElementById('city_id').disabled = true;
					
				}
				
				if (document.getElementById('country_id').options.length == 0) {
					
					document.getElementById('country_id').disabled = true;
					
				}
				
				setProviceTextEn();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getCountryAdd() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCountryAdd.php',
			data: "thai_city_id=" + $('#city_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCountry').html(aData[0]);
				$('#showOtherCountry').hide();
				
				setProviceTextEn();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function changeCountryAdd() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/changeCountryAdd.php',
			data: "thai_country_id=" + $('#country_id').val(),
			success : function(data){
				
				$('#showCountry_en').html(data);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function



function getCityAddApt() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCityAddApt.php',
			data: "thai_province_id=" + $('#province_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCity').html(aData[0]);
				
				$('#xlat').val(aData[1]);
				$('#xlng').val(aData[2]);
				
				focusMap();
				
				$('#showCountry').html(aData[3]);
				$('#showOtherCountry').hide();
				
				if (document.getElementById('city_id').options.length == 0) {
					
					document.getElementById('city_id').disabled = true;
					
				}
				
				if (document.getElementById('country_id').options.length == 0) {
					
					document.getElementById('country_id').disabled = true;
					
				}
				
				setProviceTextEn();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getCountryAddApt() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCountryAddApt.php',
			data: "thai_city_id=" + $('#city_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCountry').html(aData[0]);
				$('#showOtherCountry').hide();
				
				$('#xlat').val(aData[1]);
				$('#xlng').val(aData[2]);
				
				if (document.getElementById('chooseMap').style.display != 'none') {
					
					focusMap();
					
				} // end if
				
				setProviceTextEn();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function


function setProviceTextEn() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/setProviceTextEn.php',
			data: "thai_province_id=" + $('#province_id').val() + '&thai_city_id=' + $('#city_id').val() + '&thai_country_id=' + $('#country_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showProvince_en').html(aData[0]);
				$('#showCity_en').html(aData[1]);
				$('#showCountry_en').html(aData[2]);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end 

function checkSendApartment() {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	
	if ($('#sender').val().length == 0) {
		alert('กรุณากรอก ชื่อผู้ส่ง');	
		$('#sender').focus();
		return false;
	} // end if	
	
	if (!(format_mail.test($('#email').val()))) {
		alert('กรุณากรอก Email ให้ถูกต้อง!');	
		$('#email').focus();
		return false;
	} // end if	
	
} // end function checkSendApartment() {

function setTextInput (obj, text, actions) {
	
	if ( actions == 'in' ) {
	
		document.getElementById(obj).className = '';
	
		if ($('#'+obj).val() == text)
			$('#'+obj).val('');
		
	} else if ( (actions == 'out') && ($('#'+obj).val() == '') ) { // end if
	
		document.getElementById(obj).className = 'inputTextBlur';
		$('#'+obj).val(text);
	
	} // end if
	
} // end function

function checkUploadImg() {
	
	if ( ($('#file1').val().length > 0) && ($('#file1').val().toLowerCase().indexOf('.jpg') < 0) && ($('#file1').val().toLowerCase().indexOf('.gif') < 0) && ($('#file1').val().toLowerCase().indexOf('.png') < 0) || ($('#file1').val().length == 0) ) {
		
		alert('ไฟล์รูปภาพต้องเป็น .gif, .jpg, .png เท่านั้น');
		$('#file1').focus();
		return false;
		
	} // end if
	
} // end function

function setSelectType(allType) {
	
	var text = '';
	
	for (var i=1; i<=allType; i++) {
		
		if (document.getElementById('a_sType_'+i).checked) {

			text += ',' + $	('#a_sType_text_'+i).html();
			
		} // end if
		
	} // end for
	text = text.substr(1);
	
	$('#selectTypeValue').val(text);
	
} // end function

function setSelectFac(allFac) {
	
	var text = '';
	
	for (var i=1; i<=allFac; i++) {
		
		if (document.getElementById('a_sFac_'+i).checked) {

			text += ',' + $	('#a_sFac_text_'+i).html();
			
		} // end if
		
	} // end for
	text = text.substr(1);
	
	$('#selectFacValue').val(text);
	
} // end function

function setUrlSearchForm(pathLang) {
	
	var url = pathLang + '/หา';
	
	url += '/';
	
	var firstType = false;
	
	if (document.getElementById('room_daily_2')) {
		
		if (document.getElementById('room_daily_2').checked) {
			
			url += 'ห้องพักรายวัน';
			firstType = true;
			
		}
	
	} // end if (document.getElementById('room_daily_2')) {
		
	if ( !(firstType) ) {
		
		url += ($('#selectTypeValue').val().length == 0) ? '0' : $('#selectTypeValue').val();
	
	} else { // end if ( !(firstType) ) {
		
		if ($('#selectTypeValue').val().length > 0)
			url += ',' + $('#selectTypeValue').val();
		
	} // if ( !(firstType) ) {
	

	url += '/';

	if ( (document.getElementById('sg_1').checked) && ($('#sCity_1').val().length > 0) ) {
		
		url += document.getElementById('sCity_1').options[document.getElementById('sCity_1').selectedIndex].text;
		
	} else {
		
		url += '0';	
		
	}
	
	if ( (document.getElementById('sg_2').checked) && ($('#sPlace_2').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sPlace_2').options[document.getElementById('sPlace_2').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	if ( (document.getElementById('sg_3').checked) && ($('#sProvince_3').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sProvince_3').options[document.getElementById('sProvince_3').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	if ( (document.getElementById('sg_4').checked) && ($('#sTarvel_4').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sTarvel_4').options[document.getElementById('sTarvel_4').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	if ( (document.getElementById('sg_5').checked) && ($('#sTarvel_5').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sTarvel_5').options[document.getElementById('sTarvel_5').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	if ( (document.getElementById('sg_6').checked) && ($('#sTarvel_6').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sTarvel_6').options[document.getElementById('sTarvel_6').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	if ( (document.getElementById('sg_7').checked) && ($('#sTarvel_7').val().length > 0) ) {
		
		url +=  ',' + document.getElementById('sTarvel_7').options[document.getElementById('sTarvel_7').selectedIndex].text;
		
	} else {
		
		url += ',0';	
		
	}
	
	
	url += '/';
	
	url += (isNaN($('#sMinPrice').val())) ? '0' : $('#sMinPrice').val();
	
	url += '-';
	
	url += (isNaN($('#sMaxPrice').val())) ? '0' : $('#sMaxPrice').val();
	
	url += 'บาท';
	
	url += '/';
	
	url += ($('#selectFacValue').val().length == 0) ? '0' : $('#selectFacValue').val();
	
	url += '/';
	
	url += ($('#sKeyword').val().length == 0) ? '0' : $('#sKeyword').val().replace(/\//g, '');
	
	
	window.location =	url;
	
} // end function

function setUrlSearchCity(pathLang, group_no) {
	
	var url = pathLang + '/หา';
	
	if (mobileVersion)
		url = configInstallRootPathMobile + url;
	
	url += '/';
	
	if (document.getElementById(('sType_'+group_no))) {
		
		url += ($('#sType_'+group_no).val().length == 0) ? '0' : document.getElementById('sType_'+group_no).options[document.getElementById('sType_'+group_no).selectedIndex].text;
	
	} else { // end if (document.getElementById(('sType_'+group_no))) {
		
		url += '0';
		
	} // if (document.getElementById(('sType_'+group_no))) {
	

	url += '/';

	if (group_no == '1') {
		
		url += ($('#sCity_'+group_no).val().length == 0) ? '0' : document.getElementById('sCity_'+group_no).options[document.getElementById('sCity_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '1') {
		
		url += '0';
		
	}  // if (group_no == '1') {

	
	url += ',';
	
	if (group_no == '2') {
		
		url += ($('#sPlace_'+group_no).val().length == 0) ? '0' : document.getElementById('sPlace_'+group_no).options[document.getElementById('sPlace_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '2') {
		
		url += '0';
		
	}  // if (group_no == '2') {

	
	url += ',';

	if (group_no == '3') {
		
		url += ($('#sProvince_'+group_no).val().length == 0) ? '0' : document.getElementById('sProvince_'+group_no).options[document.getElementById('sProvince_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '3') {
		
		url += '0';
		
	}  // if (group_no == '3') {

	
	for (var i=4; i<=7; i++) {
		
		url += ',';
	
		if (group_no == i) {
			
			url += ($('#sTarvel_'+group_no).val().length == 0) ? '0' : document.getElementById('sTarvel_'+group_no).options[document.getElementById('sTarvel_'+group_no).selectedIndex].text;
		
		} else { // end if (group_no == i) {
			
			url += '0';
			
		}  // if (group_no == i) {
			
	} // end for (var i=4; i<=7; i++) {
	
	
	url += '/';
	
	if (document.getElementById('sPrice_'+group_no)) {
		
		url += ($('#sPrice_'+group_no).val().length == 0) ? '0-0' : $('#sPrice_'+group_no).val();
	
	} else { // end if (document.getElementById('sPrice_'+group_no)) {
		
		url += '0-0';
		
	} // if (document.getElementById('sPrice_'+group_no)) {
	
	url += 'บาท';
	
	url += '/0/';
	
	if (group_no == '8') {
	
		url += ($('#sKeyword').val().length == 0) ? '0' : $('#sKeyword').val();
	
	} else { // end if (group_no == '8') {
		
		url += '0';
		
	} // if (group_no == '8') {
	
	if (group_no != '8')
		url += '/' + group_no;
	
	window.location =	url;
	
} // end function

function setUrlSearchProCity(pathLang, group_no) {
	
	var url = pathLang + '/โปรโมชั่น';
	
	url += '/';
	
	url += ($('#sType_'+group_no).val().length == 0) ? '0' : document.getElementById('sType_'+group_no).options[document.getElementById('sType_'+group_no).selectedIndex].text;
	

	url += '/';

	if (group_no == '1') {
		
		url += ($('#sCity_'+group_no).val().length == 0) ? '0' : document.getElementById('sCity_'+group_no).options[document.getElementById('sCity_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '1') {
		
		url += '0';
		
	}  // if (group_no == '1') {

	
	url += ',';
	
	if (group_no == '2') {
		
		url += ($('#sPlace_'+group_no).val().length == 0) ? '0' : document.getElementById('sPlace_'+group_no).options[document.getElementById('sPlace_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '2') {
		
		url += '0';
		
	}  // if (group_no == '2') {

	
	url += ',';

	if (group_no == '3') {
		
		url += ($('#sProvince_'+group_no).val().length == 0) ? '0' : document.getElementById('sProvince_'+group_no).options[document.getElementById('sProvince_'+group_no).selectedIndex].text;
	
	} else { // end if (group_no == '3') {
		
		url += '0';
		
	}  // if (group_no == '3') {

	
	for (var i=4; i<=7; i++) {
		
		url += ',';
	
		if (group_no == i) {
			
			url += ($('#sTarvel_'+group_no).val().length == 0) ? '0' : document.getElementById('sTarvel_'+group_no).options[document.getElementById('sTarvel_'+group_no).selectedIndex].text;
		
		} else { // end if (group_no == i) {
			
			url += '0';
			
		}  // if (group_no == i) {
			
	} // end for (var i=4; i<=7; i++) {
	
	
	url += '/';
	
	url += ($('#sPrice_'+group_no).val().length == 0) ? '0-0' : $('#sPrice_'+group_no).val();
	
	url += 'บาท';
	
	url += '/0/0/' + group_no;
	
	window.location =	url;
	
} // end function


function getMapCity(lang) {
	
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/getMapCity.php',
			data: "mapProvince=" + $('#mapProvince').val() + '&lang=' + lang,
			success : function(data){
				
				var aData = new Array();
	
				aData = data.split(':::');
				
				$('#showMapCity').html(aData[0]);
				
				changeMapCenter(aData[1]);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function changeMapCenter(coordinate) {
	
	var aData = new Array();
	
	aData = coordinate.split(',');
	
	map.setCenter(new GLatLng(aData[0], aData[1]), 12);
	
} // end function

function checkSubForm() {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;
	
	if (!(format_mail.test($('#sub_email').val()))) {
		alert('กรุณากรอก Email ให้ถูกต้อง!');	
		$('#sub_email').focus();
		return false;
	} // end if	
	
	var data = "sub_email=" + $('#sub_email').val();
	
	if (document.getElementById('sub_radio_1').checked)
		data += '&enable=1';
	else
		data += '&enable=0';
	
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/saveSubForm.php',
			data:  data,
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split(':');
				
				alert(aData[1]);
				
				if (aData[0] == 'ok') {
					
					$('#sub_email').val('');
					
				} // end if (aData[0] == 'ok') {
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function swapFillEng() {
	
	if(document.getElementById('showFillEng').style.display != 'none') { 
	
		$('#showFillEngText').hide(); 
		$('#showFillEng').hide(); 
		$('#btnShowFillEng').val('มีข้อมูลภาษาอังกฤษ'); 
		
	} else { 
		
		$('#showFillEngText').show(); 
		$('#showFillEng').show(); 
		$('#btnShowFillEng').val('ไม่มีข้อมูลภาษาอังกฤษ'); 
	
	}
	
} // end function

function swap_post_board() {
	
	var selectId = $('#select_request_id').val();
	
	for (var i=1; i<=3; i++) {
		
		if (selectId == i) {
			
			$('#section_'+i).show();
			
		} else { // end if (selectId == $i) {
			
			$('#section_'+i).hide();
			
		} // if (selectId == $i) {
		
	} // end for
	
} // end function swap_post_board() {
	

function checkPostForm_1(lang) {
	
	$('#post_city_id').val($('#city_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject_1').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price_1').val().length == 0) || (isNaN($('#from_price_1').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_1').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_1').val().length == 0) || (isNaN($('#to_price_1').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#description_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_1').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_1').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#password_del_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#password_del_1').focus();
		return false;
		
	} // end if	
	
	if ($('#hidden_code_1').val() != $('#security_code_1').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_1').focus();
		return false;
		
	} // end if	

} // end function
	

function checkPostFormUpdate_1(lang) {
	
	$('#post_city_id').val($('#city_id').val());
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject_1').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price_1').val().length == 0) || (isNaN($('#from_price_1').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_1').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_1').val().length == 0) || (isNaN($('#to_price_1').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#description_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_1').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_1').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_1').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_1').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_1').focus();
		return false;
		
	} // end if	
	
	if ($('#hidden_code_1').val() != $('#security_code_1').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_1').focus();
		return false;
		
	} // end if	

} // end function

function checkPostForm_2(lang) {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_from').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_from').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_to').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_to').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price_2').val().length == 0) || (isNaN($('#from_price_2').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_2').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_2').val().length == 0) || (isNaN($('#to_price_2').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#description_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_2').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_2').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#password_del_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#password_del_2').focus();
		return false;
		
	} // end if	
	
	
	if ($('#hidden_code_2').val() != $('#security_code_2').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_2').focus();
		return false;
		
	} // end if	

} // end function

function checkPostFormUpdate_2(lang) {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( $('#subject_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก หัวข้อ' : 'Please Fill Subject';
		alert(text);
		$('#subject_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_from').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_from').focus();
		return false;
		
	} // end if	
	
	if ( $('#tran_to').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก สถานที่ขนย้าย' : 'Please Fill Place';
		alert(text);
		$('#tran_to').focus();
		return false;
		
	} // end if	
	
	if ( ($('#from_price_2').val().length == 0) || (isNaN($('#from_price_2').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_2').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_2').val().length == 0) || (isNaN($('#to_price_2').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#description_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก รายละเอียดเพิ่มเติม' : 'Please Fill Description';
		alert(text);
		$('#description_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_2').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_2').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_2').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_2').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_2').focus();
		return false;
		
	} // end if		
	
	if ($('#hidden_code_2').val() != $('#security_code_2').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_2').focus();
		return false;
		
	} // end if	

} // end function


function checkPostForm_3(lang) {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( ($('#check_section_province').val() == 0) && ($('#check_section_place').val() == 0) && ($('#check_section_bts').val() == 0) && ($('#check_section_mrt').val() == 0) && ($('#check_section_brt').val() == 0) && ($('#check_section_air').val() == 0) ) {
		
		text = (lang == 'th') ? 'กรุณาระบุสถานที่ที่ต้องการค้นหา' : 'กรุณาระบุสถานที่ที่ต้องการค้นหา';
		alert(text);
		return false;
		
	}
	
	if ( ($('#from_price_3').val().length == 0) || (isNaN($('#from_price_3').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_3').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_3').val().length == 0) || (isNaN($('#to_price_3').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_3').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_3').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_3').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_3').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_3').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_3').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_3').focus();
		return false;
		
	} // end if	
	
	if ( $('#password_del_3').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก Password' : 'Please Fill Password';
		alert(text);
		$('#password_del_3').focus();
		return false;
		
	} // end if	
	
	
	if ($('#hidden_code_3').val() != $('#security_code_3').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_3').focus();
		return false;
		
	} // end if	
	
	return true;

} // end function

function checkPostFormUpdate_3(lang) {
	
	var format_mail=/^([a-zA-Z0-9\_\-\.]{3,})+@([a-zA-Z0-9\-]{3,})+.+([a-zA-Z]{2,}|.+([a-zA-Z]{2,}))$/;

	var text;
	
	if ( ($('#check_section_province').val() == 0) && ($('#check_section_place').val() == 0) && ($('#check_section_bts').val() == 0) && ($('#check_section_mrt').val() == 0) && ($('#check_section_brt').val() == 0) && ($('#check_section_air').val() == 0) ) {
		
		text = (lang == 'th') ? 'กรุณาระบุสถานที่ที่ต้องการค้นหา' : 'กรุณาระบุสถานที่ที่ต้องการค้นหา';
		alert(text);
		return false;
		
	}
	
	if ( ($('#from_price_3').val().length == 0) || (isNaN($('#from_price_3').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#from_price_3').focus();
		return false;
		
	} // end if	
	
	if ( ($('#to_price_3').val().length == 0) || (isNaN($('#to_price_3').val())) ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ราคา' : 'Please Fill Price';
		alert(text);
		$('#to_price_3').focus();
		return false;
		
	} // end if	
	
	if ( $('#post_by_3').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก ชื่อผู้ประกาศ' : 'Please Fill Name';
		alert(text);
		$('#post_by_3').focus();
		return false;
		
	} // end if	
	
	if ( $('#contact_phone_3').val().length == 0 ) {
		
		text = (lang == 'th') ? 'กรุณากรอก เบอร์ติดต่อ' : 'Please Fill Phone Number';
		alert(text);
		$('#contact_phone_3').focus();
		return false;
		
	} // end if	
	
	if (!(format_mail.test($('#contact_email_3').val()))) {
		
		text = (lang == 'th') ? 'กรุณากรอก อีเมล์ติดต่อ' : 'Email Invalid';
		
		alert(text);	
		$('#contact_email_3').focus();
		return false;
		
	} // end if	
	
	if ($('#hidden_code_3').val() != $('#security_code_3').val()) {
		
		text = (lang == 'th') ? 'กรุณากรอกรหัสที่ปรากฎให้ถูกต้อง' : 'Security Code Invalid';
		alert(text);	
		$('#security_code_3').focus();
		return false;
		
	} // end if	

} // end function


function disbleTravelPostForm(mainObj, allObj, maxSelected, saveToObj) {
	
	var allSelected = 0;
	var aData = new Array();
	var objName = '';
	
	for(var i=1; i<=allObj; i++) {
		
		objName = mainObj + i;
		
		if (document.getElementById(objName).checked) {
			
			allSelected++;
			
		} // end if (document.getElementById(objName).checked) {
		
	} // end for(var i=1; i<=allObj; i++) {
		
	
	if (allSelected >= maxSelected) {
		
			for(var i=1; i<=allObj; i++) {
				
				objName = mainObj + i;
				
				if (document.getElementById(objName).checked) {

					document.getElementById(objName).disabled = false;

				} else { // end if (document.getElementById(objName).checked) {

					document.getElementById(objName).disabled = true;
					
				}
				
			} // end for(var i=1; i<=allObj; i++) {
		
	} else { // end if (allSelected >= maxSelected) {
		
			for(var i=1; i<=allObj; i++) {
				
				objName = mainObj + i;

				document.getElementById(objName).disabled = false;
				
			} // end for(var i=1; i<=allObj; i++) {
		
	} // if (allSelected >= maxSelected) {
	
	if (saveToObj != '') {
	
		$('#'+saveToObj).val(allSelected);
		
	}
	
} // end function

function getCityPostBoardRent() {
	
	$.ajax({
			type : 'GET',
			url : configInstallRootPath + 'ajaxFiles/getCity.php',
			data: "thai_province_id=" + $('#province_id').val(),
			success : function(data){
				
				var aData = new Array();
				
				aData = data.split('***');
				
				$('#showCity').html(aData[0]);
				
				$('#xlat').val(aData[1]);
				$('#xlng').val(aData[2]);
				
				$('#showCountry').html(aData[3]);
				$('#showOtherCountry').hide();
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getCityPostBoard() {
											   
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/getCityPostBoard.php',
			data: "thai_province_id=" + $('#sProvince_1').val(),
			success : function(data){
				
				$('#showCitySelect').html(data);
				
				if (document.getElementById('section_province').checked) { 
				
					$('#sProvince_1').show();
					$('#showCitySelect').show(); 
				
				} else { 
					
					$('#sProvince_1').hide();
					$('#showCitySelect').hide(); 
					$('#check_section_province').val(0);
				
				}
				
				getPlacePostBoard();
				$('#check_section_place').val(0);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getCityPostBoard_fb() {
											   
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/getCityPostBoard.php',
			data: "thai_province_id=" + $('#sProvince_1').val(),
			success : function(data){
				
				$('#showCitySelect').html(data);
				
				if (document.getElementById('section_province').checked) { 
				
					$('#sProvince_1').show();
					$('#showCitySelect').show(); 
				
				} else { 
					
					$('#sProvince_1').hide();
					$('#showCitySelect').hide(); 
					$('#check_section_province').val(0);
				
				}
				
				getPlacePostBoard_fb();
				$('#check_section_place').val(0);
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getPlacePostBoard() {
											   
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/getPlacePostBoard.php',
			data: "thai_province_id=" + $('#sProvince_1').val(),
			success : function(data){
				
				$('#showPlaceSelect').html(data);
				
				if (document.getElementById('section_place').checked) { 
				
					$('#showPlaceSelect').show(); 
				
				} else { 
					
					$('#showPlaceSelect').hide(); 
					$('#check_section_place').val(0);
				
				}
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function getPlacePostBoard_fb() {
											   
	$.ajax({
			type : 'POST',
			url : configInstallRootPath + 'ajaxFiles/getPlacePostBoard_fb.php',
			data: "thai_province_id=" + $('#sProvince_1').val(),
			success : function(data){
				
				$('#showPlaceSelect').html(data);
				
				if (document.getElementById('section_place').checked) { 
				
					$('#showPlaceSelect').show(); 
				
				} else { 
					
					$('#showPlaceSelect').hide(); 
					$('#check_section_place').val(0);
				
				}
				
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				;
			}
	});
	
} // end function

function checkAnswerLogin() {
	
	if ($('#message').val().length == 0) {
		
		alert('กรุณากรอก ข้อความ');
		$('#message').focus();
		return false;
		
	} // end if 
	
	if ($('#message_by').val().length == 0) {
		
		alert('กรุณากรอก ชื่อผู้ประกาศ');
		$('#message_by').focus();
		return false;
		
	} // end if 
	
	if ( $('#hidden_code').val() != $('#security_code').val() ) {
		
		alert('กรุณากรอก รหัส');
		$('#security_code').focus();
		return false;
		
	} // end if 
	
} // end function

function CheckAnswerNotLogin() {
	
	if ( ($('#username').val().length == 0) || !checkUsernameForm($('#username').val()) ) {
		
		alert('Username ต้องเป็นตัวอักษร A-Z, a-z, 0-9, _ , - เท่านั้น !');
		$('#username').focus();
		return false;
		
	} // end if
	
	if ( ($('#password').val().length == 0) || !checkUsernameForm($('#password').val()) ) {
		
		alert('Password ต้องเป็นตัวอักษร A-Z, a-z, 0-9, _ , - เท่านั้น !');
		$('#password').focus();
		return false;
		
	} // end if
	
	if ($('#message').val().length == 0) {
		
		alert('กรุณากรอก ข้อความ');
		$('#message').focus();
		return false;
		
	} // end if 
	
	if ($('#message_by').val().length == 0) {
		
		alert('กรุณากรอก ชื่อผู้ประกาศ');
		$('#message_by').focus();
		return false;
		
	} // end if 
	
	if ( $('#hidden_code').val() != $('#security_code').val() ) {
		
		alert('กรุณากรอก รหัส');
		$('#security_code').focus();
		return false;
		
	} // end if 
	
} // end function

function checkPostExpire() {
	
	if ($('#password_del').val().length == 0) {
		
		alert('กรุณากรอก รหัสผ่านประกาศ');
		$('#password_del').focus();
		return false;
		
	} // end if 
	
} // end function

function checkPostPosition() {
	
	if ($('#password_del').val().length == 0) {
		
		alert('กรุณากรอก รหัสผ่านประกาศ');
		$('#password_del').focus();
		return false;
		
	} // end if 
	
} // end function

function checkPostUpdate() {
	
	if ($('#password_del').val().length == 0) {
		
		alert('กรุณากรอก รหัสผ่านประกาศ');
		$('#password_del').focus();
		return false;
		
	} // end if 
	
} // end function

function checkPostDelete() {
	
	if ($('#password_del').val().length == 0) {
		
		alert('กรุณากรอก รหัสผ่านประกาศ');
		$('#password_del').focus();
		return false;
		
	} // end if 
	
} // end function

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
