// JavaScript Document

// aber admin mod
$("document").ready(function() {
	$(".admin-list tr").hover(function() {
		var thisurl = $(this).attr("url");
		if(thisurl != "") {
			$(this).children().addClass("admin-list-highlight");
		}
	},function(){
		$(this).children().removeClass("admin-list-highlight");
	}); 
	
	$(".admin-list tr td").not("td.admin-list-end").click(function() {
		var thisurl = $(this).parent().attr("url");
		if(thisurl != "") {
			window.location = thisurl;
		}
	});
	
	$(".show-sql-link").click(function() {
		$(".admin-sql").toggle();
		var linktext = $(this).html();
		if(linktext == "Show tables SQL Query...") {
			$(this).html("Hide tables SQL Query...");
		}
		else {
			$(this).html("Show tables SQL Query...");
		}
	});
	
	$(".select-all-rows").click(function() {
		var linktext = $(this).html();
		if(linktext == "Select all") {
			$("table.admin-list INPUT[@name=rowselect][type='checkbox']").attr('checked', true);
			$(this).html("Deselect all");
		}
		else {
			$("table.admin-list INPUT[@name=rowselect][type='checkbox']").attr('checked', false);
			$(this).html("Select all");
		}
	});
	
	var intervId = setInterval(function() {
		$(".admin-message").slideUp();
		clearInterval(intervId);
	},6000);
});
