function DImg(ur) {
	var s=window.open(ur,'','width=660, height=660, toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0');
}
function addEvent(obj, event, funct) {  
	if (obj.attachEvent) { //IE  
		obj['e' + event + funct] = funct;  
		obj['x' + event + funct] = function() {  
			obj['e' + event + funct](window.event);  
		}  
		obj.attachEvent('on' + event, obj['x' + event + funct]);  
	} else // other browser  
		obj.addEventListener(event, funct, false);  
}
var h1,h2,delta,div,maxH;
function timedCountNext(h1,h2,delta,div,maxH) {
	h1=h1+delta;
	div.style.height=h1;
	if ((h1*delta)<(h2*delta)) t=setTimeout(function(){timedCountNext(h1,h2,delta,div,maxH)},10)
	else if (h1<1) div.style.height=1;
}
function timedCount() {
	var tree = document.getElementById("menu");
	var a = tree.getElementsByTagName("a");
	for (var i = 0; i < a.length; i++) {
		var aa=a[i];
		if (aa.className=="rozbal") {
			div = aa.nextSibling;
			maxH=div.getElementsByTagName("a").length*27;
			var h=div.style.height;
			h1=h.substring(0, h.length-2)*1;
			if (!h) h1=maxH;
			var t;
			if (h1>maxH/2) {h2=0; delta=-1}
			else {h2=maxH; delta=1}
		}
	}
	timedCountNext(h1,h2,delta,div,maxH);
}
function winW() {
	if (window.innerWidth)
		/* NN4 a kompatibilní prohlížeče */
		return window.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth)
		/* MSIE6 v std. režimu - Opera a Mozilla již uspěly s window.innerHeight */
		return document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth)
		/* starší MSIE + MSIE6 v quirk režimu */
		return document.body.clientWidth;
	else return null;
}

addEvent(window, 'load', function() {
	var tree = document.getElementById("menu");
	var a = tree.getElementsByTagName("a");
	for (var i = 0; i < a.length; i++) {
		var aa=a[i];
		if (aa.className=="rozbal") {
			div = aa.nextSibling;
			addEvent(aa, "click", function () {timedCount();});
			if (aa.nextSibling.getAttribute("id")=="sel") {
				div.style.height=0;
				timedCount();
			} else div.style.height=div.getElementsByTagName("a").length*27;
			if (winW()<1150) {
//				alert (winW());
//				div.setAttribute("style", "position:relative")
//				div.setAttribute("style", "position:relative");
				div.style["position"]="relative";
				div.style.top=0;
				div.style.left=-20;
				div.style.width=127;
//				div.style.top=aa.offsetTop;
			} else {
//				div.setAttribute("style", "position:absolute")
				div.style["position"]="absolute";
			}
		};
	};
});
//--> 

