﻿$(document).ready(function() {
	$(".rollover").each(function() {
		$(this).hover(
            function() { this.src = this.src.replace("-off", "-on"); },
            function() { this.src = this.src.replace("-on", "-off"); }
        );
	});

	$(".topImg").hover(
    function() {
	var submenu = $(".topNav .dropDown");

	$(".topNav").children(".active").children(".dropDown").hide();
    	$(this).addClass("on");

    	var el = $(".dropDown", this);

    	el.show();

    },

    function() {
    	var el = $(".dropDown", this);

    	$(this).removeClass("on");

    	if (!el.hasClass("active")) {
    		el.hide();
    	}
    	
    	$(".topNav").children(".active").children(".dropDown").show();
    }
    );

	var navID = "#nav" + $(".navName").attr("id");
	navigation(navID);
});

function displayFAQ(FAQNum) {
    $(".FAQ").hide();
    $(".FAQ:eq("+FAQNum+")").show();
}

function navigation(navID) {
    if ($(navID).length > 0) {
        var topNav = $(navID);
        $(navID + " a:first").addClass("active");
        while (!topNav.hasClass("topNav")) {
        	
            topNav.addClass("active");
            topNav = topNav.parent();
        }
        topNav.addClass("active");
    }
    if ($("#subNavigation").length > 0) {
        if ($(".active .specialSubNav").length > 0) {
            $(".active .specialSubNav").appendTo($("#subNavigation"));
            var title = $(".specialSubNav p").text();
        }
        else {
            $(".dropDownItem.active .subNav").appendTo($("#subNavigation"));
            var title = $(".dropDownItem.active a").text();
        }

        $("#subNavigation .subNav").css("display", "block");
        $("#subTitle").html(title);

        $(".topNav").children(".active").children(".dropDown").show();
    }
   }
   function popReg() {
   	$('#dialog').jqmShow(); 
   }