


	








	
	



	
		



	
		
		
		var myDomain = document.domain.toLowerCase();
var gKeyCode = "ABQIAAAAbi2tWIrek9IOxX43Fwo9SBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxRINafIYHVoEFCNOOCpINzVDVQe1Q";
switch(myDomain) {
    case "dev.kohlerlearningcenter":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BSjDZLpJXo_du2tWQwDNaYys6pYphQb0wpFTlF4LYqaGZVJatOjJ_JPaQ';
        break;
    case "almond.kohlerco.com":
        gKeyCode = 'ABQIAAAA3yd9muKg0h5bUk6lriAKMhTSypxBklLygWYE-LBZ5YvHnCbGdxQX1iGHiDCIVyXYwnATE-di0s3fBA';
        break;
    case "review.kohlerlearningcenter2010.kohler.com":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BQpm4upNekmiHGw8TQkFSv8wj0QchT-OyWUUUzarxWiSumhtlmdOl3BMQ';
        break;
    case "preprod.kohlerlearningcenter2010.kohler.com":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BRDMsJisYuWCjLKQgbE4nka9PmpeRQac2DwfCpAtqxTWduvCdVRxoiCcg';
        break;
    case "prelaunch.kohlerlearningcenter2010.com":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BR0k4-aUqF03ka58szltmQQ-rKRVhRn9xZDUXBA6yMO4npNtdLAgyd3iw';
        break;
    case "www.kohlerlearningcenter.com":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BQBZFx7_HppHx5QRN0yBx0rk6xNQBRD93tgOkT_b6iYoeyI0TZEGhb8hA';
        break;
    case "kohlerlearningcenter.com":
        gKeyCode = 'ABQIAAAANYvoImiCivmC6Gkq9vCP_BTwwDsMZma7RhmtmMGwO7WvUPPdRBTUvy6WbbSMFumeafL7qg4wrize7w';
        break;
}
document.write('<script src=\"http://maps.google.com/maps?file=api&amp;v=2&amp;key=' + gKeyCode + '\"  type=\"text\/javascript\"><\/script>');

$(document).ready(function() {
    $(".locationName").click(function() {
        var index = $(".locationName").index(this);
        myclick(index);
        return false;
    });
});

/*
function correctPNG() {
    for(var i=0; i<document.images.length; i++) {
        var img = document.images[i];
        var imgName = img.src.toUpperCase();
        if (imgName.substring(imgName.length-3, imgName.length) == "PNG") {
            var imgID = (img.id) ? "id='" + img.id + "' " : "" var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
        }
    }
}
if (window.attachEvent) {
    window.attachEvent("onload", correctPNG);
}
*/

var start_location='';

// this variable will collect the html which will eventualkly be placed in the sidebar
var sidebar_html = "";
// arrays to hold copies of the markers and html used by the sidebar
// because the function closure trick doesnt work there
var gmarkers = [];
var htmls = [];
var i = 0;
// A function to create the marker and set up the event window
// This function picks up the click and opens the corresponding info window
function myclick(i) {
    gmarkers[i].openInfoWindowHtml(htmls[i]);
}

function setStartLocation(name) {			
start_location = name;			
}

function processStartLocation() {			
    switch(start_location){
    case "Blackwolf_Run":
    myclick(4);
    break;
    case "Whistling_Straits":
    myclick(9);
    break;
    }
}

function openForm(linkId) {
    if(linkId=='link1') {
        document.getElementById('from-here').style.display='block';
        document.getElementById('to-here').style.display='none';
    } else if(linkId=='link2') {
        document.getElementById('from-here').style.display='none';
        document.getElementById('to-here').style.display='block';
    }
}

// A function to create the marker and set up the event window
function createMarker(point,name,html,addy,iconPrefix) {
    var dirLink = '<span class="tiny">Directions: &nbsp;<a href="javascript:void(0)" id="link1" onclick="openForm(this.id);" style="text-decoration:underline;">From here</a>&nbsp;-&nbsp;<a href="javascript:void(0)" id="link2" style="text-decoration:underline;" onclick="openForm(this.id);">To here</a></span><br><div id="from-here" style="display:none;"><form action="http://maps.google.com/maps" method="get"><input type="text" SIZE=20 MAXLENGTH=240 name="saddr" id="saddr" value="" /><br><INPUT ID="SUBMIT" TYPE="SUBMIT" VALUE="Get directions from here."><input type="hidden" name="daddr" value="'+ addy +'" /><input type="hidden" name="hl" value="en" /></form></div><div id="to-here" style="display:none;"><form action="http://maps.google.com/maps" method="get"><input type="text" SIZE=20 MAXLENGTH=400 name="daddr" id="daddr" value="" /><br><INPUT ID="SUBMIT" TYPE="SUBMIT" VALUE="Get directions to here."><input type="hidden" name="saddr" value="'+ addy +'" />	<input type="hidden" name="hl" value="en" /></form></div>';
    // FF 1.5 fix
    html = '<div style="white-space:nowrap;">' + "<strong>" + name + '</strong><br />' + html + '<p>' + dirLink + '</div>';
    var marker = new GMarker(point);
    if (iconPrefix != null) 
    {
    var icon = new GIcon();
    icon.image = iconPrefix;
    icon.iconSize = new GSize(17, 27);
    icon.iconAnchor = new GPoint(17, 27);
    icon.infoWindowAnchor = new GPoint(8, 10);
    marker = new GMarker(point,icon);
    }
    GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml(html);}
    );
    
    // save the info we need to use later for the sidebar
    gmarkers[i] = marker;
    htmls[i] = html;
    i++
    return marker;
}

function mapload()
{
    if (GBrowserIsCompatible()) 
    {
        // create the map
        var map = new GMap(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.centerAndZoom(new GPoint(-87.779987, 43.740794), 3);

        var bounds = new GLatLngBounds();
        var geocoder = new GClientGeocoder();

        // add the points    
        var locations = $("#mapcontainer .location");
        for (var i = 0; i < locations.size(); i++) {
            var loc = locations.get(i);
            (function() {
                var name = $(loc).find(".locationName").text();
                var iconSrc = $(loc).find("img").get(0).src;
                var street = $(loc).find(".locationAddress").text();
                var city = $(loc).find(".locationCity").text();
                var state = $(loc).find(".locationState").text();
                var postalCode = $(loc).find(".locationPostalCode").text();
                var address = street;
                if (address == "901 Lower Road") {
                    address = "809 Lower Falls Road";   // Google maps doesnt quite get this geocoded correctly, so we put in a special case here.
                }
                address = address + ", " + city;
                address = address + ", " + state;
                address = address + " " + postalCode;
                var addressHtml = street + "<br/>" + city + ", " + state + " " + postalCode;

                geocoder.getLatLng(address, function(point) { 
                    if (point) {
                        var marker = createMarker(point, name, addressHtml, address, iconSrc);
                        map.addOverlay(marker);

                        bounds.extend(point);
                        map.setZoom(map.getBoundsZoomLevel(bounds));
                        map.setCenter(bounds.getCenter());
                    }
                });
            })();
        }

        
        //processStartLocation();
    }
    else 
    {
        //alert("Sorry, the Google Maps API is not compatible with this browser");
        var mapDiv = document.getElementById("map");
        var imageRootPath = "/common/images/";
        var imgName = "";
        switch (start_location) {
        case "Blackwolf_Run":
        imgName = "blackwolf_map.jpg";
        break;
        case "Whistling_Straits":
        imgName = "whistlingStrates_static.jpg";
        break;
        default:
        imgName = "dk_mapStatic.gif";
        }
        var imgStr = "<img src=\"" + imageRootPath + imgName + "\">"
        if (mapDiv != null) 
        {
            mapDiv.innerHTML = imgStr;
        }
    }
}

if (window.addEventListener) //DOM method for binding an event
{
    window.addEventListener("load", mapload, false);
}
else if (window.attachEvent) //IE exclusive method for binding an event
{
    window.attachEvent("onload", mapload);
    //window.detachEvent("onload", correctPNG);
}
else if (document.getElementById) //support older modern browsers
{
    window.onload=mapload;	
}




	
	
						
				



	
	
						
				



	
	
						
				


