/*=================================================
 * Version   : 2.0
 * Project   : La RadioActive
 * Programer : Mathieu Allaire
 *=================================================*/


/******************************
 * CONSTANTS
 ******************************/
// Equivalent to url::base()
var URL = $('meta[name=url]').attr("content");


/******************************
 * GENERAL
 ******************************/
Shadowbox.init();

$("a[rel=submit]").click(function()
{
    $(this).parents("form").submit();

    return false;
});

//Dropdown
$("#nav li").hover(
    function() { $("ul", this).fadeIn("fast"); }, 
    function() { $("ul", this).fadeOut("fast"); } 
);

// Background switcher
$("#colors li a").click(function()
{
    $("body").removeClass();
    $("body").addClass($(this).attr("id"));
    
    $("#wrapper").removeClass();
    $("#wrapper").addClass($(this).attr("id")+"-color");
    
    $(this).siblings().removeClass("active");
    $(this).addClass("active");
    
    return false;
});

$("#light").click(function()
{
    $.post(URL+"ajax/color_switcher", { color: "site_light" });
});

$("#dark").click(function()
{    
    $.post(URL+"ajax/color_switcher", { color: "site_dark" });
});

// Switchbox
$(".tabs li a").click(function()
{
    $(this).parent().siblings().removeClass("active");
    $(this).parent().addClass("active");

    $("." + $(this).attr("rel")).show();
    $("." + $(this).attr("rel")).siblings().hide();    

    
    return false;
});

// All this for a border, design matters.
$(".countdown-1 .first a, .countdown-2 .first a").hover(function()
{
    $("#countdown-box .tabs .active a").addClass("first-hover");
}, function()
{
    $("#countdown-box .tabs .active a").removeClass("first-hover");
});

$(".presenter.first").hover(function()
{
    $("#presenters h3 span").addClass("first-hover");
}, function()
{
    $("#presenters h3 span").removeClass("first-hover");
});

$("#music .first .artist").hover(function()
{
    $(this).parentsUntil("#music").find("h3 span").addClass("first-hover");
}, function()
{
    $(this).parentsUntil("#music").find("h3 span").removeClass("first-hover");
});
