function menuOver(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    if($(this).parent().hasClass('active') == false){
        $(this).animate({color:"#FFFFFF"},500);
    }
}
function menuOut(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    if($(this).parent().hasClass('active') == false){
        $(this).animate({color:"#99cccc"},1000);
    }
}
function buttonOver(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    if($(this).parent().hasClass('active') == false){
        $(this).animate({color:"#FFFFFF"},500);
    }
}
function buttonOut(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    if($(this).parent().hasClass('active') == false){
        $(this).animate({color:"#A0A0A0"},1000);
    }
}
function imgOver(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    $(this).animate({color:"#FFFFFF"},500,function(){  $(this).css("color","#ffffff");  });
    $(this).parent().fadeTo(250, 1);
}
function imgOut(){
    $(this).parent().stop(true, true);
    $(this).stop(true, true);
    $(this).animate({color:"#A0A0A0"},1000);
    $(this).parent().fadeTo(1000, 0.5);
}
function imgOver2(){
    $(this).stop(true, true);
    $(this).fadeTo(250, 1);
}
function imgOut2(){
    $(this).stop(true, true);
    $(this).fadeTo(1000, 0.5);
}
function hideAll(FSBTN){
    $('div').not('#bgContainer').fadeTo(250, 0);
    //$('#bgContainer').stop(true, false);
    //$('#bgContainer').fadeTo(1000,1);
    $('.poolNav').fadeTo(250, 0.5);
    if(FSBTN != null){
        $('#fsimg').fadeTo(1000,1);
    }
    $('a.showBG').text('RETURN TO PAGE');
    
    $('#imgNav').show();
    
    $('a.showBG').unbind('click');
    $('a.showBG').click(function(){showAll()});
    addthis_close();
    $('at15s').hide();
}
function showAll(){
    $('div').not('#bgContainer, .poolNav').fadeTo(250, 1);
    //$('#bgContainer').stop(true, false);
    //$('#bgContainer').fadeTo(1000,1);
    $('.poolNav').fadeTo(250, 0.5);
    $('#fsimg').fadeTo(1000,0);
    $('#bgimg').attr('src', $('#bgimg').attr('sd'));
    $('a.showBG').text('SHOW BACKGROUND');
    
    $('#imgNav').hide();
    
    $('a.showBG').unbind('click');
    $('a.showBG').click(function(){hideAll()});
    addthis_close();
    $('at15s').hide();
}
$(function (){
    $('#bgimg').attr('sd', $('#bgimg').attr('src'));
    
    $('.main > li > a').mouseover(menuOver);
    $('.main > li > a').mouseleave(menuOut);
    $('#categories > ul > li > a').mouseenter(menuOver);
    $('#categories > ul > li > a').mouseleave(menuOut);
    $('#pools > h3 > a').mouseenter(menuOver);
    $('#pools > h3 > a').mouseleave(menuOut);
    
    $('a.showBG').click(function(){hideAll()});
    
    $('a.button').mouseenter(buttonOver);
    $('a.button').mouseleave(buttonOut);
    $('.pagination > li > a').mouseenter(menuOver);
    $('.pagination > li > a').mouseleave(menuOut);
    
    $('.pagination.blue > li > a').unbind();
    
    $('.poolNav').fadeTo(250, 0.5);
    
    $('.poolNav a').mouseenter(imgOver);
    $('.poolNav a').mouseleave(imgOut);
    
    $('.poolNav').css('cursor','pointer')
    
    $('.poolNav').click(function() {
        var href = $(this).children('a').attr('href');
        //alert(href);
        window.location = href;
    });
    
    $('.poolNav').mouseenter(imgOver2);
    $('.poolNav').mouseleave(imgOut2);
    
    
    $('#fsimg').fadeTo(10, 0);
    
});
function centerPage(){
    var pW = $(window).width()/2-350;
    if(pW < 260){
        pW = 260;
    }
    $('#page').css('left',pW);
}
var t = setInterval(centerPage,100);
