// JavaScript Document
		function loadContent(content,url,id) {
			var contents='#'+content;
			$(contents).load(url+"?id="+id+"&rands="+Math.random());
		}
		
$(document).ready(function() {
	
$('#btnSubmit').click(function(){
			if ($('#subject').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ หัวข้อ');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#price').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ ราคา');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#area').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ เนื้อที่');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#geo_id :selected').val() == 0)
			{
				$('#spanMsgAlert').html('กรุณาเลือก ภาค');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#province_id :selected').val() == 0)
			{
				$('#spanMsgAlert').html('กรุณาเลือก จังหวัด');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#amphur_id :selected').val() == 0)
			{
				$('#spanMsgAlert').html('กรุณาเลือก อำเภอ');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#detail').val() == "")
			{
				$('#txtDescription').focus();
				$('#spanMsgAlert').html('กรุณาระบุ รายละเอียด');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#name').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ ชื่อผู้ประกาศ');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#tel').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ โทรศัพท์');
				$('#divAlert').dialog('open');
				return false;
			}
			if ($('#email').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ email');
				$('#divAlert').dialog('open');
				return false;
			}
		if ($('#password').val() == "")
			{
				$('#spanMsgAlert').html('กรุณาระบุ รหัสผ่าน');
				$('#divAlert').dialog('open');
				return false;
			}
			$('#divConfirm').dialog('open');
			return false;
		});
		
//dialog alert
		$("#divAlert").dialog({
			autoOpen: false, 
			bgiframe: true,
			resizable: false,
			modal: true,
			buttons: {
				'ตกลง': function() {
					$(this).dialog('close');
				}
			}
		});
	
//confirm	post
		$("#divConfirm").dialog({
			autoOpen: false, 
			bgiframe: true,
			resizable: false,
			modal: true,
			overlay: {
				backgroundColor: '#000',
				opacity: 0.5
			},
			buttons: {
				'ตกลง': function() {
					$("#progressbar").progressbar({value: 100});
					$("#divProgressbar").dialog('open');
					$('#form1').submit();
					$(this).dialog('close');
				},
				'ยกเลิก': function() {
					$(this).dialog('close');
				}
			}
		});
		
//progress bar
		$("#divProgressbar").dialog({
			autoOpen: false, 
			bgiframe: true,
			resizable: false,
			modal: true
		});
		
//thumb
$("ul.thumb li").hover(function() {
	$(this).css({'z-index' : '10'});
	$(this).find('img').addClass("hover").stop()
		.animate({
			marginTop: '-90px', 
			marginLeft: '-100px', 
			top: '50%', 
			left: '50%', 
			width: '150px', 
			height: '120px',
			padding: '20px' 
		}, 200);
	
	} , function() {
	$(this).css({'z-index' : '0'});
	$(this).find('img').removeClass("hover").stop()
		.animate({
			marginTop: '0', 
			marginLeft: '0',
			top: '0', 
			left: '0', 
			width: '65px', 
			height: '65px', 
			padding: '5px'
		}, 400);
});
 
//Swap Image on Click
	$("ul.thumb li a").click(function() {
		
		var mainImage = $(this).attr("href"); //Find Image Name
		$("#main_view img").attr({ src: mainImage });
		return false;		
	});
		
});

		function dochangeQ()
		{
					var province_id=$('#province_id').val();
					$('#amphur_div').load('/modules/property/province2.php'+"?province_id="+province_id+"&rands="+Math.random());
		};
