// dropdown menu, ad rotator, table colors	

	dropdown_delay = 0;	
	dropdown_element = 0;	
	nextad = 0;		

	$("body").ready(function(){		
		$(".mainmenu_item").mouseover(function(){			
			dropdown_open(this);					
		}).mouseout(function(){			
			dropdown_closedelay(this);		
		});				

		format_table();
		
		setInterval("rotate_ads()",5000);			
	});			

	function format_table(){
		$("tr",".tableholder").find("td:last-child").prepend("&nbsp;&nbsp;&nbsp;");
		
		$(".tableholder tr").find("td:last-child").after("<td>&nbsp;</td>");		
		$(".tableholder tr").find("th:last-child").attr("colspan",  ($(".tableholder tr").find("th:last-child").attr("colspan")+1)  );
		
		$("th:first-child","tr",".tableholder").addClass("first");
		$("th:last-child","tr",".tableholder").addClass("last");
		
		$("tr:first-child",".tableholder").find("th").addClass("title");
		$("tr:first-child",".tableholder").find("th:first-child").addClass("left");
		$("tr:first-child",".tableholder").find("th:last-child").addClass("right");

		$("tr:even",".tableholder").addClass("even");
		$("tr:odd",".tableholder").addClass("odd");		
		
		
		
		$("tr:even",".tableholder").find("td:last-child").addClass("lastodd");
		$("tr:odd",".tableholder").find("td:last-child").addClass("lasteven");
		
		$("tr:last-child",".tableholder").find("td").addClass("bottom");
		$(".scrollable").height( $("table",".tableholder").height() + 20 );
	}

	function dropdown_closedelay(element){
		dropdown_delay = window.setTimeout("dropdown_close()",500);
	}

	function dropdown_open(element){
		if (dropdown_delay) {
			window.clearTimeout(dropdown_delay);
			dropdown_delay = null;
		}
		if (dropdown_element!=element){
			dropdown_close(dropdown_element);
		}
		dropdown_element = element;
		if($.browser.msie){
			$(".dropdown",element).show();
		}else{
			$(".dropdown",element).fadeIn();
		}
		$("a",element).addClass("hover");
	}

	function dropdown_close(element){
		if($.browser.msie){
			$(".dropdown",element).hide();
		}else{
			$(".dropdown",element).fadeOut();
		}
		$("a",element).removeClass("hover");
	}
	
	function rotate_ads(){
		ads = $("p","#ad_wrapper");
		$("p","#ad_wrapper").css("display","none");
		$(ads[nextad]).fadeIn(2000);
		if ( ++nextad >= ads.length ) nextad = 0;
	}
	
	function startPrint(){
		$(".contentholder-text").after("<div id=\"hidden\" style=\"display: one;\">" + $(".contentholder-text").html() + "</div>");
		$("#hidden .printlink").remove();
	
		title = $("#hidden .path").html().split("")[1];	
		$("#hidden .path").after("<h1>" + title + "</h1>");
		$("#hidden .path").remove();
		
		printpop_content = "<html>\n<head>\n<style>\nbody{ font-family: arial; font-size: 12px; } \ntable{ font-size: 12px;}\n</style>\n<script>\n\n</script>\n</head>\n<body>\n" + $("#hidden").html() + "\n</body>\n</html>";
		$("#hidden").remove();
		
		printpop = window.open( '','print','directories=0, height=800, width=600, location=0, menubar=1, status=0, titlebar=0, toolbar=0, scrollbars=1' );		
		
		printpop.document.write( printpop_content );
		
		printpop.print();
		
		// printpop.window.close();
	}	
