// JavaScript Document

// управление окном login-form
function getBrowserType() {
	isDOM = document.getElementById ? true : false;
	isOpera = window.opera && isDOM;
	isOpera5 = isOpera;
	isOpera6 = isOpera && window.print;
	isOpera7 = isOpera && document.readyState;
	isMSIE = isIE = document.all && document.all.item && !isOpera;
	isStrict = document.compatMode == 'CSS1Compat';
	isNN = isNC=navigator.appName=="Netscape";
	isNN4 = isNC4 = isNN && !isDOM;
	isMozilla = isNN6 = isNN && isDOM;
}

function ac_getBody(w){
  if (!w) w = window;
  if (isStrict) {
    return w.document.documentElement;
  } else {
    return w.document.body;
  }
}

function getDocumentWidth(w) {
	getBrowserType();
	if (!w) w = window;
	if (isMSIE || isOpera7) return ac_getBody(w).scrollWidth;
	if (isNN) return w.document.width;
	if (isOpera) return w.document.body.style.pixelWidth;
}

function getDocumentHeight(w) {
	getBrowserType();
	if (!w) w = window;
	if (isMSIE || isOpera7) return ac_getBody(w).scrollHeight;
	if (isNN) return w.document.height;
	if (isOpera) return w.document.body.style.pixelHeight;
}

function setLoginPosition(formLogin) {
	if (formLogin != null) {
		var width = getDocumentWidth();
		var height = getDocumentHeight();
		var f_width = new Number(formLogin.style.width.slice(0, formLogin.style.width.length - 2));
		formLogin.style.left = Math.round((width - f_width) / 2) + "px";
	}
	return false;	
}

function docOnResize() {
	var f = document.getElementById("login-form");
	if ((f != null)) setLoginPosition(f);
	return false;
}

function showLogin() {
	var f = document.getElementById("login-form");
	if ((f != null)) {
		setLoginPosition(f);
		if (f.style.display == "none") f.style.display = "block";
		f = document.getElementById("inpLogin");
		if ((f != null)) f.focus();
	}
	return false;
}

function hideLogin() {
	var f = document.getElementById("login-form");
	if ((f != null) && (f.style.display != "none")) f.style.display = "none";
	return false;
}
// end управление окном login-form
