﻿var oldonload = window.onload;
if (typeof window.onload != 'function') {
	window.onload = load;
} else {
	window.onload = function() {
		if (oldonload) {
			oldonload();
		}
		load();
	}
}

function load()
{
    try
    {
        if (GBrowserIsCompatible())
        {
            var map = new GMap2(document.getElementById("map"));
            var maplat = new String(document.forms[0].txtResortLat.value);
            var maplng = new String(document.forms[0].txtResortLng.value);
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            // Create our "sunny" marker icon
            var icon = new GIcon();
            icon.image = "images/marker.png";
            icon.shadow = "images/shadow50.png";
            icon.iconSize = new GSize(20, 34);
            icon.shadowSize = new GSize(37, 34);
            icon.iconAnchor = new GPoint(6, 20);
            icon.infoWindowAnchor = new GPoint(5, 1);
            map.setCenter(new GLatLng(maplat, maplng), 10);
            var point = new GLatLng(maplat, maplng);
            //map.addOverlay(new GMarker(point, icon));
            map.addOverlay(new GMarker(point));

        }
    }
    catch(e)
    {
        //if (document.getElementById)
        {
            // DOM3 = IE5, NS6
            //    document.getElementById("map").style.visibility = "hidden";
            //
        }
        //else
        {
            //    if (document.layers)
            {
                // Netscape 4
                //        document.map.visibility = "hidden";
                //
            }
            //    else
            {
                // IE 4
                //        document.all.map.style.visibility = "hidden";
                //
            }
            //
        }
    }
}
// A TextualZoomControl is a GControl that displays textual "Zoom In"
// and "Zoom Out" buttons (as opposed to the iconic buttons used in
// Google Maps).
function TextualZoomControl()
{
}
try
{
    TextualZoomControl.prototype = new GControl();
}
catch(e)
{
    //if (document.getElementById)
    {
        // DOM3 = IE5, NS6
        //    document.getElementById("map").style.visibility = "hidden";
        //
    }
    //else
    {
        //    if (document.layers)
        {
            // Netscape 4
            //        document.map.visibility = "hidden";
            //
        }
        //    else
        {
            // IE 4
            //        document.all.map.style.visibility = "hidden";
            //
        }
        //
    }
}
// Creates a one DIV for each of the buttons and places them in a container
// DIV which is returned as our control element. We add the control to
// to the map container and return the element for the map class to
// position properly.
TextualZoomControl.prototype.initialize = function(map)
{
    try
    {
        var container = document.createElement("div");
        var zoomInDiv = document.createElement("div");
        this.setButtonStyle_(zoomInDiv);
        container.appendChild(zoomInDiv);
        zoomInDiv.appendChild(document.createTextNode("Zoom In"));
        GEvent.addDomListener(zoomInDiv, "click", function()
        {
            map.zoomIn();
        }
        );
        var zoomOutDiv = document.createElement("div");
        this.setButtonStyle_(zoomOutDiv);
        container.appendChild(zoomOutDiv);
        zoomOutDiv.appendChild(document.createTextNode("Zoom Out"));
        GEvent.addDomListener(zoomOutDiv, "click", function()
        {
            map.zoomOut();
        }
        );
        map.getContainer().appendChild(container);
        return container;
    }
    catch(e)
    {
        //if (document.getElementById)
        {
            // DOM3 = IE5, NS6
            //document.getElementById("map").style.visibility = "hidden";
            //
        }
        //else
        {
            //    if (document.layers)
            {
                // Netscape 4
                //        document.map.visibility = "hidden";
                //
            }
            //    else
            {
                // IE 4
                //        document.all.map.style.visibility = "hidden";
                //
            }
            //
        }
    }
}
// By default, the control will appear in the top left corner of the
// map with 7 pixels of padding.
TextualZoomControl.prototype.getDefaultPosition = function()
{
    return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
}
// Sets the proper CSS for the given button element.
TextualZoomControl.prototype.setButtonStyle_ = function(button)
{
    button.style.textDecoration = "underline";
    button.style.color = "#0000cc";
    button.style.backgroundColor = "white";
    button.style.font = "small Arial";
    button.style.border = "1px solid black";
    button.style.padding = "2px";
    button.style.marginBottom = "3px";
    button.style.textAlign = "center";
    button.style.width = "6em";
    button.style.cursor = "pointer";
}