//move image over
function overIMG(imgName){
	window.document[imgName].src = eval(imgName + "on.src");
}
function outIMG(imgName){
	window.document[imgName].src= eval(imgName + "of.src");
}	
function clcIMG(imgName){
	window.document[imgName].src= eval(imgName + "cl.src");
}

// open external window for pictures
function ShowBigPic(picnum){
	DefWnd = window.open('wnd_show_pic.php?picnum='+picnum+'', 'Picwindow', 'toobar=no, location=no, directories=no, status=no, scrollbars=no, resizable=yes, copyhistory=no, width=400,height=470')
	self.Picwindow = DefWnd;
	Picwindow.focus();
}

//informacni texty od mista
function showText(tid){
	DefWnd = window.open('wnd_show_text.php?tid='+tid+'', 'TextWindow', 'toobar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, copyhistory=no, width=500,height=500')
	self.Picwindow = DefWnd;
	Picwindow.focus();
}


//Pridat do bookmarku
function addbookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}


//kniha navstev detail, okno
function knihaNavstevDetail(id_kniha){
	url = "wnd_kniha_navstev.php?idz=";
	ExtWnd('KnihaNavstev',url+id_kniha,600,550,'scrollbars=yes, resizable=yes');
}

/** EXTERNI MAPA, OTEVRENI MAPY, nastaveni pro centrum, shocart atp
	Spravne nastaveni je vazano na dohodu o poskztovani map s providerem
	Link na zobrazeni mapy v externim okně
	nastaveni url pro zobrazeni mapy
*/
function DispExtMap(url){
	ExtWnd('Mapa',url,600,550,'scrollbars=no, resizable=yes');
}

//Parametry x;y;meritko;nazev
function showCentrumMap(param){
	val = param.split(':');
	url = "http://supermapy.centrum.cz/mapAPI.php?cross=" + val[0] + ":" + val[1] + "&zoomlevel=" + val[2] + "&ql_note="+val[3];
	//alert (url);
	ExtWnd('Mapa',url,550,550,'scrollbars=no, resizable=yes');
}
/**
<a href="javascript:ShowMap(3443329,5532264,23623)">mapa 0 </a>
<a href="javascript:ShowMap(3443329,5532264,30236)">mapa 1</a>
  	w=window.open("http://shocart2.tmapserver.cz/tms/shocart/index.php?client_type=shocart&client_lang=cz_iso&Zoom=ToScale&strange_opener=0&Scale="+mer+"&interface=tmv&ShowLayer=&Command=ShowCoord&Theme=XY&Coords="+x+":"+y+"&CoordSys=S42&cacheID=1107247889015","TMapServer","status=1,menu=1,width=750,height=550,scrollbars=0,resizable=0");
http://shocart2.tmapserver.cz/tms/shocart/index.php?client_type=shocart&client_lang=cz_iso&Zoom=ToScale&strange_opener=0&Scale="+mer+"&interface=tmv&ShowLayer=&Command=ShowCoord&Theme=XY&Coords="+x+":"+y+"&CoordSys=S42&cacheID=1107247889015","TMapServer","status=1,menu=1,width=750,height=550,scrollbars=0,resizable=0");
*/
function ShowShocartMap(x,y,mer) {
  	//w=window.open("http://shocart2.tmapserver.cz/tms/shocart/index.php?client_type=shocart&client_lang=cz_iso&Zoom=ToScale&strange_opener=0&Scale="+mer+"&interface=tmv&ShowLayer=kempy&Command=ShowCoord&Theme=XY&Coords="+x+":"+y+"&CoordSys=S42&cacheID=1107247889015","TMapServer","status=1,menu=1,width=750,height=550,scrollbars=0,resizable=0");
  	w=window.open("http://shocart2.tmapserver.cz/tms/shocart/index.php?client_type=shocart&client_lang=cz_iso&Zoom=ToScale&strange_opener=0&Scale="+mer+"&interface=tmv&ShowLayer=&Command=ShowCoord&Theme=XY&Coords="+x+":"+y+"&CoordSys=S42&cacheID=1107247889015","TMapServer","status=1,menu=1,width=750,height=550,scrollbars=0,resizable=0");
	w.focus();
}

// Atlas mapy, 
function showAtlasMap(x,y){
 	w=window.open("http://www.hrady.cz/mapy/wnd_amapa.php?latlon="+x+";"+y,"aMapy","status=0,menu=0,width=750,height=550,scrollbars=0,resizable=0");
	w.focus();
}


// Atlas mapy, turisticka
//function showAtlasMapT(x,y){
function showAtlasMapT(xst,xmin,xvt,yst,ymin,yvt){
	//url = 'http://amapy.atlas.cz/?q='+xst+'°'+xmin+'\''+xvt+'N;'+yst+'°'+ymin+'\''+yvt+'E#x=3546969@y=5521970@cs=1@sidx=3@pg=2@pl=@app=5';
	//url = 'http://amapy.atlas.cz/#x=@y=@cs=1@sidx=0@pg=2@pl=@app=5@ms=3@q='+xst+'°'+xmin+'\''+xvt+'N;'+yst+'°'+ymin+'\''+yvt+'E';
	//url = 'http://mapy.atlas.cz/#x=0@y=0@cs=1@sidx=3@pg=2@pl=@app=5@sbar=c@specbtns=0@ann=0@maxmap=1@q='+xst+'°'+xmin+'\''+xvt+'N;'+yst+'°'+ymin+'\''+yvt+'E';
	url = 'http://amapy.atlas.cz/#x=-753103@y=-980594@maxmap=1@specbtns=0@ann=0@cs=1@sidx=3@pg=2@pl=@app=5@q='+xst+'°'+xmin+'\''+xvt+'"N;'+yst+'°'+ymin+'\''+yvt+'"E@sbar=c';
	//url = 'http://mapy.atlas.cz/#x=0@y=0@cs=1@sidx=3@pg=2@pl=@app=5@sbar=c@specbtns=0@ann=0@maxmap=1@q='+x+'N;'+y+'E';
	
	//alert (url);
	//%20   %B0  %27 %22E 
	w=window.open( url,"aMapy","status=0,menu=0,width=750,height=550,scrollbars=0,resizable=0");
	w.focus();
}

/**	Otevreni ortofotomap na serveru seznamu
	lat ve formátu SS:MM:VV.vv 50:32:33.00
	lon ve formátu SS:MM:VV.vv 14:00:34.92
	*/
function ShowOrtoMap(lat, lon, zoom, title, article ){
	zoom = zoom > 0 ? zoom : 12;
	url = 'http://www.mapy.cz/?lat='+lat+'&lon='+lon+'&userMarkLat='+lat+'&userMarkLon='+lon+'&zoom='+zoom+'&mapType=ophoto&userMarkTitle='+title+'&articleName='+article;
	//url = 'http://wiki.mapy.cz/getpoi.php?lat='+lat+'&amp;lon='+lon+'&amp;userMarkLat='+lat+'&amp;userMarkLon='+lon+'&amp;zoom='+zoom+'&amp;mapType=ophoto&amp;userMarkTitle='+title+'&amp;articleName='+article;
  	//urm = 'http://wiki.mapy.cz/getpoi.php?lat='+lat+'&amp;lon='+lon+'&amp;userMarkLat='+lat+'&amp;userMarkLon='+lon+'&amp;zoom='+zoom+'&amp;mapType=ophoto&amp;userMarkTitle='+title+'&amp;articleName='+article;
	wnd_orto=window.open(url,"OrtoFotoMap","status=1,menu=1,width=750,height=550,scrollbars=1,resizable=1");
	wnd_orto.focus();
}

	

// funkce pro otevreni reklamniho okna - definice 
function reklama(url){
	//url = "reklama.php";
	//url = "inz1/inz.html";
	ExtWnd("REKLAMA", url,250,250,'');
}

//Ext WINDOW
function ExtWnd(name, url, x, y, mode){
    if (mode==1){
		scrh = screen.height/2-100;
		scrw = screen.width/2-150;
		windowprops = ' scrollbars=no, resizable=no,';
		windowprops += ",top="+scrh+",left="+scrw;
    }else if (mode==2){
		windowprops = ' scrollbars=no, resizable=yes,';
    }else{
        windowprops = 'toobar=no, location=0, directories=0, status=0,  menubar=no,  width='+x+',height='+y;
   		windowprops	+= ", "+mode;
	}
    //alert (windowprops);
	var okno = window.open( url , name, windowprops);
	okno.focus();
}


/* pridani mista externim oknem, pouyiva se  pri pridavani akci */
function findMisto(form){
	scrh = screen.height/2-100;
	scrw = screen.width/2-150;
	windowprops = "top="+scrh+",left="+scrw+",resizable=yes, scrollbars=1, width= 350 ,height= 300";
	url = "findmisto.php?form=" + form;
	wnd = window.open(url, "FindMisto", windowprops);
	wnd.focus();
}

/**OTEVRENI OKNA NAPOVEDY*/
function Help(hlp_id){
	ExtWnd('Help','help.php?hlp=' + hlp_id + '',520,400,'scrollbars=yes,resizable=yes');
}

/**ODESLANI POHLEDNICE PODLE PID*/
function sendPohledek(pid){
	ExtWnd('pohledek','wnd_pohledek.php?pid=' + pid,550,600,'scrollbars=yes,resizable=yes');
}
/**	ZOBRAZENI OKNA S OKOLIM*/
function showOkoli(oid){
	ExtWnd('okoli','wnd_show_okoli_g.php?oid=' + oid,650,550,' scrollbars=no,resizable=yes');
}

/**	ZOBRAZENI obrazku do externiho okna
	samo si meni velikost*/
function showExtPic(id){
	ExtWnd('extpic','wnd_show_extpic.php?id=' + id,600,400,' scrollbars=no,resizable=no');
}

/** NASTAVENI PUDORYSU*/
function setPudorys(picId){
	ExtWnd('pud','wnd_show_pud.php?pic_id=' + picId, 600, 400,' scrollbars=yes,resizable=yes');
}

/** NASTAVENI PUDORYSU*/
function bugReport(pg){
	ExtWnd('bug','wnd_write_to.php?bug=[' + pg + ']', 600, 500,' scrollbars=yes,resizable=yes');
}

/**	Zobrazeni turisticke mapy a list mist*/
function showTuristMap(tmap){
	ExtWnd('tMap','wnd_tmap.php?tmap=' + tmap, 600, 800,' scrollbars=yes,resizable=yes');
}


/**	Napsat správci místa*/
function writeMsgTo(oid){
	ExtWnd('writeAutor','wnd_write_to.php?id=' + oid, 500, 400,' scrollbars=yes,resizable=yes');
}

/**	Otevrit misto do noveho okna
	Pokud existuje ovladaci prvek 
		openWindowModeMethod = '0,1', 1 - otevirame do noveho okna nebo do 0 - aktuálního.
	*/
function openOID(oid){
	if ( document.getElementById('openWindowModeMethod') == null || document.getElementById('openWindowModeMethod').value == '0'){
		//stavajici okno
		document.location = '?OID='+oid;
	}else if (document.getElementById('openWindowModeMethod').value == '2'){		
		//zapisnik
		ZapisnikDirectAdd(oid);
	}else{
		//nove okno
		DefTxt = window.open('index.php?OID='+oid , 'TextWindow', 'toobar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=yes, copyhistory=no, width=850,height=600')
		self.MainWindow = DefTxt;
		MainWindow.focus();
	}
}

/** ZAPISNIK,  VLOZENI MISTA DO ZAPISNIKU 
	param - 
	stara funkce, nyni reseno AJAX
	*/

function ZapisnikAdd(param){
	//Vymena buttonku, kouknem jakejje a pak nastavime
	//butElem = document.getElementById('but_zapisnik_oid');
	//alert (butElem.title);
	/*
	if ( butElem.title == "Uložit do zápisníku" ){
		butElem.src = "img/but_zamek_1.png";
		butElem.title = "Odebrat ze zápisníku";
	}else{
		butElem.src = "img/but_zamek_0.png";
		butElem.title = "Uložit do zápisníku"
		param = -param;
	}
	*/
	//val = param.split(':');
	/*
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  winW = window.innerWidth;
	  winH = window.innerHeight;
	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  winW = document.body.offsetWidth;
	  winH = document.body.offsetHeight;
	 }
	}
	divBoxInfo = document.getElementById('divInfoBoxText');
	

	if ( param < 0 )
		divBoxInfo.innerHTML = "Místo bylo<br /> ze zápisníku<br /> odebráno.";
	else
		divBoxInfo.innerHTML = "Místo bylo<br /> uloženo<br />do zápisníku.";

	rmtElemDisp = document.getElementById('rmtBoxInfo');
		//umistime do stredu stranky
	rmtElemDisp.style.left = winW / 2 - 150;
	rmtElemDisp.style.top = winH / 2 - 60;
	rmtElemDisp.style.display = "block";
	//ulozeni mista
	rmtElem = document.getElementById('rmtBox');
	rmtElem.src =  'rmt.php?addoid=' + param;
	setTimeout("rmtElemDisp.style.display = 'none'", 1500);
	
	//kouknem jestli je otevrene okno zapisniku, v tom pripade bude nutne jeho reload
	//!!! nevime jak na to
	//alert ( window.top.Zapisnik); 

	//alert ( window.top.opener.name );
	/*if (window.top.Zapisnik && !window.top.opener.closed){
		alert ("Reload");
	}
	*/
//}
}




function resetMisto(form){
	document.forms[form].addhid.value = "";
	document.forms[form].misto.value = "";
}

/** POCITANI maximalniho poctu znaku v textovem poli a
	zobecnit funkci pro vnejs
	txelem - this
	txdisp - id mista pro txt vystup
	numchar - počet povolených znaků
	co takhle udělat počet kop písmen
	kopa - 60
	tucet - 12
	*/
function countChar( txelem, txdisp, numchar ) {
    var  p = 0;
   	//alert (txelem + txdisp + numchar);
    //txelem = document.getElementById( txelem );
	//alert (txelem.value.length);
    for( Count = 0; Count < txelem.value.length; Count++ ) {
     var tchar = txelem.value.substring( Count, Count + 1 );
     var s = tchar.indexOf( "\n" );
     if( s == 0 ) p++;
   }
  strlength = ( txelem.value.length ) - ( p );
  if( strlength > numchar ) {
    //alert( "Délka napsaného textu přesahuje limit " + numchar + " znaků!" );
    txelem.value = txelem.value.substring( 0, numchar );
    charleft = "!!!";
  } else charleft = numchar - strlength;
  	document.getElementById( txdisp ).innerHTML = charleft ;
}


/** POCITANI poctu znaku v textovem poli
	txelem - this, src element
	txdisp - id mista pro txt vystup
	numchar - počet povolených znaků, 0 - nehlidame
	co takhle udělat počet kop písmen
	kopa - 60
	tucet - 12
	*/
function showNumChar( txelem, txdisp, numchar ) {
  var  p = 0;
  strlength = txelem.value.length;
  if( strlength > numchar && numchar != '0') {
	txelem.style.background = "#ffb3b3";
  }else{
    txelem.style.background = "#FFFFFF";
	 }
	document.getElementById( txdisp ).innerHTML = numchar - strlength;
}


//OVLADANI SCHOVAVANI MENU
var OldShowBox = false;
var OldSubShowBox = false;
var PrevShowBox = true;

/**================================================================================
* Funkce pro otvirani a schovavani navigacnixh menu
* s paramerem noclose = 1 se manipuluje s vnitrnim submenu a hlavni box se nechava
* s parametrem noclose = 2 se vnitrni boxy prepinaji
*/
function ShowHide( ElemBox, noClose, mapAction ){
  ElemBoxManipulate = document.getElementById(ElemBox);
  if ( noClose ){
  	//submenu
	if (OldSubShowBox && noClose == 2 ){
		//prepiname otevrene sub menu
		OldSubShowBox.style.display = "none";
	}
  	//pak s tim old nemanipulujeme a nastavujeme jen podruzne
    if ( ElemBoxManipulate.style.display == "none" && PrevShowBox ){
         ElemBoxManipulate.style.display = "block";
		 OldSubShowBox = ElemBoxManipulate;
	}else if ( ElemBoxManipulate.style.display == "block" && PrevShowBox ){
		//je otevrena, tak ji zavrem
		ElemBoxManipulate.style.display = "none";
		//OldSubShowBox = ElemBoxManipulate;
    }
  }else{
  //hlavni cast menu
	if (OldShowBox){
	//pokud je starej stejnej jak novej tak zablokujem manipulaci
	if (OldShowBox.id ==  ElemBoxManipulate.id ){
		//kouknem v jakym je stavu
		if (ElemBoxManipulate.style.display == "none"){
			ElemBoxManipulate.style.display = "block";
		}else{
			ElemBoxManipulate.style.display = "none";
		}
		PrevShowBox = false;
		//alert ("SHODA");
	}else{
		OldShowBox.style.display = "none";
	}
   }
    if ( ElemBoxManipulate.style.display == "none" && PrevShowBox ){
         ElemBoxManipulate.style.display = "block";
		 OldShowBox = ElemBoxManipulate;
		 //schovame pro otevreni po nacteni
	 	 setShowElem(ElemBox, mapAction);
	}else if ( ElemBoxManipulate.style.display == "block" && PrevShowBox ){
		//je otevrena, tak ji zavrem
		ElemBoxManipulate.style.display = "none";
		OldShowBox = ElemBoxManipulate;
    }
	PrevShowBox = true;
	}

  //pro reload mapy, koukne, jestli je okno on
  if (mapAction){
  	if (ElemBoxManipulate.style.display == 'block'){
		AktivujMapDisp();
		//alert ("je On");
	}
  }


}

//=================================================================================
//modifikovane ovladani menu, chovavani a zobrazovani
function ShowAndHide( ElemBox, ahide ){
    ElemBoxManipulate = document.getElementById(ElemBox);
  //kliknutim otevreme nebo zavreme, pokud je otevren
  //zaroven zavirame 
    if (ahide == 1){
		//nezavirame old element
    	//alert ("pozadavek na autohide");
    }
  
    if (ElemBoxManipulate.style.display == "none"){
        ElemBoxManipulate.style.display = "block";
    }else{
        ElemBoxManipulate.style.display = "none";
    }
}


//Nastavime id elementu, kterej ma byt otevren pro reloadu
//pokud je element mapa, tak musime aktivovat
function setShowElem(elem, mapAction){	
	LastElmVal = document.getElementById('menuOpenBox');
	LastElmVal.value = elem + ";" + mapAction;
	//alert ("Nastaven " + elem);
}

//aktivujeme naposledy otevrenej box
//doresit mapu, jestli je flash mapa, tak musime aktivovat kraje
function OpenLastOpenedBox(){
	//nactem info z prvku
	LastElmVal = document.getElementById('menuOpenBox');
	if (LastElmVal.value){
		BoxValues = LastElmVal.value.split(';');
		ShowHide(BoxValues[0],0, BoxValues[1]);
	}
}


//Ovladani Checkboxu z Flash mapy ==================================================
//chid - cislo kraje, stav 1/0 [2-negace vyberu]
function OvlCheckBox(chid,stav){
	//alert ("Pokus o nastaveni checkboxu");
    SeleCh = document.getElementById("krajbox"+chid);
	if (!SeleCh || SeleCh == null){
		//neexistuje checkbox, tak to ukladame do textpole
	    //SeleTx = document.getElementById("krajbox");
		//SeleTx.value = chid + ";" + SeleTx.value;
		addMapItem("krajBoxList", chid)
	}else{
	    if (stav == '1'){
	       SeleCh.checked = true;
	    }else if (stav == '0'){
	        SeleCh.checked = false;
	    }else{
	        SeleCh.checked = SeleCh.checked ? false : true;
	    }
	}
}

//===================================================================
// Vkladani vybraneho kraje do hidden pole u mapy kraje
function addMapItem(dstPrvek, idkraj){
	element_textbox = document.getElementById(dstPrvek);
	present = false;

	var newIdSeznam = "";
	arkraje = element_textbox.value.split(' ');
	//projedem, jestli tam uz nahodou neni, pokud ano tak ho nezapisem do var
	for (j=0; j < arkraje.length; j++){
		if (arkraje[j] && arkraje[j] == idkraj ){
			//alert (arkraje[j]);
			present = true;
			//tak ho musime odstranit
			//element_textbox.value = arkraje[j] + " ";
		}else if (arkraje[j]){
			//alert (" new seznam - " + newIdSeznam + ", nový prvek - " + arkraje[j]);
			newIdSeznam += arkraje[j] + " ";
		}
	}
	if (!present){
		element_textbox.value = idkraj + " " +element_textbox.value;
	}else{
		element_textbox.value = ""; // vyprazdnime pole
		element_textbox.value = newIdSeznam;
	}
	//alert (element_textbox.value);
}

//zapnuti vysvicenych kraju s kontrolou otevreneho okna
function AktivujMapDisp(){
//kontrola stavu zalozky
//kraje vytahneme z boxu ktere jsou dodany v checkbox jako pole

//vztahnout zaskrtnute elmboxy
//alert ();


/*
 krajeList = document.getElementById('krajBoxList');
 kraje = krajeList.value;
 if (kraje){
 	//pokud je okno vidielne tak aktivuj
	//alert ("musime zobrazit kraje - " + kraje);
	arkraje = kraje.split(" ");
	for (j=0; j < arkraje.length; j++) {
	 	if (arkraje[j]){
		  	//alert (arkraje[j]);
		  	setTimeout('TurnOnLayer('+arkraje[j]+')', 150);
		}
	 }
 }
 */
}


/**	Otevreni odkazu do noveho okna*/
function goToURL(url){
		DefTxt = window.open( url, 'ExtLinkWindow', 'toobar=1, location=1, directories=1, status=1, scrollbars=yes, resizable=yes, copyhistory=1');
		self.extLinkWnd = DefTxt;
		extLinkWnd.focus();
}


/** ZPRACOVANI FLASHOVYCH OBRAZKU A POZADAVKU Z a DO */
function playTarget(idkraj){
SeleCh = document.getElementById("krajbox"+idkraj);
if (SeleCh.checked)
    var pT=window.document.mapcontrol.TGotoFrame("_root.kraj"+idkraj,43);
else
    var pT=window.document.mapcontrol.TGotoFrame("_root.kraj"+idkraj,1);
}

function OvlFlash(idkraj){
	var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
    var mc = InternetExplorer ? window.mapcontrols : window.document.mapcontrols;
    mc.TGotoFrame(10);
    mc(5).TGotoFrame(10);
    mapcontrols(5).TGoToFrame(10);
}


function TurnOnLayer(idl){
   var pT = window.document.mapcontrol.TGotoFrame("_root.kraj"+ idl ,43);
}


/** ZPRACOVANI VYHLEDAVACIHO FORMU NA TITULCE A OSTATNICH STRANACH*/
function srchFormResult(){
	//podle radio vybrat akci
	var typAction = document.getElementsByName('srch_typ')
	for (var i=0; i<typAction.length; i++){
     if (typAction[i].checked){
     	var comElem = typAction[i].value;
		break;
     }
	}
	//alert ( typAction.length + ' ' + comElem);
	//return false;
	//podle vyberu combo zvolit akci
	//comElem = document.getElementById('top_srch_typ');
	switch (comElem){
		case '1':
			pgidElem = document.getElementById("SrchPageDst");
			pgidElem.value = 'main_srch_result';
			return true;
		break;
		case '2':
			pgidElem = document.getElementById("SrchPageDst");
			pgidElem.value = 'main_okoli';
			return true;
		break;
		case '3':
			//otevreme okon s googlem a natahneme result presmerovani a prevod do UTF 8
			/*
			wrdElem = document.getElementById('top_searchWord');
			var srchwrd = wrdElem.value;
			if ( srchwrd.length > 0 ){
				ExtWnd('google', './main_srch_google.php?srchWord=' + srchwrd, 750, 600, 'toolbar=yes, scrollbars=yes, resizable=yes,');
				//location.href = glink ;
			}
			return false;
			*/
			wrdElem = document.getElementById('top_searchWord');
			var srchwrd = wrdElem.value;
			gloc = 'main_srch_google.php?srchWord=' + srchwrd;
			document.location = gloc;
			return false;
		break;
	}
}

/** PREPINANI VIDITELNOSTI NEKOLIKA BLOKU
	boxlist - seznam vsech nazvu divu, ktere chceme prepinat
	funkce si najde prvni zobrazeny, ten vypne a zapne nasledujici v seznamu
	20060507 Vlky
*/
function SwitchBox(boxlist){
	var EndOfSeeking = true;
	var PrvniOut = false;
	var i = 0;
	var val = boxlist.split(',');
	//tocime tak dlouho dokud neni jeden nastavenej na visible
	//pokud jen jeden
	while ( EndOfSeeking ) {
		elem = document.getElementById(val[i]);
		//vypnuti zobrazeneho prvku
		if (elem.style.display == "block" ){
			elem.style.display = "none";
			PrvniOut = true;
		}
		i++;
		if (i == val.length){ i = 0; }
		// zapnuti nasledujiciho prvku		
		elem = document.getElementById(val[i]);
		if ( PrvniOut ){
			elem.style.display = "block";
			EndOfSeeking = false;				
		}
	}
}



/** NAstaveni velikosti boxu podle jineho s redukci
	src box, 
	dst box,
	elevation - uprava velikosti
	*/
function setBoxHeight(src, dst, ele, minh){
	var elm_src = document.getElementById( src );
	var elm_dst = document.getElementById( dst );
	//alert ( " SRC:" + elm_src.offsetHeight + " DST:" +elm_dst.offsetHeight );
	if ( elm_dst.offsetHeight > elm_src.offsetHeight && elm_src.offsetHeight > minh){
		//alert ("NASTAVIME HEIGHT" + elm_src.offsetHeight);
		elm_dst.style.height =  elm_src.offsetHeight + ele + "px";
	}else if( elm_src.offsetHeight < minh ){
		elm_dst.style.height = minh + ele;
	}
}
/**	Nova upravena funkce pro nastaveni dst elementu na max  
	podle souctu vysek src elementu
	src elementID elementID elementID
	dst elementID
	korekce - pridani nebo ubrani vysky
	*/
	var TotalElmsHeight = 0;
function reduceElementHeight(srcElm, dstElm, korekce){
	srcElmArr = srcElm.split(' ');	
	//soucet vsech vysek
	for (j=0; j < srcElmArr.length; j++){
		//alert (document.getElementById(srcElmArr[j]));
		TotalElmsHeight += document.getElementById(srcElmArr[j]).offsetHeight;
		//TotalElmsHeight = TotalElmsHeight + ElmsH;
	}
	DstE = document.getElementById(dstElm);
	if ( DstE.offsetHeight > TotalElmsHeight){
		DstE.style.height = TotalElmsHeight +  korekce + 'px';
	}
}


/**	Nastaveni vysky boxu pokud prekroci nastavenou maximalni velikost 
	olid = element ID
	h = vyska
	*/
function setBoxSolidHeight(olid, h){
	elm = document.getElementById(olid);
	//alert ( elm.offsetHeight );
	if (elm.offsetHeight > h){
		elm.style.height = h;
	}
}


//Refresh function
var Interval = 30;
function refresh(elm, disptime) {
	//pokud poyadujeme yobrayeni casu
	Interval = Interval - 1
	if (Interval == -1) {
		url = document.getElementById("pic"+elm).src;
		//alert (url) ;
		random_num = (Math.round((Math.random()*9)+1))
		document.getElementById("pic"+elm).src = url+"?"+random_num;
		Interval = 30;
	} else {
		if (disptime){
			document.getElementById("txt"+elm).innerHTML = "Obnovení obrázku za "+Interval+" sec.";
		}
	}
	setTimeout("refresh('"+elm+"','"+disptime+"')", 1000 );
}


// natazeni obrazku do info okna s nahledem na tooltip
var dstPicVar = new Array();
function fillPicTip( OID ){
    //alert ('Pozadavek na tootltip...' + OID);
    //natazeni tooltipu boxu
	var imgDivElm = document.getElementById( 'toolTipImage' + OID);
	//dotazeni obrazku
	if ( dstPicVar[OID] ){
		//alert (dstvar[OID]);
		imgDivElm.src = dstPicVar[OID];
	}else{
	   //zde se generuje obrazek
	   var url_ifrm = "wnd_tooltipbox.php?val=" + OID;
	   document.getElementById('infoOverBox').src= url_ifrm;
       //setTipImageSrc(fsrc, OID)
       //imgDivElm.src= url_ifrm;
	}
}

//funkce volana z ext. okna (wnd_tooltipbox.php), naplni var
function setTipImageSrc(fsrc, OID){
	var imgDivElm = document.getElementById( 'toolTipImage' + OID);
	dstPicVar[OID] = fsrc;
	imgDivElm.src = dstPicVar[OID];
}


//-->

