
(function (j$) {
    j$(document).ready(function () {

        //switch pictures
        j$("#promo_rotator_controls a").click(function () {
            j$("#promo_rotator_controls a").removeClass("on");
            j$(this).addClass("on");
            return false;
        });
        j$("#promo_rotator #dnn_ctr1990_ModuleContent").cycle({
            timeout: 4000,
            speed: 500,
            before: onBefore,
            pause: true,
            next: '#next',
            prev: '#prev'
        });
        function onBefore() {
            j$('#desc').html(this.alt);
        }

        // Global "Enter" keypress override of default <form> action to submit.
        j$("input").keypress(function (event) {
            if (event.which === 13) {
                event.preventDefault();
            }
        });

        //searchbox default text
        j$("#search_tb input[type*='text']").val("keyword(s)");
        j$("#search_tb input[type*='text']").focus(function () {
            if (j$("#search_tb input[type*='text']").val() == "keyword(s)") {
                j$("#search_tb input[type*='text']").val("");
            }
        });
        j$("#search_tb input[type*='text']").blur(function () {
            if (j$("#search_tb input[type*='text']").val() == "") {
                j$("#search_tb input[type*='text']").val("keyword(s)");
            }
        });

        //email this page functionality
        var url = window.location.href;
        var nohttp = url.split('//')[1];
        j$("#emailLink").attr("href", "/EmailThisPage?link=" + nohttp);

        //Keypress fix for the Events Module
        j$("input[id$='txtSearchKeyword']").keypress(function (event) { //Calendar
            if (event.which == 13) {
                event.preventDefault();
                j$("input[id$='imgBtnSearch']").click();
            }
        });

        //Keypress fix for the UltraVideoGallery Module.
        j$("input[id$='SearchInput_txtKeyword']").keypress(function (event) {
            if (event.which == 13) {
                event.preventDefault();
                event.stopPropagation();
                j$("input[id$='SearchInput_btnSearch']").click();
            }
        });



        j$("#header_nav > li").mouseenter(function (event) {
            j$(this).find("ul.nav_sub").show();
        }).mouseleave(function(event) {
            j$(this).find("ul.nav_sub").hide();
        });




    });
})(jQuery.noConflict());

//toggle script code for Bios
function toggleBlock(id, linkid) {
    if (document.getElementById(id).style.display == 'none') {
        document.getElementById(id).style.display = 'block';
        document.getElementById(linkid).innerHTML = '[Close Biography]'
    } else {
        document.getElementById(id).style.display = 'none';
        document.getElementById(linkid).innerHTML = '[Read Biography]'
    }
};


//toggle script code for catalog
function toggleInstructions(id, linkid) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = 'block';
document.getElementById(linkid).innerHTML = '[Close Instructions]'
} else {
document.getElementById(id).style.display = 'none';
document.getElementById(linkid).innerHTML = '[Read Instructions]'
}
};

