    $(document).ready(function(){
    
      $("#server").val("none");
      $("div.tabber > div.padder").slideUp(100);
      
      $("div.server").mouseenter(function(){
        $(this).animate({"height": "34px"}, "fast" );
        $(this).find("img.bs").animate({"height": "3px"}, "fast" );
      }).mouseleave(function(){
        $(this).animate({"height": "24px"}, "fast" );
        $(this).find("img.bs").animate({"height": "24px"}, "fast" );
      }).click(function(){
        $(this).animate({"height": "24px"}, "fast" );
        $(this).find("img.bs").animate({"height": "24px"}, "slow" );
        $(".servercolor").animate({backgroundColor: $(this).css("background-color")}, 500);
        $("a").animate({color: $(this).css("background-color")}, 500);
        $("#server").val($(this).attr("id"));
        $("div.tabber > div.padder").slideUp(100);
        $("div.tabhead").removeClass("tabselected");
        $("div.ddc > div.is").fadeOut(250);
        $("#i"+$(this).attr("id")).fadeIn(250);
        $("div.loaded").switchClass("loaded", "unloaded");
        $("#status").click();
      });
      $("#nameform").submit(function(){return false});
      
      $("#player").keyup(function(){
        $.post("ajax.php?search", {player: $(this).val(), server: $("#server").val()}, function(response){
          if (response != "") {
            $("#ajaxnames").fadeIn("fast");
            $("#ajaxnames").html(response);
            $("#ajaxnames li").click(function(){
              $("#player").val($(this).html());
              $("#ajaxnames").fadeOut("fast");
            });
          } 
          else { 
            $("#ajaxnames").fadeOut("fast");    
          }  
        });
      }).blur(function(){
        $("#ajaxnames").fadeOut("fast");    
      });
      
      $("div.tabhead").click(function(){
        $("div.tabhead").removeClass("tabselected");
        var id = $(this).attr("id");
        var field = $(this).next();
        $("#img"+id).switchClass("loaded", "loading");
        $("div.tabber").find("div.padder").slideUp(100);
        $.post("ajax.php?"+id, {player: $("#player").val(), server: $("#server").val()}, function(response){
          if (response != "") {
            $("#img"+id).switchClass("loading", "loaded");
            field.html(response).slideDown("fast");
            $("#"+id).addClass("tabselected");
          }
          else {
            $("#img"+id).switchClass("loading", "unloaded");
          }
        });  
      });
      
    });
    
    function dbg(t) {
      $("#debug").html("DEBUG: "+t);
    };

