$(document).ready(function() {

    //Variables to manage program menu state
    var $curProgram = 0;
    var $curHighlight = "";

    function expandProgramInfo($pID)
    {
        $curProgram = $pID;
        $pcontent = $(".program-content-"+$curProgram+" .pcontent").html();

        $("#program-content-holder").css("display", "block");
        $("#program-intro").html($pcontent);
        $("#program-content-holder").stop();
        $("#program-content-holder").animate({
            width: '520px',
            marginLeft: '225px'
        }, 150);

    }

    function collapseProgramInfo()
    {
        $("#program-content-holder").stop();
        $("#program-content-holder").animate({
           width: '0px',
           marginLeft: '745px'
        }, 150,
        function(){
           $("#program-content-holder").css("display", "none");

        });
    }

    function updateProgramInfo()
    {
        $pcontent = $(".program-content-"+$curProgram+" .pcontent").html();
        $("#program-intro").html($pcontent);

    }

    $("#programs table").hover(function(){
        
            expandProgramInfo($curProgram);
            return false;
    },function(){});


    $("#programs").hover(null,function(){
        collapseProgramInfo();
            return false;
    });


    $("td.program-item").hover(function()
    {
        $curProgram = $(this).attr("id");
        $curHighlight = $(this).attr("rel");
        updateProgramInfo();
        
    });
    
});

