

// Create a LatLngBounds object
var bounds = new google.maps.LatLngBounds();

var infoOptions = { content: '<div style="width:50px; height:50px">Here</div>',
    maxWidth: 100,
    disableAutoPan: true };
var infowindow = new google.maps.InfoWindow(infoOptions);

var gm={};

  function initMap() {
    var myOptions = {
      zoom: 18,
      center: center,
      scaleControl: true,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }
//      NavigationControlStyle: ANDROID
    };
   
    gm.map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        
    var cross = new google.maps.MarkerImage('http://www.orlandogolfhomepro.com/images/crosshairs.gif',new google.maps.Size(30,30),new google.maps.Point(0,0),new google.maps.Point(16,16));
    gm.crosshairs = new google.maps.Marker({ position:center, visible:false, map:gm.map, icon:cross, zIndex:3 });

   bounds.extend(center);

   addMarkers(gm.map);
   
   gm.map.fitBounds(bounds);

}

//    function displayHome(url)
//    {
//     content.style.visibility="hidden";
//     document.getElementById("homeframe").src = url;
//     home.style.visibility="visible";
//    }
    
//    function displayCommunity(url)
//    {
//     var rg = new RegExp(url,"$");
//     var str = parent.location.href;
//     if (str.search(rg) < 0)
//     {
//      alert(str+' -> '+url);
//      parent.location.href=url;
//     }
//     else
//     {
//      alert("same parent");
//      parent.home.style.visibility="hidden";
//      parent.content.style.visibility="visible";
//     }
//    }

    function AddMarker(map, title, lat, lng, link, image, width, height, description)
    {
     var latlng = new google.maps.LatLng(lat,lng);
     var marker = new google.maps.Marker({ position: latlng, map: map, title: title, icon: 'http://www.orlandogolfhomepro.com/images/golfball_32.gif', zIndex:1 });
     google.maps.event.addListener(marker, 'mouseover', function() { showTip(image,description); });
     google.maps.event.addListener(marker, 'mouseout', function() { hideTip(); });
     google.maps.event.addListener(marker, 'click', function() { location.href=link; });        
//     google.maps.event.addListener(marker, 'click', function() { infowindow.setContent('<img align=left width='+width+' height='+height+' vspace=4 hspace=4 src="'+image+'"><font face="Verdana" size=1>'+description+'</font>'); infowindow.open(map,marker); });
//     google.maps.event.addListener(marker, 'mouseout', function() {infowindow.close(); });
//     google.maps.event.addListener(marker, 'dblclick', function() { location.href=link; });        
     bounds.extend(latlng);
    }

    function AddClub(map, title, lat, lng, link, image, width, height, description) // just like AddMarker but without the bounds extend - used on the other communities when zooming out
    {
     var latlng = new google.maps.LatLng(lat,lng);
     var marker = new google.maps.Marker({ position: latlng, map: map, title: title, icon: 'http://www.orlandogolfhomepro.com/images/golfball_32.gif', zIndex:2 });
     google.maps.event.addListener(marker, 'mouseover', function() { showTip(image,description); });
     google.maps.event.addListener(marker, 'mouseout', function() { hideTip(); });
     google.maps.event.addListener(marker, 'click', function() { location.href=link; });        
//     google.maps.event.addListener(marker, 'click', function() { infowindow.setContent('<img align=left width='+width+' height='+height+' vspace=4 hspace=4 src="'+image+'"><font face="Verdana" size=1>'+description+'</font>'); infowindow.open(map,marker); });
//     google.maps.event.addListener(marker, 'mouseout', function() {infowindow.close(); });
//     google.maps.event.addListener(marker, 'dblclick', function() { location.href=link; });        
//     bounds.extend(latlng);
    }

//      oghp.house.push({ street:"9731 chestnut ridge", lat:28.49257,lng:-81.522389,url:"O4864044.htm",img:"../photos/O4864044_101_12.jpg",wid:80,hgt:62,dsc:"<table border=0 width=100% cellspacing=0><tr><th colspan=4><a href='O4864044.htm' target='_top'>9731 CHESTNUT RIDGE DR</A></TH></TR><tr><td width=25% align=right><B>Price:</B></td><td width=25%>$ 1,500,000</td><td width=25% align=right><B>Bedrooms:</B></td><td width=25%>4</td></tr><tr><td align=right><B>SqFt:</B></td><td>4785</td><td align=right><B>Full Baths:</B></TD><td>4</td></tr><tr><td align=right><B>Year Built:</B></td><td>1986</td><td align=center colspan=2><I>None</I></td></tr>    <tr><td colspan=4><center>Listed by: IRWIN REALTY GROUP LLC</center></td></tr>   </TABLE>" });
    function AddHouse(map, street, lat, lng, link, image, width, height, description)
//    function AddHouse(map, h{})
    {
     var latlng = new google.maps.LatLng(lat,lng);
     var marker = new google.maps.Marker({ position: latlng, map: map, title: street, icon: 'http://www.orlandogolfhomepro.com/images/home.png', zIndex:0 });
     google.maps.event.addListener(marker, 'mouseover', function() { showHome(image,description); });
     google.maps.event.addListener(marker, 'mouseout', function() { hideTip(); });
     google.maps.event.addListener(marker, 'click', function() { location.href=link; }); // displayHome(link); });        
//     google.maps.event.addListener(marker, 'click', function() { infowindow.setContent('<img align=left width='+width+' height='+height+' vspace=4 hspace=4 src="'+image+'"><font face="Verdana" size=1>'+description+'</font>'); infowindow.open(map,marker); });
//     google.maps.event.addListener(marker, 'mouseout', function() {infowindow.close(); });
//     google.maps.event.addListener(marker, 'dblclick', function() { location.href=link; });        
     bounds.extend(latlng);
    }

    function PointTo(lat,lng)
    {
     var latlng = new google.maps.LatLng(lat,lng);
     gm.crosshairs.setPosition(latlng);
     gm.crosshairs.setVisible(true);
//     infowindow.setPosition(latlng);
//     infowindow.open(gm.map);
//     alert("Point to "+lat+","+lng);
//     var xy = new google.maps.Point(200,100);
//     var xy = gm.map.fromLatLngToDivPixel(latlng);
//     alert("left="+xy.x+" - top="+xy.y);
//     document.getElementById("crosshairs").style.left=xy.x-15;
//     document.getElementById("crosshairs").style.top=xy.y-15;
//     document.getElementById("crosshairs").style.visibility=visible;
    }
    function UnPoint()
    {
//     infowindow.close();
//     document.getElementById("crosshairs").style.visibility=hidden;
     gm.crosshairs.setVisible(false);
//     gm.crosshairs.map
    }    
    
function initialize() { initTip(); initMap(); }

//window.onload = initialize;
