//////////////////////////////
// Google Maps Javascript File
// Written by Ben Mathwig
// Courtesy of Google Maps API
//////////////////////////////

var map;
var directionsPanel;
var directions;

// Initialize the map function
function initialize() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(42.920477, -88.009707), 13);
        map.addControl(new GLargeMapControl());

        // Create Marker for Ski Hill
        var hill = new GMarker(new GLatLng(42.920477, -88.009707));
        var markertext = '<span class="btitle">Crystal Ridge</span>' + '<br />' +
		'<span>7900 W Crystal Ridge Dr</span>' + '<br />' + '<span class="baddress">Frankin, WI 53132</span>';
        map.addOverlay(hill);
        hill.openInfoWindowHtml(markertext); // Crystal Ridge Text Bubble

        //Add Directions Module
        directionsPanel = document.getElementById("directions");
        directions = new GDirections(map, directionsPanel);
    }
}

function goDirections() {
    var addresses;
    var fromAddress;

    fromAddress = document.getElementById("addressinput").value;
    addresses = 'from: ' + fromAddress + ' to: 7900 W Crystal Ridge Dr, Franklin, WI';

    directions.load(addresses);
}