function checkEvaluateForm() {
	var building = $('evaBuilding').value;
	if (isEmpty(building) || (building.length > 3 || !isNumber(building))) {
		alert('楼号必须为3位内的整数！');
		return false;
	}
	var housingNo = $('evaHousingNo').value;
	if (isEmpty(housingNo) || (housingNo.length > 4 || !isNumber(housingNo))) {
		alert('门牌号必须为4位以内的整数！');
		return false;
	}
	var areaSize = $('evaAreaSize').value;
	if (isEmpty(areaSize)) {
		alert('建筑面积为必填项！');
		return false;
	}
	if (!isNumber(areaSize) && !isTwoDimensionDouble(areaSize)) {
		alert('建筑面积必须为整数或2位小数的浮点数！');
		return false;
	}
	var floor = $('evaFloor').value;
	var totalFloor = $('evaTotalFloor').value;
	if (isEmpty(floor) || isEmpty(totalFloor)) {
		alert('楼层为必填项！');
		return false;
	}
	if (!isNumber(floor) || !isNumber(totalFloor)) {
		alert('楼层必须为整数！');
		return false;
	}
	if ((totalFloor - 0) < (floor - 0)) {
		alert('总楼层必须大于房屋所在楼层！');
		return false;
	}
	return true;
}
var maxLon=0,maxLat=0;
var minLon=0,minLat=0;
var isGoogleRequest = false;
var isMapbarRequest = false;

function showMapBar() {
	$("list_ditu_mapbar_handler").style.backgroundImage = "url(/theme/ie/images/realestate/tag_ditu_on.gif)";
	$("list_ditu_google_handler").style.backgroundImage = "url(/theme/ie/images/realestate/tag_wxt_off.gif)";
		
	$("mapbar").style.display = "";
	$("map").style.display = "none";
}
function initGoogleMap() {
	document.getElementsByTagName("body")[0].onunload = function() {
		GUnload();
	}
}
var gmap;
function showGoogle() {
	$("list_ditu_mapbar_handler").style.backgroundImage = "url(/theme/ie/images/realestate/tag_ditu_off.gif)";
	$("list_ditu_google_handler").style.backgroundImage = "url(/theme/ie/images/realestate/tag_wxt_on.gif)";
		
	$("mapbar").style.display = "none";
	$("map").style.display = "";
	if(!isGoogleRequest) {
		if (gmap == null) {
			var count = 0;
			var lonValueNode = null;
			var latValueNode = null;
			var lonValue = 0;
			var latValue = 0;
			var strll = null;
			var moyaIcon = null;
			var centerPoint = new google.maps.LatLng((maxLat+minLat)/2,(maxLon+minLon)/2);
			var myOptions = {
		      zoom: 14,
		      center: centerPoint,
		      mapTypeId: google.maps.MapTypeId.SATELLITE
		    };
			gmap = new google.maps.Map(document.getElementById("map"), myOptions);
			
			while(true) {    
				lonValueNode = $('longitude'+count);
				if(lonValueNode == null) {
					break;
				}
				latValueNode = $('latitude'+count);
				lonValue = lonValueNode.value - 0;
				latValue = latValueNode.value - 0;
									
				moyaIcon = getMoyaIcon('false');
				
				var point = new google.maps.LatLng(latValue,lonValue);
				createMarker(point,moyaIcon,count);
					
				count ++;
			}
	    }
	}
}
function createMarker(point, moyaIcon, count) {
	var housingContent = "";
	if(count > -1) {
		housingContent = "<table><tr><td class='area'>" + $('propName'+count).value + "</td></tr></table>";
	}
		
	var infowindow = new google.maps.InfoWindow(
	    { content: housingContent,
	      size: new google.maps.Size(50,50)
	    });
	    
	var marker = new google.maps.Marker({
	    position: point, 
	    map: gmap, 
	    icon: moyaIcon
	}); 
	google.maps.event.addListener(marker, 'click', function() {
	    infowindow.open(gmap,marker);
	    });
}
function onMapLoad(){	
	var isCentered = false;
	var count = 0;
	var lonValueNode = null;
	var latValueNode = null;
	var lonValue = 0;
	var latValue = 0;
	var strll = null;
	maplet = new Maplet("mapbar");  
    maplet.addControl(new MStandardControl()); 
	while(true) {
		lonValueNode = $('longitude'+count);
		if(lonValueNode == null) {
			break;
		}
		latValueNode = $('latitude'+count);
		lonValue = lonValueNode.value - 0;
		latValue = latValueNode.value - 0;
		

		var longitude = lonValue;
		var latitude = latValue;	
		var housingContent = "<table><tr><td class='area'>" + $('propName'+count).value + "</td></tr></table>";
		
	    var marker = new MMarker(  
	    	    new MPoint(longitude,latitude),
	    	    new MIcon(moyaIconString,32,32),
	    	    new MInfoWindow($('propName'+count).value,housingContent)
	    	);  
	    	  
	    maplet.addOverlay(marker);
	    
		if(count == 0) {
			maxLon = lonValue;
			maxLat = latValue;
			minLon = lonValue;
			minLat = latValue;
		}else {
			if(lonValue > maxLon) {
				maxLon = lonValue;
			}else {
				if(lonValue < minLon) {
					minLon = lonValue;
				}
			}
			if(latValue > maxLat) {
				maxLat = latValue;
			}else {
				if(latValue < minLat) {
					minLat = latValue;
				}
			}
		}
		count ++;
	}

	maplet.centerAndZoom(new MPoint((maxLon+minLon)/2,(maxLat+minLat)/2), 14);
}

	function postHousing() {
		var propertyName = $('sellPropertyName').value;
		if (isEmpty(propertyName)) {
			alert('请输入小区名称，25个汉字以内！');
			return false;
		}
		if (propertyName.length > 25) {
			alert('您输入的小区名称过长，25个汉字以内！');
			return false;
		}		
		var building = $('sellBuilding').value;
		if (!isEmpty(building) && (building.length > 3 || !isNumber(building))) {
			alert('楼号必须为3位整数！');
			return false;
		}
		var housingNo = $('sellHousingNo').value;
		if (!isEmpty(housingNo) && (housingNo.length > 5 || !isNumber(housingNo))) {
			alert('门牌号必须为5位整数！');
			return false;
		}
		var floor = $('sellFloor').value;
		var totalFloor = $('sellTotalFloor').value;
		if (!isNumber(floor) || !isNumber(totalFloor)) {
			alert('楼层必须为整数！');
			return false;
		}
		var areaSize = $('sellAreaSize').value;
		if (!isNumber(areaSize) && !isTwoDimensionDouble(areaSize)) {
			alert('建筑面积必须为整数或浮点数！');
			return false;
		}
		var price = $('sellPrice').value;
		if (!isNumber(price)) {
			alert('价格必须为整数！');
			return false;
		}
		var note = $('sellNote').value;
		if (note != null && note.length >= 200) {
			alert('描述需在200字以内！');
			return false;
		}
		var customerName = $('sellCustomerName').value;
		if (isEmpty(customerName)) {
			alert('请输入您的姓名！');
			return false;
		}
		var customerPhone = $('sellCustomerPhone').value;
		if (!isMobilePhone(customerPhone)) {
			alert('联系电话为8或11位数字！');
			return false;
		}
		$('sellSubmitBtn').disabled = 'disabled';
		$('sellResetBtn').disabled = 'disabled';
		$('sendMsgSuccess').style.display = '';
		return true;
	}
	function postHousingHandler(result, msg) {
		if (result == 0) {
			$('sendMsgSuccess').style.display = '';
		} else {
			alert(msg);
		}
	}
