// For IE hover flicker bug
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
// Hello jQuery!
$(document).ready(function(){
// Add class to body to tell the stylesheet that JavaScript is turned on
    $("body").addClass("jsOn");
// Browser Checks
//    if(jQuery.browser.version == 6.0 && $.browser.msie) {}
//    if($.browser.safari){}
//    Featured Content Module expand control
    $("#featured .more").each(function(){
        $(this).parent().append("<a class=\"expand\" title=\"expand\">+&nbsp;expand</a>")
        $("#featured .expand").click(function(){
            $(this).toggleClass("expandOn")
            $("#featured .more").toggle();
        })
    })
//    ShareBox Hover Control
    $("#shareBox").hover (
        function() {
            $(this).addClass("over");
        },
        function() {
            $(this).removeClass("over");
        }
    );
//    News & Events Hover / Layer Toggle
    $("#newsEvents h2").hover (
        function() {
            $(this).addClass("over");
        },
        function() {
            $(this).removeClass("over");
        }
    );
    $("#newsEvents h2").click(function(){
        $("#newsEvents *").removeClass("active")
        $(this).addClass("active")
        $(this).next(".layer").addClass("active")
    })
//    IMFO Module
    $("#imfo a").hover (
        function() {
            $(this).parent().addClass("over");
        },
        function() {
            $(this).parent().removeClass("over");
        }
    );
//    ModuleStack
    $("#moduleStack h2").hover (
        function() {
            $(this).addClass("over");
        },
        function() {
            $(this).removeClass("over");
        }
    );
    $("#moduleStack h2").click(function(){
        if( $(this).parent().hasClass("active") ){
            $(this).parent().removeClass("active")
        } else {
            $("#moduleStack *").removeClass("active")
            $(this).parent().addClass("active")
        }
    })
//    Alumni Profiles List Hover
    $("#profileList a").hover(
        function() {
            $(this).parent().addClass("over")
        },
        function() {
            $(this).parent().removeClass("over")
        }
    );
    $("#profileList h3 a").hover(
        function() {
            $(this).parent().parent().addClass("over")
        },
        function() {
            $(this).parent().parent().removeClass("over")
        }
    );
//    Get the current year and put it in the footer the footer
    var currentYear = (new Date).getFullYear();
    $("#copyrightYear").html("&copy;&nbsp;" + currentYear);
//    Profile Layer
    //    Append the overlay to the end of the page
    $("body:not(#pageHome)").append('<div id="overlay"><div id="overlayBG"></div><div id="profileBox"></div><a class="close" href="#">close</a></div>');
    //    Open the profile layer & populate with iframe
    $("#profileList a, #moduleStack .profile a").click(function(){
        var iframeURL = $(this).attr("href");
        $("#overlay").show();
        $("#profileBox").append('<iframe src="'+iframeURL+'" width="100%" height="100%" scrolling="no" frameborder="0"><p>Your browser does not support iframes.</p></iframe>');
        return false;
    })
    //    Close the layer and remove the iframe content
    $("#overlay, #overlay .close").click(function(){
        $("#overlay").hide();
        $("#profileBox").html('');
        return false;
    })
}); // Bye-bye jQuery!