﻿/// <reference path="jquery-1.3.2.js"/>

$(document).ready(function() {

	$("ul.nav").superfish({
		animation: { opacity: "show" }
	});

});

function setupMap(prefix, fillcolor, strokecolor, alwayson) {

	if (!fillcolor) fillcolor = 'ffffff';
	if (!strokecolor) strokecolor = '000000';
	if (!alwayson) alwayson = false;

	$('img#' + prefix).maphilight({
		fill: true,
		fillColor: fillcolor,
		strokeWidth: 2,
		strokeColor: strokecolor,
		alwaysOn: alwayson
	});

	$("." + prefix + "_item")
                .hide()
                .each(function() {

                	var aId = $(this).children("a.areaID").attr("name");
                	var txt = $(this).children(".text").html();
                	var txtB = $(this).children(".text").text();
                	var str = "<li id='" + aId + "'>";

                	str += txt;
                	str += "</li>";

                	$("#p_" + prefix + " .legend ul").append(str);
                	$("#map_" + prefix + " area[id=area_" + aId + "]").attr("title", txtB);
                });

	$(".legend li").hover(
                function() {
                	$("#map_" + prefix + " area[id=area_" + $(this).attr('id') + "]").mouseover();
                	$(this).addClass("hover");
                },
                function() {
                	$("#map_" + prefix + " area[id=area_" + $(this).attr('id') + "]").mouseout();
                	$(this).removeClass("hover");
                });

                $("#map_" + prefix + " area").hover(
                function() {
                	$("li#" + this.id.replace("area_", "")).addClass("hover");
                },
                function() {
                $("li#" + this.id.replace("area_", "")).removeClass("hover");
                });



}