﻿var oldmap;
var currentmap;



$(document).ready(function () {


    if (!($.browser.msie && $.browser.version <= 6)) {

        // If we've come in through a querystring...

        switch ($("#ctl00_mainContent_hdnTrack").val()) {
            case "club":
                $("#ctl00_mainContent_imgTrack").hide();
                showClub();
                break;
            case "national":
                $("#ctl00_mainContent_imgTrack").hide();
                showNational();
                break;
            case "full":
                $("#ctl00_mainContent_imgTrack").hide();
                showFull();
                break;
            default:

        }

        $("#club-column").mouseenter(showClub);
        $("#national-column").mouseenter(showNational);
        $("#full-column").mouseenter(showFull);
        $("#hintbubble").show();
        $("#hintbubble").html("Move your mouse over the tracks below to highlight them in the photo");
    }

});

function showClub() { showMap(".overlay-club"); }
function showNational() { showMap(".overlay-national"); }
function showFull() { showMap(".overlay-full"); }

function showMap(mapname) {
    
    // Do nothing if this is the same map
    if (currentmap == mapname) return;

    oldmap = currentmap;
    currentmap = mapname;

    // Fade out the old map
    if (oldmap != null) {
        $(oldmap).fadeOut(500);
    }

    $(currentmap).fadeIn(500);
}
