// malovani cary spojujici menu
// 030527 pro www.salto.cz Marek Fišer, mfiser@kabinet.cz
// rekurzivni zjisteni polohy elementu na strance
function topof(obj) {
	var y=0;
	if (obj.offsetParent) {
		y += obj.offsetTop + topof(obj.offsetParent);
	}
	return y;
}
function leftof(obj) {
	var x=0;
	if (obj.offsetParent) {
		x += obj.offsetLeft + leftof(obj.offsetLeft);
	}
	return x;
}
// objekt dle id
function objid(id) {
	return document.getElementById(id);
}
// nastaveni parametru objektu
function setstyleid(id,t,h,l,w,v) {
	with (document.getElementById(id).style) {
		top = t + 'px';
		height = h + 'px';
		left = l + 'px';
		width = w + 'px';
		visibility = v;
	}
}
// nakresleni linky spojujici menu, vyvolava onload
function drawmenuline() {
	if (document.getElementById) {
		var x1,y1,x2,y2,w1,w2,h1,h2,h12,h22,odsazeni,wmn,wmn1,wmn2;
		wmn = 242; // svisla cara
		if ((objid('prva') == null) || (objid('druha') == null)) return;
		y1 = topof(objid('prva'));
		x1 = leftof(objid('prva'));
		y2 = topof(objid('druha'));
		x2 = leftof(objid('druha'));
		with (document) {
			h1 = getElementById('prva').offsetHeight;
			h12 = parseInt(h1/2);
			x1 += w1 = getElementById('prva').offsetWidth;
			h2 = getElementById('druha').offsetHeight;
			h22 = parseInt(h2/2);
			x2 += w2 = getElementById('druha').offsetWidth;
			x1 += odsazeni = 4; // odsadit
			x2 += odsazeni; // odsadit
			wmn2 = wmn - x2;
			wmn1 = wmn - x1 - ((wmn2 < 0)?wmn2:0);
			wmn2 = (wmn2 > 0)?wmn2:0;
			wmn1 = (wmn1 > 0)?wmn1:0;
 		}
		setstyleid('carka1', y1 + h12, 1, x1, wmn1, 'visible');	// horni linka
		setstyleid('carka2',  y1 + h12, (y2 + h22) - (y1 + h12) + (document.all?2:0), x2, wmn2, 'visible'); // prava a dolni, pricteni bulhara pro MSIE
	}
}