<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="googlemap.aspx.cs" Inherits="HeyuanHouse.Web.member.googlemap" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>地图标注(GoogleMap)--河房网 - 专业的房产信息交易平台 - www.0762h.com</title>
<link href="/images/style.css" rel="stylesheet" type="text/css" />
<link type="text/css" href="../editor/jquery/theme/redmond/jquery-ui-custom.css" rel="stylesheet" />	
<script type="text/javascript" src="../editor/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../editor/jquery/jquery-ui-custom.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
  var iscanmake = false ;
  var map , latlng;
  var marker ;
  function mapInit() {
    var myLatlng = new google.maps.LatLng(23.744163443960495, 114.69630002975464);
    var myOptions = {
      zoom: 15,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map"), myOptions);
    
    google.maps.event.addListener(map, 'click', function(event) {
       if (iscanmake)
       {
          placeMarker(event.latLng);
       }
    });
  }
  
//  function addMarker(location) {
//    marker = new google.maps.Marker({
//      position: location,
//      map: map
//    });
//    markersArray.push(marker);
//  }
  function placeMarker(location) {
     var clickedLocation = new google.maps.LatLng(location);
     if (marker)
       marker.setMap(null);
       
     marker = new google.maps.Marker({
        position: location, 
        map: map,
        title:"房源位置"
     });
    latlng = location ;
    marker.setMap(map) ; 
  }
  function startMark()
  {
      iscanmake = true ;
  }
  
  function okMark()
  {
       if (latlng != undefined)
       {
           window.parent.document.getElementById("txtmaplnglat").value = latlng ;
       }
       window.parent.document.getElementById("btnCloseMapFrame").click();
  }
</script>
</head>
<body onload="mapInit();" style="margin:0px ; padding:0px">
<div id="map" style="width: 600px; height: 330px;"></div>
<input type="button" value="开始标注" onclick="startMark();" />
<input type="button" value="确定标注" onclick="okMark();" />
</body>
</html>