function makeup()
{
	
	var docHeight;
	var scrollHeight;
	
	if (document.compatMode=='CSS1Compat' && !window.opera) {
		docHeight = document.documentElement.clientHeight;
	}
	else {
		docHeight = document.body.clientHeight;
	}
	
	var headerHeight = $("#header").height();
	var footerHeight = $("#footer").height();
	var bodyHeight = 300;
	
	if ((docHeight - headerHeight - footerHeight - 10) > 300) {
		bodyHeight = docHeight - headerHeight - footerHeight - 10;
	}
	
	scrollHeight = bodyHeight - 180;
	
	$("#tableScroll").css("height",scrollHeight + "px");
	
	$("#body").css("height",bodyHeight + "px");
	
	if (docHeight > headerHeight + footerHeight + $("#bodyInner").height()) {
		$("#footer").css("top",bodyHeight + headerHeight + "px");
	}
	else {
		$("#footer").css("top",$("#bodyInner").height() + headerHeight + 10 + "px");
	}
	
	var tableId = $("#tableScroll table").attr("id");
	
	makeupTable(tableId);
	
}

$(document).ready(function(){
	makeup();
	
	$(".rollover").css("top",$("#topMenu").height() + "px");
	$(".rollover").css("width",$("#topMenu").width() + "px");
	
	$("#topMenu .link").bind("mouseenter",function(){
		$(".rollover").hide();
		$(".link").css("background","#539923")
		$(this).css("background","#62bb29");
		var rollId = $(this).attr("id");
		$("#" + rollId + "Rollover").show();
	});
	
	$("#topMenu").bind("mouseleave",function(){
		$(".rollover").hide();
		$(".link").css("background","#539923")
	});
	
	$("#mainTable td .pad").bind("mouseenter",function(){
		var colClass = $(this).parent().attr("class");
		$("#mainTable ." + colClass).parent().addClass("hl2");
		$(this).parent().parent().removeClass("hl2");
		$(this).parent().parent().parent().addClass("selTr");
		$(this).parent().parent().addClass("hl");
	});
	
	$("#mainTable td .pad").bind("mouseleave",function(){
		$(this).parent().parent().removeClass("hl");
		$("#mainTable td").removeClass("hl2");
		$(this).parent().parent().parent().removeClass("selTr");
	});
	
	$("#tableHeaders div.pad").bind("mouseenter",function(){
		$(this).css("width",$(this).parent().width() + 10 + "px");
		$(this).css("overflow","visible");
		$(this).css("position","absolute");
		$(this).css("z-index","1000");
		$(this).css("background","#fffbcc");
		var hClass = $(this).parent().attr("class");
		$("." + hClass + " .abbr").css("display","none");
		$("." + hClass + " .full").css("display","inline");
	});
	
	$("#tableHeaders div.pad").bind("mouseleave",function(){
		$(this).css("overflow","hidden");
		$(this).css("position","");
		$(this).css("z-index","100");
		$(this).css("background","transparent");
		var hClass = $(this).parent().attr("class");
		$("." + hClass + " .abbr").css("display","inline");
		$("." + hClass + " .full").css("display","none");
	});
	
	$("#tableHeaders .selected div.pad").bind("mouseenter",function(){
		$(this).css("height",$(this).parent().parent().height() - 10 + "px");
		$(this).css("overflow","visible");
		$(this).css("position","absolute");
		$(this).css("z-index","1000");
		$(this).css("background","#3e711a");
	});
	
});

$(window).resize(function(){
	makeup();
});

function hideHint() {
	$("#hint").slideUp('fast');
}

function hideControls() {
	$("#controlsBlock").slideUp('fast');
}

function showLogin(eThis) {
	$('#loginRollover').toggle();
	$('#loginRollover').css('top',$('#userMenu').height() + 'px')
	$('#loginRollover').css('width',$('#userMenu').width() + 'px')
	
	if ($("#loginRollover").css("display") == "block") {
		$(eThis).parent().css("background","#7e7e7e");
		$(eThis).css("color","#fff");
		$(eThis).css("border-bottom","1px dashed #fff");
	}
	else {
		$(eThis).parent().css("background","#e9e9e9");
		$(eThis).css("color","#396db0");
		$(eThis).css("border-bottom","1px dashed #396db0");
	}
}

function showLang(eThis) {
	$('#langRollover').toggle();
	$('#langRollover').css('top',$('#userMenu').height() + 'px');
	$('#langRollover').css('margin-left',$('#userMenu').width() - 80 + 'px')
	if ($("#langRollover").css("display") == "block") {
		$(eThis).css("background","#dcdcdc");
		$(".langSelector .arr").attr("src","img/uarr.gif");
	}
	else {
		$(eThis).css("background","#e9e9e9");
		$(".langSelector .arr").attr("src","img/darr.gif");
	}
}

