$(document).ready(function() {
     $.each( $('tbody.tbody'), function(i, tbody){
        $(tbody).children("tr:last").children("td").removeClass("cell_border_b");
     });

     $("tbody.tbody tr").hover(
       function (){ $(this).children("td.alt1").addClass("alt2"); }, 
       function () { $(this).children("td.alt2").removeClass("alt2"); });

     $(".tcat_animation").animate({fontSize: "30pt"}, 300);
     $(".tcat_animation").animate({fontSize: "16pt"}, 300);


     
     $.each( $(".nav_menu"), function(i, menu){
        $(menu).css("width", $(menu).width());
     });
     $(".menu_control a").click(
	    function (){
		   var menu = "#"+$(this).attr("id")+"_menu";
		   if($(menu).length != 0)
		   {
		      $.each( $(".nav_menu"), function(i, menu){
                 $(menu).slideUp();
				 $(menu).css("z-index",100);
              });
                 $.each( $(".menu_control a"), function(i, menu_a){
                        $( menu_a).css("background-image","none");
                   });
			  $(menu).css("z-index",101);
		      $(menu).css("left", 0);
		      $(menu).css("position","absolute");
		      var offset = $(this).offset();
		      var width1 = $(this).outerWidth();
		      var width2 = $(menu).outerWidth();
		      var x = offset.left - (width2 - width1) / 2;
		      var min_x = $("#navbar_buttons_nifty").offset().left + 3;
		      var max_x = $("#navbar_buttons_nifty").offset().left + $("#navbar_buttons_nifty").outerWidth() - 3;
		      if(x + width2 > max_x)
		         x = x - (x + width2 - max_x);
			  if(x<min_x)
		         x = x + (min_x - x);
		      $(menu).css("left", x);
		      $(menu).css("top", offset.bottom);
              $(menu).slideDown(); 
			  
			  $(this).css("background-image","url('/img/header_bg.gif')");
			  
              return false;
		   }
        }
     );	 
     $("#navbar_buttons_nifty").hover(
	    function(){ },
        function(){ 
			$(".nav_menu").slideUp();
			$.each( $(".menu_control a"), function(i, menu_a){
                 $( menu_a).css("background-image","none");
            });
		}
     );
	 
	 if($("div.rounded").length != 0) Nifty("div.rounded","transparent");
     if($("div.rounded_small").length != 0) Nifty("div.rounded_small","transparent small");
     if($("div.rounded_top").length != 0) Nifty("div.rounded_top","transparent top");
     if($("div.rounded_bottom").length != 0) Nifty("div.rounded_bottom","transparent bottom");
     if($("div.rounded_bottom_small").length != 0) Nifty("div.rounded_bottom_small","transparent bottom small");
     if($("div.table_top").length != 0) Nifty("div.table_top","transparent top");
     if($("div.table_bottom").length != 0) Nifty("div.table_bottom","transparent bottom");
     if($("ul.tab_list li").length != 0) Nifty("ul.tab_list li","transparent top");
  });