$(document).ready(function()
{
    //$("#content_container, #bottom_container, #top_container").pngfix();+
    
    $("ul#menu li").hover(function()
    {
        $(this).children("ul").css("visibility", "visible");    
    },
    function()
    {   
        $(this).children("ul").css('visibility', 'hidden');    
    });
    
    $("ul#submenu li a").hover(function()
    {
        $(this).parent("li").css({ "background":'url("uploads/images/menu_selected_bg.gif") repeat-x left top'});
        $(this).css("color", "white");    
    },
    function()
    {
        if(!$(this).parent("li").hasClass("menu_selected"))
        {
            $(this).parent("li").css({ "background":'none'});
            $(this).css("color", "#241515");
        }    
    }); 
    
    $("#menu li ul").each(function()
    {
        $(this).parent("li").children("a").addClass("drop_down");
    });
    
    $(function(){
        $('#gallery img:gt(0)').hide();
        setInterval(function(){$('#gallery :first-child').fadeOut().next('img').fadeIn().end().appendTo('#gallery');}, 5000);
    });
    
    var current_page = window.location.search.split("=");

    if(current_page[1])
    {   
        $("#menu li a").each(function()
        {
            a_href = $(this).attr("href");
            page = a_href.split("=");
            if(page[1] == current_page[1])
            {
                $(this).parent("li").addClass("menu_selected");
                $(this).parent("li").parent("ul").parent("li").addClass("menu_selected");
            }
            else
            {
                $(this).parent("li").removeClass("menu_selected");
                $(this).parent("li").parent("ul").parent("li").removeClass("menu_selected");
            }
        });
        
        $("#submenu li a").each(function()
        {
            a_href = $(this).attr("href");
            page = a_href.split("=");
            if(page[1] == current_page[1])
            {
                $(this).parent("li").addClass("menu_selected");
            }
            else
            {
                $(this).parent("li").removeClass("menu_selected");
            }
        });
    }
});
