var hstatus = 0; 
$(document).ready(function(){
    $(".menu table td:last").css({"border-right":"none"});
    $("#search_form #story").each(function(){
        $(this).focus(function(){
            if($(this).val()=="поиск по сайту"){
                $(this).val("");
            }
        }); 
        $(this).blur(function(){
            if($(this).val()==""){
                $(this).val("поиск по сайту");
            }
        }); 
    });
    if(hstatus==0){
        set_header_image();        
    }
    $(".menu a.root").parent("li").each(function(){
        $(this).hover(function(){
            $(this).find("a.root").addClass("active");
            $(this).find("ul.sub_top").show();
        },function(){
            $(this).find("ul.sub_top").hide();
            $(this).find("a.root").removeClass("active");
        });
    });
});

function set_header_image(){
    hstatus = 1;
    if(arguments[0]){
        $(".header").css({"background":"url(http://"+document.location.host+"/templates/ru/images/"+arguments[0]+") no-repeat"});
    }else{
        $(".header").css({"background":"url(http://"+document.location.host+"/templates/ru/images/turbina.jpg) no-repeat"});
    }
}
