function toggleD(objId) {
	var tgId = document.getElementById(objId);
	if(tgId) {
		if(!tgId.style.display || tgId.style.display == "block") {
			tgId.style.display = "none";
		} else if (tgId.style.display == "none") {
			setDimmHeight();
			tgId.style.display = "block";
			if(objId == "gwlogin") {
				if(document.getElementById("log").value == "")
					document.getElementById("log").focus();
				else
					document.getElementById("pwd").focus();
			}
		}
	}
}

function toggleLogin() {
	toggleD('gwlogin');
	toggleD('dimm2');
}

function setDimmHeight() {
	var dimm_height = jQuery(window).height();
	jQuery('#dimm').height(dimm_height + 'px');
	jQuery('#dimm2').height(dimm_height + 'px');

	if(jQuery('#content').height() + 83 > dimm_height) {
		dimm_height = jQuery('#content').height() + 83;
		jQuery('#dimm').height(dimm_height + 'px');
		jQuery('#dimm2').height(dimm_height + 'px');
	}
}

function initPage() {
	var loginWin = document.getElementById('gwlogin');
	document.getElementById('dimm2').style.display = "none";
	loginWin.style.display = "none";
	loginWin.style.position = "absolute";
	loginWin.style.top = 237 + "px";
	loginWin.style.zIndex = 10;
}

jQuery(document).ready(function() {
	setDimmHeight();
	initPage();
});
