
function b_onload() {

	try {

		g_map_onload();
		}
	catch(e) {

		}

	}

function loadscript(url) {

	var head=document.getElementsByTagName('head').item(0);
	var old=document.getElementById('xlast_id');
	if (old)head.removeChild(old);
	script=document.createElement('script');
	script.src=url;
	script.type='text/javascript';
	script.defer=true;
	script.id='xlast_id'
	void(head.appendChild(script));
	}

function checkinzform(res) {

	if (document.getElementById('souhlas').checked==false) {

		alert('Nebyl potvrzen souhlas s podminkami.');
		return false;
		}

	if (document.getElementById('i-typ-1').checked!=true && document.getElementById('i-typ-2').checked!=true) {
alert('Vyberte typ inzerátu.');
		return false;
		}

	if (document.getElementById('i-idkat').value==0) {

		alert('Vyberte kategorii inzerátu.');
		return false;
		}

	if (document.getElementById('i-nadpis').value.length==0) {

		alert('Vyplňte nadpis inzerátu.');
		return false;
		}

	if (document.getElementById('i-jmeno').value.length==0) {

		alert('Vyplňte jméno.');
		return false;
		}

	if (document.getElementById('i-text').value.length==0) {

		alert('Vyplňte text inzerátu.');
		return false;
		}

/*	if (document.getElementById('i-telefon').value.length==0) {

		alert('Vyplňte telefonní číslo.');
		return false;
		}
*/
	if (document.getElementById('i-heslo').value.length==0) {

		alert('Vyplňte heslo.');
		return false;
		}

	return true;
	}



function checkkontaktform(res) {

	if (document.getElementById('ik-email').value.length<5) {

		alert('Vyplňte Váš email!');
		return false;
		}

	if (document.getElementById('ik-text').value.length==0) {

		alert('Vyplňte text odpovědi!');
		return false;
		}

	return true;
	}


var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);

document.onmousemove = hlidej_mys;

var tempX = 0;
var tempY = 0;

var nahledoknoa=0;
var nahledhtml='';

function hlidej_mys(e) {

	nahledokno=document.getElementById('nahledbig');

	if (nahledoknoa==1) {
	
		if (IE) {
		
			if (document.body.scrollTop==0)
				tempY = event.clientY + document.documentElement.scrollTop;
			else
				tempY = event.clientY + document.body.scrollTop;
			
			if (document.body.scrollTop==0)
				tempX = event.clientX + document.documentElement.scrollLeft;
			else
				tempX = event.clientX + document.body.scrollLeft;
			
		} else {
			tempX = e.pageX;
			tempY = e.pageY;
			}  
  
		if (tempX < 0){tempX = 0}
		if (tempY < 0){tempY = 0}  

		nahledokno.style.left=(tempX+5)+'px';
		nahledokno.style.top=(tempY+5)+'px';
		}

	return true
	}

function n_ac(nahled) {

	setTimeout('n_act(\''+nahled+'\')',350);
	nahledhtml='<img src="/_data/foto/'+nahled+'" />';

	nahledoknoa=1;
	}
	
function n_act(nahled) {

	if (nahledoknoa==1) {
	
		nahledokno.innerHTML=nahledhtml;
		
		nahledokno=document.getElementById('nahledbig');
		nahledokno.style.visibility='visible';
	
		nahledoknoa=1;
		}
	}

function n_de() {

	nahledokno=document.getElementById('nahledbig');
	nahledokno.style.visibility='hidden';

	nahledokno.innerHTML='';
	
	nahledoknoa=0;
	}

function f_open(foto) {

	window.open('/_clscripts/foto.php?foto='+foto,'','scrollbars=yes,width=840,height=630');
	}

var vshowhelp='';
function showhelp(help) {

	try {
		if (vshowhelp=='')
			document.getElementById('help-'+help).style.visibility='visible';
		}
	catch(e) {

		}
	}

function hidehelp(help) {

	try {

		if (vshowhelp=='')
			document.getElementById('help-'+help).style.visibility='hidden';
		}
	catch(e) {

		}
	}

function focushelp(help) {

	try {

		vshowhelp=help;
		document.getElementById('help-'+help).style.visibility='visible';
		}
	catch(e) {

		}
	}

function blurhelp(help) {

	try {

		vshowhelp='';
		document.getElementById('help-'+help).style.visibility='hidden';
		}
	catch(e) {

		}
	}

function changepocet(item,max) {

	try {
	
		var len=0;

		len=document.getElementById('i-'+item).value.length;
		document.getElementById('v-'+item).innerHTML=len;

		if (len>max)
			document.getElementById('v-'+item).innerHTML+=' ! pozor bude oříznuto';
		}
	catch(e) {

		}

	}


function oznacit_inzerat(id,typ) {
	
	var hlaska='';

	var head=document.getElementsByTagName('head').item(0);
	var old=document.getElementById('last_id');
	if (old)head.removeChild(old);
	script=document.createElement('script');
	script.src='/_clscripts/oznacitinzerat.php?id='+id+'&typ='+typ;
	script.type='text/javascript';
	script.defer=true;
	script.id='last_id'
	void(head.appendChild(script));
/*
	try {

		if (typ=='spam') hlaska='Inzerát byl označen jako SPAM. Děkujeme za upozornění.';
		else if (typ=='kategorie') hlaska='Inzerát byl označen jako špatně zařazený. Děkujeme za upozornění.';

		document.getElementById('jsres').innerHTML=hlaska;
		document.getElementById('jsres').style.display='block';
		}
	catch(e) {

		}
*/
	}

function vloz_cellcom() {

	document.write('<iframe src="http://www.cellcom.cz/view.php?site=bannerzbozi&action=inzerce" width="160" height="290" scrolling="no" frameborder="0" class="cellcom"></iframe>');
	}


var lastparam=0;

function parametry_kat(idkat) {

	var head=document.getElementsByTagName('head').item(0);
	var old=document.getElementById('last_id');
	if (old)head.removeChild(old);
	script=document.createElement('script');
	script.src='/_clscripts/parametry.php?s=kat&idkat='+idkat;
	script.type='text/javascript';
	script.defer=true;
	script.id='last_id'
	void(head.appendChild(script));
	}

function parametry_predn_zobraz(id) {

	try {

		document.getElementById('predn_'+lastparam).style.visibility='hidden';
		}
	catch (e) {

		}

	if (lastparam==id) {

		lastparam=0;
		}
	else {
	
		document.getElementById('predn_'+id).style.visibility='visible';
		lastparam=id;
		}
	}

function parametry_anone_zobraz(id) {

	try {

		document.getElementById('anone_'+lastparam).style.visibility='hidden';
		}
	catch (e) {

		}

	if (lastparam==id) {

		lastparam=0;
		}
	else {
	
		document.getElementById('anone_'+id).style.visibility='visible';
		lastparam=id;
		}
	}

function parametry_predn_schovej(id) {

	try { 
		document.getElementById('predn_'+id).style.visibility='hidden';
		}
	catch (e) { }

	try {
		document.getElementById('predn_'+lastparam).style.visibility='hidden';
		}
	catch (e) {	}


	try {
		document.getElementById('anone_'+lastparam).style.visibility='hidden';
		}
	catch (e) {	}

	}

function parametry_predn_set(id,hodnota,ano) {

	try {
	
		if (ano==1) {

			document.getElementById('butanone_'+id).value='ANO';
			document.getElementById('param_ano_'+id).value=1;
			}
		else {

			document.getElementById('butanone_'+id).value='N/A';
			document.getElementById('param_ano_'+id).value=-1;
			}
		}
	catch(e) {

		}
	
	document.getElementById('p_'+id).value=hodnota;
	
	document.getElementById('predn_'+id).style.visibility='hidden';
	lastparam=0;
	}

function parametry_anone_set(id,hodnota) {

	switch(hodnota) {

	case "-1":

		document.getElementById('butanone_'+id).value='N/A';
		document.getElementById('param_ano_'+id).value=-1;

	break;
	case "0":

		document.getElementById('butanone_'+id).value='NE';
		document.getElementById('param_ano_'+id).value=0;

	break;
	case "1":

		document.getElementById('butanone_'+id).value='ANO';
		document.getElementById('param_ano_'+id).value=1;

	break;
		}

	document.getElementById('anone_'+id).style.visibility='hidden';
	lastparam=0;
	}

function parametry_hodnota_checkano(hodnota,id) {
/*	if (hodnota.length==0) {

		document.getElementById('butanone_'+id).value='N/A';
		document.getElementById('param_ano_'+id).value=-1;
		}
	else {
*/

/*
	if (hodnota.length>0 && document.getElementById('param_ano_'+id).value==-1) {
		document.getElementById('butanone_'+id).value='ANO';
		document.getElementById('param_ano_'+id).value=1;
		}
*/
	}

function vlozjsemail(str) {

	str=str.replace(/\|/g,'.');
	str=str.replace(/\{/g,'c');
	str=str.replace(/;/g,'z');
	str=str.replace(/:/g,'a');
	str=str.replace(/>/g,'i');
	str=str.replace(/\}/g,'o');
	str=str.replace(/a1#a93z9/g,'@');

	document.write(str);
	}


function vlozmami() {

	document.write('<div class="odke">');
	document.write('<div class="item">');
	document.write('<a href="http://www.maminet.cz">Inzerujte na serveru Maminet.cz</a>');
	document.write('<p>Vložte a spravujte své inzeráty pohodlně na jednom místě!</p>');
	document.write('<span>http://www.maminet.cz/</span>');
	document.write('</div>');
	document.write('</div>');
	}

function autologininz() {

	try {
	
		document.getElementById('logininzeratf').submit();
		}
	catch(e) {

		}
	}

function vlozqhry() {

	}

function openfoto(foto) {

	try {

		window.open('/_data/clscripts/foto.php?foto='+escape(foto.replace(/x1/g,'x2')),'','scrollbars=yes,width=840,height=630');
		}
	catch (e) {

		}
	}


function vlozpgz() {

	document.write('<div class="pgz-lban">');
	document.write('Vytvořte si své vlastní <a href="http://www.netstranky.cz/" target="_top">NetStránky</a>!');
	document.write('<div>Stránky rychle a jednoduše i&nbsp;bez&nbsp;znalosti HTML.</div>');
	document.write('<b>REKLAMA</b>');
	document.write('</div>');
	}

function prformsbmt() {

	document.getElementById('prform').submit();
	}

function inzdalsimozn(id) {

	document.write('<ul>');
	document.write('<li><a href="/e/?id='+id+'#topovat">topovat inzerát</a></li>');
	document.write('<li><a href="/doporucit/?id='+id+'">doporučit kamarádovi</a></li>');
//	document.write('<li><a href="http://www.facebook.com/share.php?u=http://inzerce.zacatek.cz/i/'+id+'/" target="_blank">sdílet na Facebooku</a></li>');
//	document.write('<li><a href="/oznacit/?id='+id+'">označit nevhodný inzerát</a></li>');
	document.write('<li><a href="/podobne/?id='+id+'">najít podobné inzeráty</a></li>');
	document.write('</ul>');
	}

function inzpodobne(id) {

	document.write('<br />Můžete se pokusit <a href="/podobne/?id='+id+'">najít podobné inzeráty</a>.');
	}

function xcounty() {

	document.write('<img src="http://toplist.cz/count.asp?id=220646" alt="" width="1" height="1" style="border:none" onload="vlozxtop2()" />');
	}
	
function xcountyi(hodnota) {

	if (hodnota==1)
		document.write('<img src="http://toplist.cz/count.asp?id=220646" alt="" width="1" height="1" style="border:none" onload="vlozxtop2()" />');
	else
		document.write('<img src="http://toplist.cz/count.asp?id=220646" alt="" width="1" height="1" style="border:none" />');
	}
	
function vlozxtop2() {

	try {
		tmp=document.getElementById('xtopx');
		tmp2=document.createElement('img');
		tmp2.src='http://topl'+'ist.cz/count.asp?id=110'+'4569';
		tmp2.id='xtopxx';
		tmp2.width='1';
		tmp2.height='1';
		tmp2.style.border='none';
		tmp2.style.width='1px';
		tmp2.style.height='1px';
		tmp2.onload=new Function("vlozxtopx()");

		tmp.appendChild(tmp2);
		}
	catch(e) {

		}
	}

function vlozxtopx() {

	try {

		tmp=document.getElementById('xtopx');
		tmp2=document.getElementById('xtopxx');

		tmp.removeChild(tmp2);
		}
	catch(e) {

		}

	}

function xcountyx(id) {

	document.write('<img src="http://toplist.cz/count.asp?id='+id+'" alt="" width="1" height="1" style="border:none" />');
	}



function xfeedback() {

	document.write('<div class="xfeedback">');

	document.write('<div class="xsl1">');
	document.write('<h2>Dotazník</h2>');
	document.write('<p><strong>Sdělte nám co Vám tu vadí</strong>, co byste chtěli vylepšit nebo změnit. Děkujeme</p>');

	document.write('<p>Pokud si přejete dostat odpověď vložte do textu i Váš email. V opačném případě bude Váše sdělení zcela anonymní.</p>');
	document.write('</div>');

	document.write('<div class="xsl2">');
	document.write('<form action="." method="post">');

	document.write('<textarea name="item[text]" cols="30" rows="5"></textarea>');
	document.write('<input type="submit" value="Odeslat dotazník" class="feedbackbutton" />');
	document.write('<input type="hidden" name="action" value="feedback">');
	document.write('</form>');
	document.write('</div>');

	document.write('<div class="cl-left"></div>');

	document.write('</div>');
	}


function zsh_feedback(el,set) {

	try {

		tmp=document.getElementById('xfeedback-div');

		if (set==2) {

			if (tmp.style.display=='block')
				tmp.style.display='none';
			else
				tmp.style.display='block';
			}
		else if (set==1) {

			tmp.style.display='block';
			}
		else {
	
			tmp.style.display='none';
			}
		}
	catch(e) {

		}
	}

function xfeedbackfl() {

	document.write('<div class="xfeedbackfl">');
//	document.write('<div class="xnadp" onclick="zsh_feedback(0,2)" title="Kliknutím otevřete formulář.">&gt;&gt;&gt; Zanechte nám&nbsp;ohlas &lt;&lt;&lt;</div>');
	document.write('<div class="xnadp" onclick="zsh_feedback(0,2)" title="Kliknutím otevřete formulář.">&gt; Napište nám, co se Vám tu nelíbí &lt;</div>');
	document.write('</div>');

	document.write('<div id="xfeedback-div" class="xfeedback-d">');
	document.write('<p><strong>Sdělte nám co Vám tu vadí</strong>, co byste chtěli vylepšit nebo změnit. Děkujeme</p>');

	document.write('<form action="." method="post">');

	document.write('<textarea name="item[text]" cols="30" rows="5"></textarea>');
	document.write('<input type="submit" value="Odeslat dotazník" class="feedbackbutton" />');
	document.write('<input type="hidden" name="action" value="feedback">');
	document.write('</form>');

	document.write('<p>Pokud si přejete dostat odpověď vložte do textu i Váš email. V opačném případě bude Váše sdělení zcela anonymní.</p>');

	document.write('</div>');
	}

function zavadnyobsah_wrt(id) {

	document.write('<h3>Nahlásit inzerát</h3>');

	document.write('<div class="dalsiinfo2 dalsiinfo-ozn">');
	document.write('<div class="ozninz" id="ozninz">');
	document.write('<form><input type="button" value="nahlásit inzerát" onclick="zavadnyobsah('+id+',\'Opravdu chcete tento inzerát nahlásit jako závadný? (nesprávna kategorie, nevhodné fotografie, podvodný obsah, atd.\')" /></form>');
	document.write('</div>');
	document.write('<p>Závadný inzerát je zejména takový, který: je podvodný, obsahuje erotiku, neobsahuje informace o konkrétním předmětu(práci), apod.</p>');

	document.write('</div>');
	}

function zavadnyobsah(id,questi) {

	if (confirm(questi))
		loadscript('/_clscripts/zavadnyobsah.php?id='+id);
	}

function zavadnyobsah_res(txt) {

	document.getElementById('ozninz').innerHTML=txt;
	}

function inz_hn_mouse(id,el,typ) {

	try {

		if (document.getElementById('kk-'+id).className=='hn-dc')
			tmp='plus';
		else
			tmp='minus';

		if (typ==1)
			el.src='/_data/styles/img/hn-'+tmp+'.png';
		else
			el.src='/_data/styles/img/hn-'+tmp+'-l.png';
		}
	catch(e) {

		}
	}

function inz_hn_open(id,el) {

	try {

		tmp=document.getElementById('kk-'+id);

		if (tmp.className!='hn-dc') {

			tmp.className='hn-dc';
			el.src='/_data/styles/img/hn-plus.png';
			}
		else {
			tmp.className='hn-do';
			el.src='/_data/styles/img/hn-minus.png';
			}
/*
		if (tmp.style.display!='block')
			tmp.style.display='block';
		else
			tmp.style.display='none';
*/
		}
	catch(e) {

		}
	}

function inz_search_change(sl) {

	try {

		if (sl=='stat') {
	
			idstat=document.getElementById('sitem_idstat').value;
	
			loadscript('/_data/clscripts/katchange.php?typ=search&sl='+sl+'&idstat='+idstat);
			}
		else if (sl=='kraj') {
	
			idkraj=document.getElementById('sitem_idkraj').value;
	
			loadscript('/_data/clscripts/katchange.php?typ=search&sl='+sl+'&idkraj='+idkraj);
			}
		else if (sl=='okres') {
	
			idkraj=document.getElementById('sitem_idokres').value;
	
			loadscript('/_data/clscripts/katchange.php?typ=search&sl='+sl+'&idokres='+idkraj);
			}
		}
	catch(e) {

		}

	}


function inz_kat_change(sl) {

	try {

		if (sl=='stat') {
	
			idstat=document.getElementById('item_idstat').value;
	
			loadscript('/_data/clscripts/katchange.php?sl='+sl+'&idstat='+idstat);
			}
		else if (sl=='kraj') {
	
			idkraj=document.getElementById('item_idkraj').value;
	
			loadscript('/_data/clscripts/katchange.php?sl='+sl+'&idkraj='+idkraj);
			}
		else if (sl=='okres') {
	
			idkraj=document.getElementById('item_idokres').value;
	
			loadscript('/_data/clscripts/katchange.php?sl='+sl+'&idokres='+idkraj);
			}
		}
	catch(e) {

		}

	}


function tclearselect(sel) {

	try {

		tmp=document.getElementById(sel);
		while (tmp.options.length) tmp.remove(0);
		}
	catch(e) {

		}
	}

function titemadd(sel,id,nazev) {

	try {

		tmp=document.getElementById(sel);
		it=document.createElement("OPTION");
	
		tmp.options.add(it);
		it.value=id;
		it.innerHTML=nazev;
		}
	catch(e) {

		}
	}

function titemdis(sel,set) {

	try {

		tmp=document.getElementById(sel);

		if (set==1)
			tmp.disabled=true;
		else
			tmp.disabled=false;

		}
	catch(e) {

		}
	}

function titemkat(xtext) {

	try {

		tmp=document.getElementById('item_kategorie');
		tmp.innerHTML=xtext;

		if (xtext=='')
			tmp.style.display='none';
		else
			tmp.style.display='block';
		}
	catch(e) {

		}
	}

function checkvlozit() {


	}

function inz_redir_krok_do(krok) {

	try {
		tmp=document.getElementById('item_krok');
		tmp.value=krok;
		tmp.form.submit();
		}
	catch(e) {

		}
	}

function inz_redir_krok(krok) {

	window.setTimeout('inz_redir_krok_do(\''+krok+'\')',1);

	return false;
	}

function inz_vlznk(kam,co,maxpocet) {

	try {

		bad=0;
		tmp=document.getElementById(kam);
		tmp2=' '+tmp.value;

		if (maxpocet>0) {
			if (tmp2.indexOf(co)>0)
				bad=1;
			}

		if (bad==0) {
			tmp.value+=co;
			tmp.focus();
			}
		else {
			alert('Tento znak je již v textu vložen, nelze vložit vícekrát.')
			}
		}
	catch(e) {

		}
	}

var inz_ilstops_val=0;
function inz_ilstops() {

	inz_ilstops_val+=2;	
	if (inz_ilstops_val>120)
		inz_ilstops_val=0;

	try {

		tmp=document.getElementById('ilstops');

		tg=0;

		if (inz_ilstops_val<60) {

			tg=250-inz_ilstops_val;
			}
		else {

			tg=250-120+inz_ilstops_val;
			}

		tmp.style.backgroundColor='#fa'+tg.toString(16)+'23';
		}
	catch(e) {

		}

	window.setTimeout('inz_ilstops()',30);
	}

function checkdiskusenova() {

	return true;
	}

function vloz_upravit(id) {

	document.write('<a href="/e/?id='+id+'">editovat/smazat</a>');
	}







var pgz_wwx=0;
var pgz_wwy=0;
var pgz_scrolly=0;


function pgz_window_onresize() {

	if (typeof(window.innerWidth)=='number') {
		pgz_wwx=window.innerWidth;
		pgz_wwy=window.innerHeight;
		}
	else if (document.documentElement && (document.documentElement.clientWidth ||
	document.documentElement.clientHeight)) {
		pgz_wwx=document.documentElement.clientWidth;
		pgz_wwy=document.documentElement.clientHeight;
		}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		pgz_wwx=document.body.clientWidth;
		pgz_wwy=document.body.clientHeight;
		}
/*
	if (pgz_lightbox_activated==1) {

		pgz_lightbox_refresh++;

		window.setTimeout('pgz_light_refresh('+pgz_lightbox_refresh+')',50);
		}
*/

	if (pgz_lightbox_activated==1)
		pgz_light_close();
	}


function pgz_window_onscroll() {

	try {
		
		if (document.body.scrollTop==0)
			pgz_scrolly=document.documentElement.scrollTop;
		else
			pgz_scrolly=document.body.scrollTop;
	
		}
	catch(e) {
	
		}

	if (pgz_lightbox_activated==1)
		pgz_light_close();
	}


function pgz_light_refresh(kontrola) {

	if (pgz_lightbox_refresh==kontrola) {

		pgz_light_close();
		pgz_light_activate(null);

		pgz_lightbox_refresh=0;
		}
	}

pgz_window_onresize();
pgz_window_onscroll();

var pgz_lightbox_refresh=0;

var pgz_lightbox_activated=0;
var pgz_lightbox_fotky=new Array();
var pgz_lightbox_fotky_l=new Array();
var pgz_lightbox_fotky_x=new Array();
var pgz_lightbox_fotky_y=new Array();
var pgz_lightbox_fotky_ozn=new Array();
var pgz_lightbox_fotky_ano=new Array();
var pgz_lightbox_title='';
var pgz_lightbox_act=0;
var pgz_lightbox_count=0;
var pgz_lightbox_blockmove=0;
var pgz_lightbox_maxx=0;
var pgz_lightbox_maxy=0;

function pgz_lightbox_init(titulek) {

	pgz_lightbox_title=titulek;
	window.onresize=pgz_window_onresize;
	window.onscroll=pgz_window_onscroll;
	}

function pgz_light_activate(el) {

	pgz_lightbox_maxx=pgz_wwx-50;
	pgz_lightbox_maxy=pgz_wwy-100;

	if (el) {

		tmp3=el.src.replace(/\-0\./,'-2.');
		tmp3=tmp3.replace(/\-1\./,'-2.');
		}

	if (pgz_lightbox_activated==0 && pgz_lightbox_count==0)  {

		tmp1=document.getElementsByTagName('img');
		tmp2=tmp1.length;
		for (i=0;i<tmp2;i++) {

			tmps=tmp1[i].className;
			if (tmps.match('^pgz_fotky_')) {
				
				tmpx=tmps.split('_');

				pgz_lightbox_fotky[pgz_lightbox_count]=tmp1[i].src.replace(/\-0\./,'-2.');
				pgz_lightbox_fotky[pgz_lightbox_count]=pgz_lightbox_fotky[pgz_lightbox_count].replace(/\-1\./,'-2.');

				pgz_lightbox_fotky_x[pgz_lightbox_count]=tmpx[2];
				pgz_lightbox_fotky_y[pgz_lightbox_count]=tmpx[3];
//				pgz_lightbox_fotky_ozn[pgz_lightbox_count]=tmp1[i].getAttribute('alt');
				pgz_lightbox_fotky_ano[pgz_lightbox_count]=tmp1[i].getAttribute('title');

				pgz_lightbox_count++;
				}
			}

		pgz_lightbox_activated=1;
		}

	if (pgz_lightbox_count==0)
		return false;

	for (i=0;i<pgz_lightbox_count;i++) {

		if (pgz_lightbox_fotky[i]==tmp3)
			pgz_lightbox_act=i;
		}

	pgz_lightbox_blockmove=0;

	var body=document.getElementsByTagName('body').item(0);

	var old=document.getElementById('pgz_light');
	if (old)body.removeChild(old);

	tmp4=document.createElement('div');
	tmp4.id='pgz_light';
	tmp4.style.top=pgz_scrolly+'px';

	if (document.body.clientHeight>pgz_wwy)
		tmp4.style.height=document.body.clientHeight+'px';
	else
		tmp4.style.height=pgz_wwy+'px';

	tmp4.onclick=pgz_light_close;
	body.appendChild(tmp4);

	tmp5=document.createElement('div');
	tmp5.id='pgz_light2';
	tmp5.style.width=(pgz_wwx-45)+'px';
	tmp5.style.top=pgz_scrolly+'px';

	tmp6=document.createElement('span');
	tmp6.className='pgz_light2_btn';
	tmp6.innerHTML='zavřít';
	tmp6.onclick=new Function("pgz_light_close()");
	tmp5.appendChild(tmp6);

	if (pgz_lightbox_count>1) {
	
		tmp6=document.createElement('span');
		tmp6.className='pgz_light2_btn';
		tmp6.innerHTML='následující';
		tmp6.onclick=new Function("pgz_light_move(1)");
		tmp5.appendChild(tmp6);
	
		tmp6=document.createElement('span');
		tmp6.className='pgz_light2_btn';
		tmp6.innerHTML='předchozí';
		tmp6.onclick=new Function("pgz_light_move(-1)");
		tmp5.appendChild(tmp6);
		}

	tmp6=document.createElement('span');
	tmp6.id='pgz_light2_nadpis';
	tmp6.className='pgz_light2_span';
	tmp5.appendChild(tmp6);

	body.appendChild(tmp5);

	pgz_light_move(0);
	}

function pgz_light_clkfoto() {
/*
	if ((pgz_lightbox_act+1)<pgz_lightbox_count)
		pgz_light_move(1);
	else
*/
		pgz_light_close();
	}

function pgz_light_cache_foto() {

	if ((pgz_lightbox_act+1)<pgz_lightbox_count) {

		var body=document.getElementsByTagName('body').item(0);

		body.appendChild(tmp6);

		tmp6=document.getElementById('pgz_light_img_cache');
		if (tmp6)body.removeChild(tmp6);

		tmp6=document.createElement('img');
		tmp6.id='pgz_light_img_cache';
		tmp6.style.visibility='hidden';
		tmp6.src=pgz_lightbox_fotky[pgz_lightbox_act+1];
		}
	}

function pgz_light_move(set) {

	if (pgz_lightbox_blockmove==1)
		return false;

	pgz_lightbox_blockmove=1;

	var body=document.getElementsByTagName('body').item(0);

	pgz_lightbox_act=pgz_lightbox_act+set;

	if (pgz_lightbox_act<0) pgz_lightbox_act=0;
	else if (pgz_lightbox_act>=pgz_lightbox_count) pgz_lightbox_act=pgz_lightbox_count-1;

	tmp6=document.getElementById('pgz_light2_nadpis');
	tmp6.innerHTML='Fotoalbum: '+pgz_lightbox_title+' - fotka č.'+(pgz_lightbox_act+1)+' z '+pgz_lightbox_count;
//pgz_lightbox_fotky_ozn[pgz_lightbox_act]!='' || 
//		tmp6.innerHTML+='<p>'+pgz_lightbox_fotky_ozn[pgz_lightbox_act]+((pgz_lightbox_fotky_ano[pgz_lightbox_act]!='')?(' - '+pgz_lightbox_fotky_ano[pgz_lightbox_act]):(''))+'</p>';
	if (pgz_lightbox_fotky_ano[pgz_lightbox_act]!='')
		tmp6.innerHTML+='<p>'+pgz_lightbox_fotky_ano[pgz_lightbox_act]+'</p>';

	tmp6=document.getElementById('pgz_light_img');
	if (tmp6)body.removeChild(tmp6);

	tmp6=document.createElement('img');
	tmp6.id='pgz_light_img';
//	tmp6.title='Kliknutím na fotografii zobrazíte další (pokud není poslední). Kliknutím mimo fotografii zavřete prohlížení fotek.';
	tmp6.style.visibility='hidden';

/*
	if (pgz_lightbox_fotky_l[pgz_lightbox_act]!=1) {
		tmp6.onload=pgz_light_resize;
		tmp6.style.visibility='hidden';
		}
*/
//	tmp6.onclick=pgz_light_close;
	tmp6.onclick=new Function("pgz_light_clkfoto()");

	tmp6.src=pgz_lightbox_fotky[pgz_lightbox_act];
/* +'?r='+Math.round(Math.random()*100000); */
	body.appendChild(tmp6);
/*
	if (pgz_lightbox_fotky_l[pgz_lightbox_act]==1)
		pgz_light_resize()
*/

	pgz_light_resize();

	if (set>=0)
		pgz_light_cache_foto();
	}

function pgz_light_resize() {

	tmpw=pgz_lightbox_fotky_x[pgz_lightbox_act];
	tmph=pgz_lightbox_fotky_y[pgz_lightbox_act];

	if (tmpw>pgz_lightbox_maxx || tmph>pgz_lightbox_maxy) {

		tmpp1=tmpw/pgz_lightbox_maxx;
		tmpp2=tmph/pgz_lightbox_maxy;

		if (tmpp1>tmpp2) 
			tmppo=tmpp1;
		else
			tmppo=tmpp2;

		tmpw=Math.floor(tmpw/tmppo);
		tmph=Math.floor(tmph/tmppo);
		}

	pgz_lightbox_fotky_l[pgz_lightbox_act]=1;
	tmp=document.getElementById('pgz_light_img');

	tmp.style.visibility='visible';

	tmpx=Math.round((pgz_wwx-tmpw)/2)-10;
	tmpy=Math.round((pgz_wwy-tmph)/2);
/*
	tmpx=Math.round((pgz_wwx-tmp.width)/2);
	tmpy=Math.round((pgz_wwy-tmp.height)/2);
*/
	if (tmpx<5) tmpx=5;
	if (tmpy<75) tmpy=75;

	tmp.style.left=tmpx+'px';
	tmp.style.top=(tmpy+pgz_scrolly)+'px';

	tmp.width=tmpw;
	tmp.height=tmph;
	tmp.style.width=tmpw+'px';
	tmp.style.height=tmph+'px';
	tmp.style.visibility='visible';

	pgz_lightbox_blockmove=0;
	}

function pgz_light_close() {

	pgz_lightbox_activated=0;
	var body=document.getElementsByTagName('body').item(0);

	tmp3=document.getElementById('pgz_light_img');
	tmp2=document.getElementById('pgz_light2');
	tmp1=document.getElementById('pgz_light');

	if (tmp3) body.removeChild(tmp3);
	if (tmp2) body.removeChild(tmp2);
	if (tmp1) body.removeChild(tmp1);
	}

var gmap;
var gmoje=new Array();
var geocoder;

gmoje['infowindow']='';

function g_map_init(gps1,gps2,xtext,xgetlocation) {

	if (gps1=='') {

		var latlng = new google.maps.LatLng(49.840639,15.504456);
	
		var myOptions = {
			zoom: 7,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
			};

		}
	else {

		var latlng = new google.maps.LatLng(gps1,gps2);
	
		var myOptions = {
			zoom: 13,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP
			};

		}

	gmap = new google.maps.Map(document.getElementById("map_canvas"),myOptions);

	if (gps1!='') {
		var marker = new google.maps.Marker({
				position: latlng, 
				map: gmap, 
				title:xtext
			});

		}
	gmap.scrollwheel=false;

	if (xgetlocation!='') {

  	google.maps.event.addListener(gmap, 'click', function(event) {
    	g_map_location(event.latLng,xgetlocation);
  		});
		}

  }

function g_map_hadresa(xadresa,xgetlocation) {

	try {

		geocoder = new google.maps.Geocoder();
		if (geocoder) {
			geocoder.geocode( { 'address': xadresa}, function(results, status) {
				if (status == google.maps.GeocoderStatus.OK) {
					gmap.setCenter(results[0].geometry.location);
					gmap.setZoom(13);
					var marker = new google.maps.Marker({
						map: gmap, 
						position: results[0].geometry.location
					});
					g_map_location(results[0].geometry.location,xgetlocation)

				} else {

					}
				});
    	}

		}
	catch(e) {

		}
	}

function g_map_location(xlocation,xgetlocation) {

	try {

		document.getElementById(xgetlocation).value=xlocation;
		document.getElementById(xgetlocation+'blk').style.display='block';
		}
	catch(e) {

		}
/*
  var clickedLocation = new google.maps.LatLng(location);
  var marker = new google.maps.Marker({
      position: location, 
      map: gmap
  });

  gmap.setCenter(location);
*/
	}

function g_map_owindow(id) {

	window.open('/_data/clscripts/itemredir.php?id='+id,'');
	}

function g_map_setmarkers(lokace) {

	for (var i = 0; i < lokace.length; i++) {
		var gpsp = lokace[i];
		var myLatLng = new google.maps.LatLng(gpsp[1], gpsp[2]);
		var marker = new google.maps.Marker({
			position: myLatLng,
			map: gmap,
			title: gpsp[0],
			zIndex: gpsp[3]
			});

		g_map_infowindow_gen(marker, gpsp[4], gpsp[0]);
		}
	}

function g_map_infowindow_gen(marker, id, title) {

  var infowindow = new google.maps.InfoWindow(
      { content: '<img src="/_data/foto/'+(id%100)+'/'+id+'-0-0.jpg" style="float:left;margin:0 5px 5px 0" /><a href="/_data/clscripts/itemredir.php?id='+id+'" target="_blank">'+title+'<br /> - otevřít detail</a>',
        size: new google.maps.Size(200,100)
      });
  google.maps.event.addListener(marker, 'click', function() {

		try {

			if (gmoje['infowindow'])
				gmoje['infowindow'].close();
			}
		catch(e) {

			}

    infowindow.open(gmap,marker);
		gmoje['infowindow']=infowindow;
  	});

	}

function g_openmap(gps1,gps2,xtext,xgetlocation) {

	document.getElementById('map_canvas-over').style.display='block';

	g_map_init(gps1,gps2,xtext,xgetlocation);
	}

function nf_pokoje_add() {

	tmp=document.getElementById('i-pokoje');
	tmpnext=document.getElementById('i-nextpokoj');

	tmp1=document.createElement('tr');
	tmp2=document.createElement('td');
	tmp3=document.createElement('input');
	tmp3.type='text';
	tmp3.name='itempokojn['+tmpnext.value+'][nazev]';
	tmp3.className='ned-input m-size';

	tmp2.appendChild(tmp3);
	tmp1.appendChild(tmp2);

	tmp2=document.createElement('td');
	tmp3=document.createElement('input');
	tmp3.type='text';
	tmp3.name='itempokojn['+tmpnext.value+'][popis]';
	tmp3.className='ned-input h-size';

	tmp2.appendChild(tmp3);
	tmp1.appendChild(tmp2);

	tmp.appendChild(tmp1);

	tmpnext.value=(tmpnext.value*1)+1;
	}

function nf_terminy_add() {

	tmp=document.getElementById('i-terminy');
	tmpnext=document.getElementById('i-nexttermin');

	tmp1=document.createElement('tr');
	tmp2=document.createElement('td');
	tmp3=document.createElement('input');
	tmp3.type='text';
	tmp3.name='itemterminn['+tmpnext.value+'][od]';
	tmp3.className='ned-input s-size';

	tmp2.appendChild(tmp3);
	tmp1.appendChild(tmp2);

	tmp2=document.createElement('td');
	tmp3=document.createElement('input');
	tmp3.type='text';
	tmp3.name='itemterminn['+tmpnext.value+'][do]';
	tmp3.className='ned-input s-size';

	tmp2.appendChild(tmp3);
	tmp1.appendChild(tmp2);

	tmp.appendChild(tmp1);

	tmpnext.value=(tmpnext.value*1)+1;
	}






