
var isIE = false, isFF = false, isOp = false, ua = navigator.userAgent;

if (ua.toLowerCase().indexOf("msie") >= 0)	isIE = true;
if (ua.toLowerCase().indexOf("firefox") >= 0)	isFF = true;
if (ua.toLowerCase().indexOf("opera") >= 0)	isOp = true;

var dom = {
	gI : function (el)	{	return document.getElementById(el);				},
	gT : function (el)	{	return document.getElementsByTagName(el);			},
	cT : function(txt)	{	return document.createTextNode(txt);				},
	cE : function (el)	{	return document.createElement(el);				},
	aC : function (p,c)	{	return p.appendChild(c);					},
	tB : function()		{	return (document.compatMode && document.compatMode!="BackCompat") ? document.documentElement : document.body; },
	rC : function (c,p)	{	if((typeof(p)!="undefined") && p != "")	return p.removeChild(c); else return; 	},
	fE : function(e)	{	if (typeof e == 'undefined') e = window.event;	return e;	},
	aE : function (elm,evtType,evtFn,set) {
		if (document.addEventListener) {
			if ((elm == window) && window.opera)	elm == document; 
			elm.addEventListener(evtType,evtFn,set);
		} else	elm.attachEvent('on' + evtType,evtFn);
	},
	rE : function (elm,evtType,evtFn,set) {
		if (document.addEventListener) {
			if ((elm == window) && window.opera) elm == document;
			elm.removeEventListener(evtType,evtFn,set);
		} else	elm.detachEvent('on' + evtType,evtFn);
	}
}

var myCookie = {
	Write : function(name, value, days) {
		if((typeof(days) == "undefined") || days == null) days = 31;
		var D = new Date();
		D.setTime(D.getTime() + (86400000 * days));
		document.cookie = escape(name) + "=" + escape(value) + ";expires=" + D.toGMTString();
		return (this.Read(name) == value);
	},
	Read : function(name) {
		var EN	= escape(name);
		var F	= ' ' + document.cookie + ';', S = F.indexOf(' ' + EN);
		return ((S == -1) ? null : unescape(F.substring(EN = S + EN.length + 2, F.indexOf(';', EN))));
	}
} 

function MM_jumpMenu(targ, selObj, restore) { 
	eval(targ + ".location='" + selObj.options[selObj.selectedIndex].value + "'");
	if (restore) selObj.selectedIndex = 0;
}

function MM_preloadImages() { 		//	v3.0
	var d = document;
	if (d.images) {
		if (!d.MM_p) d.MM_p = new Array();
		var i, j = d.MM_p.length, a = MM_preloadImages.arguments;
		for (i = 0; i < a.length; i++) {
			if (a[i].indexOf("#")  != 0) {
				d.MM_p[j]	= new Image;
				d.MM_p[j++].src	= a[i];
			}
		}
	}
}

function MM_findObj(n, d) { 		//	v4.0
	var p, i, x;
	if (!d) d = document;
	if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
		d = parent.frames[n.substring(p + 1)].document;
		n = n.substring(0, p);
	}
	if (!(x = d[n]) && d.all)				x = d.all[n];
	for(i = 0; !x && i < d.forms.length; i++)		x = d.forms[i][n];
	for(i = 0; !x && d.layers && i < d.layers.length; i++)	x = MM_findObj(n, d.layers[i].document);
	if ( !x && document.getElementById)			x = document.getElementById(n);
	return x;
}

function MM_swapImage() { 		//	v3.0
	var i, j = 0, x, a = MM_swapImage.arguments;
	document.MM_sr = new Array;
	for(i = 0; i < (a.length - 2); i += 3) {
		if ((x = MM_findObj(a[i])) != null) { 
			document.MM_sr[j++] = x;
			if(!x.oSrc) x.oSrc = x.src; 
			x.src = a[i + 2];
		}
	}
}

function MM_swapImgRestore() { 		//	v3.0
	var i, x , a = document.MM_sr;
	for(i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function isblank(s) { 
	for (var i=0;i<s.length;i++){ 
		var c=s.charAt(i); 
		if ((c!=' ')&&(c!='\n')&&(c!='\t')) return false; 
	} 
	return true; 
}

function nic() {			//	return;
}
 
function ZkontrolujSearch(hledej) {
	if ((isblank(dom.gI('what').value)) || (dom.gI('what').value==hledej)) { 
		var nosearch = new Array();
		nosearch[0] = "Zadejte, prosím, hledaný text.";
		nosearch[1] = "Zadajte hľadaný text.";
		nosearch[2] = "Adja meg a keresett szöveget.";
		nosearch[3] = "Enter text to find.";
		alert(nosearch[actlang]);
		return false;
	}else {
		var obraz=document.getElementsByTagName('form');
		for (var i=0;i<obraz.length;i++){ 
			if (obraz[i].name=='srch') obraz[i].submit();
		}
	}
}

function ZkontrolujFormular(hledej1, hledej2) {
	if ((isblank(dom.gI('zakmail').value)) || (dom.gI('zakmail').value==hledej1) || (dom.gI('zakmail').value=="@") || 
	    (isblank(dom.gI('zaktext').value)) || (dom.gI('zaktext').value==hledej2)) { 
//		alert("Zadejte prosím hledaný text.");
		return false;
	}else {
		var obraz=document.getElementsByTagName('form');
		for (var i=0;i<obraz.length;i++){ 
			if (obraz[i].name=='dotaz') obraz[i].submit();
		}
	}
}

function vymazFormular() {
	var obraz=document.getElementsByTagName('form');
	for (var i=0;i<obraz.length;i++){	if (obraz[i].name=='dotaz') obraz[i].reset();	}
}

function zkontrolujPovinne() {
	var args	= zkontrolujPovinne.arguments;
	for (i = 0; i < args.length; i++) {
		if (args[i].indexOf("mail")  != 0) {
			if ((isblank(dom.gI(args[i]).value)) || (dom.gI(args[i]).value==args[i + 1]) || (dom.gI(args[i]).value=="@")) return false;
		} else {
			if ((isblank(dom.gI(args[i]).value)) || (dom.gI(args[i]).value==args[i + 1])) return false;
		}
		i++;
	}
	var obraz=document.getElementsByTagName('form');
	for (var i=0;i<obraz.length;i++){	if (obraz[i].name=='dotaz') obraz[i].submit();	}
}

function onFieldEvent(formobj, text1, text2) {	if (formobj.value == text1) formobj.value = text2; return false;	}

function ControlSearch() {
	if ((event.keyCode >90 && event.keyCode <97) || (event.keyCode >122 && event.keyCode <127) || (event.keyCode >32 && event.keyCode <48) || (event.keyCode >57 && event.keyCode <65)) event.returnValue = false;
}

function poziceL(el) {
	var x;
	x = el.offsetLeft;
	if (el.offsetParent != null)	x += poziceL(el.offsetParent);
	return x;
}

function poziceT(el) {
	var y;
	y = el.offsetTop;
	if (el.offsetParent != null)	y += poziceT(el.offsetParent);
	return y;
}

function vyskaObj(elObj) {
	if (typeof elObj.offsetHeight != "undefined") 		return elObj.offsetHeight; 	// IE
	else if (typeof elObj.clientHeight != "undefined")	return elObj.clientHeight; 	// FF a Op
	else if (typeof elObj.clip.height  != "undefined")	return elObj.clip.height ; 	// všechno staré ostatní
	else return null;
}

function sirkaObj(elObj) {
	if (typeof elObj.offsetWidth != "undefined") 		return elObj.offsetWidth; 	// IE
	else if (typeof elObj.clientWidth != "undefined")	return elObj.clientWidth; 	// FF a Op
	else if (typeof elObj.clip.width  != "undefined")	return elObj.clip.width ;	// všechno staré ostatní
	else return null;
}

function winH() {
	if (window.innerHeight) return window.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
	else if (document.body && document.body.clientHeight) return document.body.clientHeight;
	else return null;
}

function winW() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth) return document.body.clientWidth;
	else return null;
}

function ZarovnaniStranky(chk) {
	dom.gI('odsazdiv').style.visibility	= 'hidden';
				//	if (dom.gI('backgroundDiv') != null) dom.gI('backgroundDiv').style.visibility	= 'hidden';
				//	if (dom.gI('backwhiteDiv')  != null) dom.gI('backwhiteDiv').style.visibility	= 'hidden';
	if (dom.gI('backgroundDiv') != null) dom.gI('backgroundDiv').style.display	= 'none'; 
	if (dom.gI('backwhiteDiv')  != null) dom.gI('backwhiteDiv').style.display	= 'none';
	if (chk != 1)	setTimeout("ZmenOdsazeniStranky()", 0);
	else {
		dom.gI('first').style.display		= 'none';
		dom.gI('odsazdiv').style.visibility	= 'visible';
	}
}

function ZmenOdsazeniStranky() {
	window.onresize = function(){ZarovnaniStranky(0);};
				//	window.onresize = ZmenOdsazeniStranky;
				//	dom.gI('odsazdiv').style.visibility	= 'hidden';
	
	var ho  = winH();

	var cookH = myCookie.Read('navH');	if (cookH != ho) myCookie.Write('navH', ho, 31);
	
	var dh	= vyskaObj(dom.gI('odsazdiv'));

	var ch  = Math.floor((ho - dh) / 2);
	ch	= ch - testop;
	if (ch < 0) ch = 0;							//	alert(ho + " - " + dh + " - " + ch);
	dom.gI('odsazdiv').style.margin		= ch + 'px 0px 0px 0px';	

	if (dom.gI('obsahbox') != null && dom.gI('backwhiteDiv') != null) windowResizeDetailBox();

	dom.gI('first').style.display		= 'none'; 
				//	if (dom.gI('backgroundDiv') != null) dom.gI('backgroundDiv').style.visibility	= 'visible';
				//	if (dom.gI('backwhiteDiv')  != null) dom.gI('backwhiteDiv').style.visibility	= 'visible';
	if (dom.gI('backgroundDiv') != null) dom.gI('backgroundDiv').style.display	= '';
	if (dom.gI('backwhiteDiv')  != null) dom.gI('backwhiteDiv').style.display	= '';
	dom.gI('odsazdiv').style.visibility	= 'visible';
}

function TransparentPNG() {
	if (document.body.filters) {
		var cells = document.getElementsByName('pruhpng');
		for(j = 0; j < cells.length; j++) {
			var oribg	= cells[j].style.background;
			oribg		= oribg.replace("url(", "");
			oribg		= oribg.replace(")", "");
			cells[j].style.background = '';
			cells[j].style.filter	  = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src = '" + oribg + "', sizingMethod = 'noscale')";
			}
		}
	}

function VlozitFlash(flashobj, flashfile, fwidth, fheight) {
	var hrv = DetectFlashVer(6, 0, 0);
	if (hrv) { 	flashtst = 1;	} else {	flashtst = 0;	};
	if (flashtst == 1) {
		var objfl = dom.gI(flashobj);
		var vlfl  = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" WIDTH=' + fwidth + ' HEIGHT=' + fheight + '>';
		vlfl	 += '<PARAM NAME="movie" VALUE="' + flashfile + '"><PARAM NAME="quality" VALUE="high"><PARAM NAME="BGColor" VALUE="#FFFFFF"><PARAM NAME="wmode" VALUE="transparent">';
		vlfl	 += '<EMBED src="' + flashfile + '" quality=high  wmode="transparent" bgcolor="#FFFFFF" WIDTH=' + fwidth + ' HEIGHT=' + fheight + ' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
		objfl.innerHTML = vlfl;
	}
}

function zobrazKufr(picname, kufrW, kufrH) {
	var p	= dom.gT('body')[0];		var l		= dom.gI('kufrlink');
	var im	= dom.cE('img');		im.id		= "kufrImage";
	im.src	= picname;			im.style.zIndex	= 150;
	im.style.position = 'absolute';		im.style.border	= 'solid 2px #aaa';
	im.style.width	= kufrW + 'px';		im.style.height	= kufrH + 'px';
	im.style.top	= (poziceT(l) - 5) + 'px';
	im.style.left	= (poziceL(l) + 60) + 'px';
	dom.aC(p, im);
}

function zrusKufr() { 
	var p = dom.gT('body')[0];
	var c = dom.gI('kufrImage');
	dom.rC(c, p);
}

function NastavPos(npos) {
	pospos = npos;		var prvni  = pospos;		var posled = pospos + zobrv - 1;
	if (pospos == 1) {
		dom.gI('ovll').src		= "images/vm-s-l-n.gif";
		dom.gI('ovll').style.cursor	= "default";
		dom.gI('ovll').onclick		= function(){};
	} else {
		dom.gI('ovll').src		= "images/vm-s-l-a" + znacka + ".gif";
		dom.gI('ovll').style.cursor	= "pointer";
		dom.gI('ovll').onclick		= PosunObrVl;
	}
	if (pospos == pocp) {
		dom.gI('ovlp').src		= "images/vm-s-p-n.gif";
		dom.gI('ovlp').style.cursor	= "default";
		dom.gI('ovlp').onclick		= function(){};
	} else {
		dom.gI('ovlp').src		= "images/vm-s-p-a" + znacka + ".gif";
		dom.gI('ovlp').style.cursor	= "pointer";
		dom.gI('ovlp').onclick		= PosunObrVp;
	}
	for (var k = 1; k <= pocv; k++){
		if (k >= prvni && k <= posled)	dom.gI('pic' + k).style.display   = '';
		else				dom.gI('pic' + k).style.display   = 'none';
	}
}

function PosunObrVl() { if (pospos == 1) npos = pocp; else if (pospos > 1) npos = pospos - 1; else return; NastavPos(npos); }
function PosunObrVp() { if (pospos == pocp) npos = 1; else if (pospos < pocp) npos = pospos + 1; else return; NastavPos(npos); }

function tlRollover(aobj, txt) {
	var divc	= aobj;		//	.parentNode;
//	if(isIE == true) {
//		divc.style.background	= '';
//		divc.style.filter	= "progid:DXImageTransform.Microsoft.AlphaImageLoader(src = 'images/tl_" + txt + ".png', sizingMethod = 'noscale')";
//	} else {
		divc.style.background	= 'url(images/tl_' + txt + '.png)';
//	}
}

function zobrazOdeslano(text) {
	wdH		= 80;
	wdivbg 		= "url(images/box-bg-sm.gif)";
	openDetailBox();
	dom.gI('obsahbox').innerHTML = "<div style=\"color: green; margin-top: 15px; font: bold 12px arial;\">" + text + "</div>";
}