function doResize()
{
    var windowWidth = $(window).width();
    if (windowWidth > 1330)
    {
        $("#skinnyLogo").css("display","none");
        $("#fatLogo").css("display","");
    }
    else
    {
        $("#skinnyLogo").css("display","");
        $("#fatLogo").css("display","none");        
    }
}

var menuLocked = false;
jQuery(document).ready(function($){
    doResize();
    
    var homeUp = true;
    $(".homeMoreLink").click(function(e){
        e.preventDefault();
        $("#homeMore").slideToggle('slow');
    }); 
    
    
    // make li's in menu into links
    
    $("li.workUsersListItem").click(function(e){
    	window.location = $(this).children(":first-child").attr("href");
    });
    $("li.workUsersListItemBlue").click(function(e){
    	window.location = $(this).children(":first-child").attr("href");
    });
    
    // double line light up on mouseover in menu
    $(".menuItem").hover(function(){
        $(this).addClass("menuItemSelected");
        $(this).next(".menuItem").addClass("menuItemSelected");
    },function(){
        $(this).removeClass("menuItemSelected");
        $(this).next(".menuItem").removeClass("menuItemSelected");
    });
    
    $(".slideable").click(function(e){
        if ($(this).attr("href") == "#")
        {
            e.preventDefault();
            // only proceed if another slide is not in action
            if (!menuLocked)
            {
                // lock the menu
                menuLocked = true;
                
                // close other ones
                if (!$(this).parent().hasClass("isSelected"))
                {
                    // this makes sure we don't run this code on the current open area
                    $(".isSelected").children().next().slideUp();
                    $(".isSelected").next().removeClass("isSelectedBelow");
                    $(".isSelected").children().removeClass("linkSelected");
                    $(".isSelected").removeClass("isSelected");
                }
                
                // unfocus the anchor (gets rid of that annoying line around it
                $("body").attr("tabindex",-1).focus(); 
                
                // set the area as selected so the stuff stays blue
                
                
                // do the slide
                $(this).next().slideToggle('fast',function(){
                    // slide completed, add or remove color persistence
                    if ($(this).css("display") == "none")
                    {
                        // they were just minimizing the currently selected one, remove persistence
                        $(this).prev().removeClass("linkSelected");
                        $(this).parent().removeClass("isSelected");
                        $(this).parent().next().removeClass("isSelectedBelow");
                    }
                    else
                    {
                        $(this).prev().addClass("linkSelected");
                        $(this).parent().addClass("isSelected");
                        $(this).parent().next().addClass("isSelectedBelow");
                    }
                    
                    // unlock menu
                    menuLocked = false;
                });
                if ($(".welcomeItem").hasClass("isSelected"))
                {
                    $(".welcomeItem").css("display","none");
                }
                else
                {
                    $(".welcomeItem").css("display","");                    
                } 
            }
        }
    });
    
    $(".workThumbCover").hover(function(e){
        $(this).css("background-color","#53e7ff");
        $(this).css("color","#231f20");
    },function(){
        $(this).css("background-color","#1c1c1c");
        $(this).css("color","#939598");        
    });    
    $(".workThumbCover").click(function(){
        
        window.location=$(this).prev().children().attr('href');
    });
    
    $(".workThumbImage").hover(function(e){
        $(this).next().css("background-color","#53e7ff");
        $(this).next().css("color","#231f20");
    },function(){
        $(this).next().css("background-color","#1c1c1c");
        $(this).next().css("color","#939598");        
    });
    
    
    $("#awardsMore").click(function(e){
        e.preventDefault();
        $("#workItemMoreArea").slideToggle();
    });
    
    $(window).resize(function(){
        doResize();        
    });
    
});



