
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" />');
	}

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_kat_change(sl) {

	try {

		tkat0=document.getElementById('item_kat_0');
		tkat1=document.getElementById('item_kat_1');
		tkat2=document.getElementById('item_kat_2');

		if (sl<2)
			tkat2=0;
		if (sl<1)
			tkat1=0;

		loadscript('/_clscripts/katchange.php?sl='+sl+'&kat0='+tkat0.value+'&kat1='+tkat1.value+'&kat2='+tkat2.value);
		}
	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() {

	ok=false;

	try {

		tmp=document.getElementById('item_kat_0');

		if (tmp.value>0) ok=true;
		}
	catch(e) {

		}

	try {

		if (!document.getElementById('i-typ-1').checked && !document.getElementById('i-typ-2').checked)
			ok=false;

		}
	catch(e) {

		}

	if (!ok)
		window.setTimeout("alert('Vyberte vhodnou kategorii a typ inzerátu.')",10);
	return ok;
	}

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);
	}






