
function openWindow(string,mywidth,myheight)
{
	window.adminView = open(string,'adminView','width=' + mywidth + ',height=' + myheight + ',left=55,top=220,status=no,scrollbars=yes,toolbar=no,titlebar=no,location=no,menubar=no,alwaysRaised=yes');
}


// -------------------------------------------------------------------
//	Rozbalene/zabalenie polozky v organizačnej štruktúre
// -------------------------------------------------------------------
function expand(i) 
{   
	// Pozn.: Vstupny parameter: i - ID rozbalovaneho/zabalovaneho prvku

	if (document.getElementById(i + "div").style.display == "block")
	{
		// zabalenie
		document.getElementById(i + "div").style.display = "none";
		// zmena obrazku na "plus" - stav po zmene = zabaleny
		document.getElementById(i).src='../ImgAdmin/p.gif';			
		// zmaze udaj o rozbaleni polozky z cookie
		registerCookieEI(i,"delete");
	}
	else
	{
		// rozbalenie
		document.getElementById(i + "div").style.display = "block";
		// zmena obrazku na "minus" - stav po zmene = rozbaleny
		document.getElementById(i).src='../ImgAdmin/m.gif';
		// zapise udaj o rozbaleni polozky do cookie
		registerCookieEI(i, "not delete");
	}		
}



// -------------------------------------------------------------------
//	Nastavenie cookie EI: zapamatanie rozbalenych prvkov 
// (je ich viac - su ale v 1 COOKIE)
// -------------------------------------------------------------------
function registerCookieEI(arg, del) 
{             
     var today = new Date()   
     var expires = new Date()
     var name = "EI"  

     var val = getCookie(name);
     var newVal = "";


     if (del != "delete")
     {    
		if(val != null)
		{
			// vymazem staru hodnotu
	        var cookieValues = val.split("&");
		    for (counter=0; counter<cookieValues.length; counter++)
			{
				if (cookieValues[counter] != arg)
				{
					newVal += cookieValues[counter] + "&";
				}
			}

			// odsekni posledne & (ak tam je)
			if (newVal.substring(newVal.length - 1, newVal.length) == "&")
			{
				newVal = newVal.substring(0, newVal.length - 1)
			}

			// pridam novu hodnotu
			newVal = newVal+"&"+ escape(arg);
		}
		else
		{
			// pridam 1. hodnotu (stara tam iste nie je)
			newVal = escape(arg);
		}
     }
     else
     {
		// vymazem z cookie danu hodnotu
		if(val != null)
		{
	        var cookieValues = val.split("&");
		    for (counter=0; counter<cookieValues.length; counter++)
			{
				if (cookieValues[counter] != arg)
				{
					newVal += cookieValues[counter] + "&";
				}
			}

			// odsekni posledne & (ak tam je)
			if (newVal.substring(newVal.length - 1, newVal.length) == "&")
			{
				newVal = newVal.substring(0, newVal.length - 1)
			}
		}
     }

	 // session cookie - v pripade, ze je prazdna vymaz cookie
	 if (newVal != "")
	 {
		expires = null;
     }
     else
     {
          expires.setTime(today.getTime())     
     }
     
     // poslem cookie
     setCookie(name, newVal, expires);
}


// -------------------------------------------------------------------
//	Pomocna funkcia na zapis cookie so zvolenymi parametrami
// -------------------------------------------------------------------
function setCookie(name, value, expire) 
{   
     document.cookie = name + "=" + escape(value)   
     + ((expire == null) ? "" : ("; expires=" + expire.toGMTString()))
}



// -------------------------------------------------------------------
//	Ziskam VALUE z COOKIE zadaneho mena
// -------------------------------------------------------------------
function getCookie(Name) 
{   
   var search = Name + "="   
   if (document.cookie.length > 0) 
   { 
      // if there are any cookies      
      offset = document.cookie.indexOf(search)       
      if (offset != -1) 
      { 
		// if cookie exists          
		offset += search.length          
        // set index of beginning of value         
        end = document.cookie.indexOf(";", offset)          
        // set index of end of cookie value         
        if (end == -1)
        {
			end = document.cookie.length         
		}
        return unescape(document.cookie.substring(offset, end))      
      }    
   }   
   return null;
}

// otvaranie noveho okna

function okienko(linka,sirka,vyska)
{
  okno=window.open(linka,"okno","left=10,top=10,width="+ sirka +",height="+ vyska +",menubar=no,directories=no,"+"toolbar=no,location=no,status=no,resizable=no,scrollbars=yes");
}

function goReferences(form) { 
	
	var index=form.select.selectedIndex
	
	if (form.select.options[index].value != "0") 
	{
		location=form.select.options[index].value;
	}
}


/*special detection of browser */

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('netscape')) {
	browser = "Netscape";	
	version = detect.charAt(8)
}
else if (checkIt('firefox') && checkIt('gecko')) browser = "Mozilla Firefox";
else if (checkIt('mozilla') && checkIt('gecko')) browser = "Mozilla";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) {
	browser = "IE"
	temp=navigator.appVersion.split("MSIE")
	version=parseFloat(temp[1])
}
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

/* end of special detection of browser */


//rotacia obrazku jednotky na strankach
function rotate_jednotka(){	
	if ( (browser == "IE" && version>=5.5) || browser != "IE"){
		images_1 = new Array ("ImgCont/07.jpg",380,192,"ImgCont/07b.jpg",380,192);		
		var jednotka;
		jednotka = document.getElementById("bnrLeft");
		
		index = Math.round(Math.random()*1)*3;	
		if (jednotka != undefined){
			if (browser == "IE"){	
				jednotka.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+images_1[index]+"', sizingMethod='scale'";
				jednotka.style.width = images_1[index+1]+"px";
				jednotka.style.height = images_1[index+2]+"px";
			}	else {	
				
				jednotka.style.backgroundImage = "url('"+images_1[index]+"')";
				jednotka.style.width = images_1[index+1]+"px";
				//alert(jednotka.style.width);
				jednotka.style.height = images_1[index+2]+"px";
			}
		}
	}
}

// tieto jednoucelne funkcie musia byt tu (a nie priamo v HTML onmouseover atributoch), 
// pretoze FreeTextEditor zle odstranoval uvodzovky z kodu, napr.: 
// onmouseover="this.className='solH165hover'"
function switchClassNameH165Hover() {
	this.className = "solH165hover";
}

function switchClassNameH165() {
	this.className = "solH165";
}

function goToCatID(intID) {
	window.location = "Default.aspx?CatID=" + intID;
}