function nad(obr) 
{
  {img=eval(obr+"_on.src");
  document[obr].src = img;
  }
}

function prec(obr) {
   img=eval(obr+"_off.src");
    document[obr].src = img;
}

function otvor (theURL,wx,wy,okno) {
	mx = Math.round((screen.width-wx)/2);
	if (okno=='') okno='tab';
	tab = window.open(theURL,okno,"width="+wx+",height="+wy+",toolbar=no,directories=no,scrollbars=yes,location=no,resizable=yes,menubar=no,left="+mx+",top=10");
	if (tab) tab.focus();
}

function otvor_wmv (theURL) {
	mx = Math.round((screen.width)/2);
	okno='wmv';
	tab = window.open(theURL,okno,"width=258, height=192, toolbar=no,directories=no,scrollbars=no,location=no,resizable=no,menubar=no,left="+mx+",top=10");
	if (tab) tab.focus();
}

function otvor_search (theURL,wx,wy) {
mx = Math.round((screen.width-wx)/2);
tab = window.open(theURL,"search","width="+wx+",height="+wy+",toolbar=no,directories=no,scrollbars=yes,location=no,resizable=yes,menubar=no,left="+mx+",top=10");
if (tab) tab.focus();
}

function checksearch () {
	var q=search.q.value;
	otvor_search('../hladaj/search.php?ps=20&wm=sub&q=' +q+'&cat=',750,550);
	return false;
}

var flash2Installed = false;
	var flash3Installed = false;
	var flash4Installed = false;
	var flash5Installed = false;
	var flash6Installed = false;
	var maxVersion = 6;
	var actualVersion = 0;
	var jsVersion = 1.0;
	
	function flashdetect () {	
		var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;	
		var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; 
		jsVersion = 1.1;
		// write vbscript detection if we're not on mac.
		if(isIE && isWin){ // don't write vbscript tags on anything but ie win
			document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
			document.write('on error resume next \n');
			document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
			document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
			document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
			document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');	
			document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');	
			document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
		}
			if (navigator.plugins){		
				if (navigator.plugins["Shockwave Flash 2.0"] 
				|| navigator.plugins["Shockwave Flash"]){	
					var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
					var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
					var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
					flash2Installed = flashVersion == 2;		
					flash3Installed = flashVersion == 3;
					flash4Installed = flashVersion == 4;
					flash5Installed = flashVersion == 5;
					flash6Installed = flashVersion == 6;
				}
			}
			for (var i = 2; i <= maxVersion; i++) {	
				if (eval("flash" + i + "Installed") == true) actualVersion = i;
			}
			if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;	
			return actualVersion;

	}

function checkFormDiskusia(formEl)
{
	if (formEl)
	{
		if (!formEl.meno.value)
		{
			alert("Vyplne prosím svoje meno!");
			formEl.meno.focus();
			return false;
		}
		if (!formEl.text.value)
		{
			alert("Vyplne prosím text príspevku!");
			formEl.text.focus();
			return false;
		}
		return true;
	}
}

	//Menu Set-Up Javascript

var help_width = 310;

var DOM = (document.getElementById)? true : false;
var OP = (window.opera)? true : false;
var OP5 = (OP && DOM)? true : false;
var NS = (window.outerWidth && !OP)? true : false;
var NS6 = (NS && DOM)? true : false;
var NS4 = (NS && !DOM)? true : false;
var IE = (document.all && !OP)? true : false;
var IE5 = (IE && DOM)? true : false;
var IE4 = (IE && !DOM)? true : false;

// resizovac

function Resize(width,height,top,left){
	if (!(NS6 || OP)) {
		window.resizeTo(width,height)
		window.moveTo(left,top)
	}
}

function Unloader() {
	window.close();
}

function HelpPopup(src) {
	if (IE4 || IE5) {
//		newwin = window.open(src,'sitemap','toolbar=no,resizable=yes,scrollbars=yes,top=0,left=' + (screen.width-help_width - 10) +',width=' + help_width +',height=' + (screen.height - 60) + '');
		newwin = window.open(src,'sitemap','toolbar=no,resizable=yes,scrollbars=yes,top=0,left=' + (screen.width-help_width - 10) +',width=' + help_width +',height=525');
	} else {
		newwin = window.open(src,'sitemap','toolbar=no,resizable=yes,scrollbars=yes,top=0,left=' + (screen.width-help_width) +',width=' + help_width +',height=525');
	}
	newwin.opener = self;
	newwin.focus();
}

function HelpClose() {
	Unloader();
}

function ResizeOnLoad() {
	if (!(NS6 || OP)) { 
		window.opener.moveTo(0,0);
		window.opener.resizeTo(screen.width-help_width-10,screen.height-30);
	}
}

function ResizeOnClose() {
	if (!(NS6 || OP)) window.opener.resizeTo(screen.width,screen.height);
}

function SitemapOpenClose(elNum, imgMain) {	
	if (elNum != '')
	{
		var image;
		var list = document.getElementById ? document.getElementById('submenu'+elNum) : document.all['submenu'+elNum];
		if (imgMain) image = document.getElementById ? document.getElementById('mainimage'+elNum) : document.all['mainimage'+elNum];
		else image = document.getElementById ? document.getElementById('subimage'+elNum) : document.all['subimage'+elNum];
		if (list)
		{
			if (list.style.left != '')
			{
				list.style.left = '';
				list.style.position = '';
				list.style.display = '';
				if (image)
				{
					if (imgMain) image.src = '../images/sitemap_minus.gif';
					else image.src = '../images/polozka_akt.gif';
				}
	//			alert('if - list: '+list.style.display+'; image: '+image.src);
			}
			else
			{
				list.style.left = '-1000px';
				list.style.position = 'absolute';
				list.style.display = 'none';
				if (image)
				{
					if (imgMain) image.src = '../images/sitemap_plus.gif';
					else image.src = '../images/adr_neakt.gif';
				}
	//			alert('else - list: '+list.style.display+'; image: '+image.src);
			}
//			alert(list.style.position);
		}
	}
}

function SitemapOpenCloseAll(openMap)
{
	if (openMap)
	{
		var position = '';
		var left = '';
		var display = '';
		var imgSrcMain = '../images/sitemap_minus.gif';
		var imgSrcSub = '../images/polozka_akt.gif';
	}
	else
	{
		var position = 'absolute';
		var left = '-1000px';
		var display = 'none';
		var imgSrcMain = '../images/sitemap_plus.gif';
		var imgSrcSub = '../images/adr_neakt.gif';
	}
	var element = document.getElementsByTagName("UL");
	for(var i = 0; i < element.length; i++)
	{
		if (element[i].title != 'ok')
		{
			element[i].style.position = position;
			element[i].style.left = left;
			element[i].style.display = display;
		}
	}
	var image = document.getElementsByTagName("IMG");
	for(var i = 0; i < image.length; i++)
	{
		if (image[i].id.indexOf("subimage") > -1)
		{
			image[i].src = imgSrcSub;
		}
		else if (image[i].id.indexOf("mainimage") > -1)
		{
			image[i].src = imgSrcMain;
		}
	}
}
function UkazObrazok(obrazok){
		var p_width = 750;
		var p_height = 550;
		var p_left = screen.width/2 - p_width/2;
		var p_top = screen.height/2 - p_height/2;
		window.open("../include/obrazok.php?obr="+obrazok,"nove","menubar=no,resizable=yes,status=no,left="+p_left+",top="+p_top+",width="+p_width+",height="+p_height);
}
