domOK = (document.getElementById && document.documentElement.firstChild);

// domOK = false; //debug

function swapDisplay(x) {
	x.style.display = (x.style.display=="block") ? "none" : "block";
}

function listovaniOnMouseOver(x) {
	if (domOK) {
		var i = (getNextSiblingByClassName(x.parentNode.parentNode, "svazky").style.display == "block") ? "sbalit" : "rozbalit";
		var ikony = getFirstChildByClassName(x.parentNode.parentNode, "ikona");
		getFirstChildByClassName(ikony, i).style.display = "block";
	}
}

function listovaniOnMouseOut(x) {
	if (domOK) {
		var ikony = getFirstChildByClassName(x.parentNode.parentNode, "ikona");
		getFirstChildByClassName(ikony, "rozbalit").style.display="none";
		getFirstChildByClassName(ikony, "sbalit").style.display="none";
	}
}

function listovaniOnClick(x) {
	if (domOK) {
		swapDisplay(getNextSiblingByClassName(x.parentNode.parentNode, "svazky"));
		if(document.getElementById("dolni")&&moveit) moveit();
	}
}

function popUp(url, name, w, h, scrollbars) { if (domOK) {
	var p = "location=no, menubar=no, resizable=no, toolbar=no";
	if(new String(url).indexOf("s1=statistika")>0) p+=", status=yes"; else p+=", status=no";
	var l = Math.round((screen.availWidth-w)/2);
	var t = Math.round((screen.availHeight-h)/2);
	var s = scrollbars ? "yes" : "no";
	p += ", width=" + w + ", height=" + h + ", left=" + l + ", top=" + t + ", scrollbars=" + s;
	var popup = window.open(url, name, p);
	popup.focus();
} }

function popUpDotaz(url, name, w, h, scrollbars) { if (domOK) {
	var p = "location=no, menubar=no, resizable=no, status=no, toolbar=no";
	var l = Math.round((screen.availWidth-w)/2);
	var t = Math.round((screen.availHeight-h)/2);
	var s = scrollbars ? "yes" : "no";
	p += ", width=" + w + ", height=" + h + ", left=" + l + ", top=" + t + ", scrollbars=" + s;
	var popup = window.open(url, name, p);
	popup.focus();
} }

function prihlaseniZobraz(x2) {
	var x = parseInt(document.getElementById("prihlaseni").style.left);
	var rozdil = x2 - x;
	if(rozdil > 0) {
		document.getElementById("prihlaseni").style.left = (x + Math.round(rozdil/2)) + "px";
		setTimeout("prihlaseniZobraz(" + x2 + ")", 50);
	};
}

function passportPrihlaseniOnMouseOver(tit) {
	if (domOK) {
		var x1 = -200;
		var x2 = tit ? 64 : 576;
		var y = tit ? 42 : 6;
		document.getElementById("prihlaseni").style.left= x1 + "px";
		document.getElementById("prihlaseni").style.top= y + "px";	
		prihlaseniZobraz(x2);
	}
}

function passportPrihlaseniOnMouseOut() {
	if (domOK) {
		document.getElementById("prihlaseni").style.left="-200px";
	}
}