function OpenSectorMenu(division) {
    $("#sectors h3").each(function () {
        if ($("a", this).html().toLowerCase() == division.toLowerCase()) {
            var ClassName = $("a", this).html();
            ClassName = ClassName.replace(" ", "_");
            ClassName = ClassName.toLowerCase();
            $(this).removeClass("default");
            $(this).addClass(ClassName);
            $("a", this).css("color", "#FFF");
            $("div.accordion").accordion("activate", this);
        }
    });
}

$(document).ready(function () {
	$("div.accordion a").click(function(){
		var link = $(this).attr('href');
		
		if (link != "")
		{
			$("div.accordion").accordion('disable');
			window.location = link;
		}
		
		
	});
    $("div.accordion").accordion({
        collapsible: true,
        active: false,
        autoHeight: false
    });

    $("#jobs").fadeslider();

    $("div.container_swap").live('mouseenter', function () {

        // the “this” keyword used below relates to the unique object which has the implied mouseover function above.
        var CurrentId = $(this).attr("id");

        $("#messagebox").html('<img src="/v2011-1.0/images/sectors/' + CurrentId + '.png" />');

    });

    $("div.container_swap").live('mouseleave', function () {

        var CurrentId = $(this).attr("id");

        $("#messagebox").html('<img src="/v2011-1.0/images/sectors/h_dvi_hover.png" />');
    });

    //sector menu hover
    $("#sectors h3").mouseover(function () {
        var ClassName = $("a", this).html();
        ClassName = ClassName.replace(" ", "_");
        ClassName = ClassName.toLowerCase();
        //alert(ClassName);
        $(this).removeClass("default");
        $(this).addClass(ClassName);
        $("a", this).css("color", "#FFF");
    }).mouseleave(function () {
        if (!$(this).next("div").hasClass("ui-accordion-content-active")) {
            var ClassName = $("a", this).html();
            ClassName = ClassName.replace(" ", "_");
            ClassName = ClassName.toLowerCase();
            $(this).removeClass(ClassName);
            $(this).addClass("default");
            $("a", this).css("color", "#666");
        }
    });

    //sector menu click
    $("#sectors h3").click(function () {

        $("#sectors h3").each(function () {
            var ClassName = $("a", this).html();
            ClassName = ClassName.replace(" ", "_");
            ClassName = ClassName.toLowerCase();

            $(this).removeClass(ClassName);
            $(this).addClass("default");
            $("a", this).css("color", "#666");

        });
        
        var ClassName = $("a", this).html();
        ClassName = ClassName.replace(" ", "_");
        ClassName = ClassName.toLowerCase();

        if ($(this).next("div").hasClass("ui-accordion-content-active")) {
            $(this).removeClass("default");
            $(this).addClass(ClassName);
            $("a", this).css("color", "#FFF");
        }
        else {
            $(this).removeClass(ClassName);
            $(this).addClass("default");
            $("a", this).css("color", "#666");
        }

        
    })
});
