$(function () {
    /*$("#featured div").fadeTo(200, 0.6);*/
    $(".seasonboxcontainer").fadeTo(200, 0.6);
    $(".teamselect").fadeTo(200, 0.5);
    $(".driverselect").fadeTo(200, 0.6);
    $(".nextrace").fadeTo(200, 0.6);
    
    $("#latestnews div").hover(function() {
        $(this).animate({ backgroundColor: "#efefef" }, 'fast');
        $(this).find(".readmore").show();
      },function() {
        $(this).animate({ backgroundColor: "#ffffff" }, 700);
        $(this).find(".readmore").hide();
      });
    $("#latesttweets div").hover(function() {
        $(this).animate({ backgroundColor: "#efefef" }, 'fast');
      },function() {
        $(this).animate({ backgroundColor: "#ffffff" }, 700);
      });
    /*
    $("#featured div").hover(function() {
        $(this).fadeTo(200, 1);
      },function() {
        $(this).fadeTo(200, 0.6);
      });
    */
    $(".seasonboxcontainer").hover(function() {
        $(this).fadeTo(200, 1);
      },function() {
        $(this).fadeTo(200, 0.6);
      });
    $(".teamselect").hover(function() {
        $(this).fadeTo(200, 1);
      },function() {
        $(this).fadeTo(200, 0.5);
      });
    
    $(".driverselect").hover(function() {
        $(this).fadeTo(200, 1);
      },function() {
        $(this).fadeTo(200, 0.6);
      });
    
    $(".nextrace").hover(function() {
        $(this).fadeTo(200, 1);
      },function() {
        $(this).fadeTo(200, 0.6);
      });    
    
    $("#navigation li").hover(function() {
        $(this).addClass("boosh");
      },function() {
        $(this).removeClass("boosh");
      });

    if($('#nextracecountdown'))
    {
        
        var datesplit = $('#next-race-date').html().split(" ");
        var tday = datesplit[0].replace('th','');
        var tday = tday.replace('st','');
        var tmonth = datesplit[1];
        var tyear = datesplit[2];
        var newdate = new Date(tyear,tmonth,tday,0,0,0,0);
        /*var newdate = new Date(2011,3,27,0,0,0,0);
        alert(tyear+'*'+tmonth+"*"+tday);
        alert(newdate);*/
        
        $('#nextracecountdown').countdown({until: newdate, 
                                            layout: '<span class="mini-headline" style="background:none;">{dn} {dl} {hn} {hl}</span>'
                                           });
    }
    
    $('#slider').nivoSlider();
});
