var def_x=-78.6976432800293;
var def_y=42.839660611515995;
homeicon= new GIcon(); 
homeicon.image = 'http://www.marrano.com/favicon.ico';
homeicon.shadow = '';
homeicon.iconSize = new GSize(20, 20);
homeicon.shadowSize = new GSize(20, 20);
homeicon.iconAnchor = new GPoint(10, 10);
homeicon.infoWindowAnchor = new GPoint(5, 1);

function mark(aid, town, htype)
{
 if (!document.getElementById('map')) return true;
 if (GBrowserIsCompatible()) 
 {
  map.clearOverlays();
  for (i=0; i<mapcoor.length; i++)
  {
    if (aid == 0 || mapcoor[i][2]==aid || (mapcoor[i][3]==town && mapcoor[i][4]==htype) || (mapcoor[i][4]==htype && town==''))
    {
     if (mapcoor[i][6]) 
     {
       xtra_overlay(i);
     }
     point = new GLatLng(mapcoor[i][1], mapcoor[i][0]);
     var marker = new GMarker(point, {id: mapcoor[i][2], title: str, icon: homeicon, draggable: false, bouncy: false});
     GEvent.addListener(marker, "mouseover", function() {highlight(this.id, 1);} );
     GEvent.addListener(marker, "mouseout", function() {highlight(this.id, 0);} );
     GEvent.addListener(marker, "click", function() {highlight(this.id, 3);} );
     map.addOverlay(marker);
    }
  }
 }
}
function highlight(aid, t)
{
 if (t==3) 
 {
 if (document.getElementById("AREA" + aid))
  { if (document.getElementById("AREA" + aid).href) window.location.href=document.getElementById("AREA" + aid).href; }
 else {if (aid>0) window.location.href="/communities/community.asp?uid="+aid;}
 }
 if (document.getElementById("AREA" + aid))
 {
  o=document.getElementById("AREA" + aid).style
  if (t==1) {o.backgroundColor="#b79527"; o.color="black"; o.border="5px solid #b79527"}
  else {o.backgroundColor=""; o.color=""; o.border=""}
 }
}

function set_point(map, z, addr)
{
 geocoder = new GClientGeocoder();
 if (geocoder) 
 {
  geocoder.getLatLng(addr, function(point) 
			{
			if (point) { map.setCenter(point, z); mark_after_geo();} 
			else {map.setCenter(new GLatLng(def_y, def_x), z); mark_after_geo();}
			}
		)
 }
}

function lrg_map(uid, ustr, unav, utitle, uaddr)
{
 var x='', y='', id='';
  for (i=0; i < mapcoor.length; i++)
  {
   if ( (uid == 0 || uid == mapcoor[i][2]) && (ustr == '' || ustr == mapcoor[i][3]))
   {
    x=x+ "," + mapcoor[i][0];
    y=y+ "," + mapcoor[i][1];
    id=id+ "," + mapcoor[i][2];
   }
  }
  if (x.length > 0)  x=x.substr(1);
  if (y.length > 0)  y=y.substr(1);
  if (id.length > 0)  id=id.substr(1);
  if (unav=='') unav='<div style="color: #b79527;">&nbsp;<a class="breadcrumb" href="/">Home</a> > <a class="breadcrumb" href="/communities">Communities</a> > <span style="color: #000; font-size: 11px;">Map</span></div>';
  window.location.href='/inc/maplrg.asp?nav=' + encodeURIComponent(unav) + '&addr=' + encodeURIComponent(uaddr) + '&title=' + encodeURIComponent(utitle) + '&xs=' + x + '&ys=' + y + '&ids=' + id;
}
