// JScript File

function showAddress(address, map, description)
{
    var geocoder = new GClientGeocoder();
    
    geocoder.getLatLng(address,
        function(point)
        {
            if (!point) 
            {
            }
            else
            {
		        var icon = new GIcon();
		        icon.image = "/static/images/maps-marker.png";
		        icon.iconSize = new GSize(41, 38);
		        icon.iconAnchor = new GPoint(20, 30);
		        icon.infoWindowAnchor = new GPoint(20, -10);            
            
                map.setCenter(point, 17, G_NORMAL_MAP);
                var marker = new GMarker(point, icon);
                map.addOverlay(marker);
                
                if (description != '')
                {
                    GEvent.addListener(marker, "mouseover", function() {
                    marker.openInfoWindowHtml(description)});

                    GEvent.addListener(marker, "mouseout", function() {
                    map.closeInfoWindow();});                     
                }
            }
        }
    );
}

function showAddress2(address, map, url, information, zoom)
{
    var geocoder = new GClientGeocoder();
    
    geocoder.getLatLng(address,
        function(point)
        {
            if (!point) 
            {
            }
            else
            {
		        var icon = new GIcon();
		        icon.image = "/static/images/maps-marker.png";
		        icon.iconSize = new GSize(41, 38);
		        icon.iconAnchor = new GPoint(20, 30);
		        icon.infoWindowAnchor = new GPoint(20, -10);            
            
                map.setCenter(point, zoom, G_NORMAL_MAP);
                var marker = new GMarker(point, icon);
                map.addOverlay(marker);

                GEvent.addListener(marker, "mouseover", function() {
                marker.openInfoWindowHtml(information)});

                GEvent.addListener(marker, "mouseout", function() {
                map.closeInfoWindow();});       
                
                GEvent.addListener(marker, "click", function() {
                	window.location = url;
                });
            }
        }
    );
}

function showAddressAndCenter(address, map, url, information, zoom)
{
    var geocoder = new GClientGeocoder();
    
    geocoder.getLatLng(address,
        function(point)
        {
            if (!point) 
            {
            }
            else
            {
                var icon = new GIcon();
		        icon.image = "/static/images/maps-marker.png";
		        icon.iconSize = new GSize(41, 38);
		        icon.iconAnchor = new GPoint(20, 30);
		        icon.infoWindowAnchor = new GPoint(20, -10);

                map.setCenter(point, zoom, G_NORMAL_MAP);
                var marker = new GMarker(point, icon);
                map.addOverlay(marker);
                
                GEvent.addListener(marker, "mouseover", function() {
                marker.openInfoWindowHtml(information)});

                GEvent.addListener(marker, "mouseout", function() {
                map.closeInfoWindow();});                
                  
                GEvent.addListener(marker, "click", function() {
                	window.location = url;
                });
            }
        }
    );
}

function showArea(address, map, zoom)
{
    var geocoder = new GClientGeocoder();
    geocoder.getLatLng(address,
        function(point)
        {
            if (!point) 
            {
            }
            else
            {
                map.setCenter(point, zoom, G_NORMAL_MAP);
            }
        }
    );
}



function setPoint(lat, lng, map, url, information, zoom)
{
    var icon = new GIcon();
    icon.image = "/static/images/maps-marker.png";
    icon.iconSize = new GSize(41, 38);
    icon.iconAnchor = new GPoint(20, 30);
    icon.infoWindowAnchor = new GPoint(20, -10);            

    var point = new GLatLng(lat, lng);
    map.setCenter(new GLatLng(lat, lng), zoom, G_NORMAL_MAP);
    var marker = new GMarker(point, icon);
    map.addOverlay(marker);
    
    GEvent.addListener(marker, "mouseover", function() {
    marker.openInfoWindowHtml(information)});

    GEvent.addListener(marker, "mouseout", function() {
    map.closeInfoWindow();});                

    GEvent.addListener(marker, "click", function() {
    	window.location = url;
    });
}


function setPoint2(lat, lng, map)
{
    var icon = new GIcon();
    icon.image = "/static/images/maps-marker.png";
    icon.iconSize = new GSize(41, 38);
    icon.iconAnchor = new GPoint(20, 30);
    icon.infoWindowAnchor = new GPoint(20, -10);            

    var point = new GLatLng(lat, lng);
    map.setCenter(new GLatLng(lat, lng), 14, G_NORMAL_MAP);
    var marker = new GMarker(point, icon);
    map.addOverlay(marker);   
}
