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

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 setAttr(elem,klic,hodnota) {

	try {
	
		if (IE) {
	
			switch(klic) {
				case "class":elem.className=hodnota;break;
				case "id":elem.id=hodnota;break;
				case "title":elem.title=hodnota;break;
				case "href":elem.href=hodnota;break;
				case "nohref":elem.nohref=hodnota;break;
				case "target":elem.target=hodnota;break;
				case "onclick":elem.onclick=new Function(hodnota);break;
				case "onmousedown":elem.onmousedown=new Function(hodnota);break;
				case "onmouseover":elem.onmouseover=new Function(hodnota);break;
				case "onmouseout":elem.onmouseout=new Function(hodnota);break;
				case "onmousedown":elem.onmousedown=new Function(hodnota);break;
				case "onkeydown":elem.onkeydown=new Function(hodnota);break;
				case "onkeypress":elem.onkeypress=new Function(hodnota);break;
				case "onfocus":elem.onfocus=new Function(hodnota);break;
				case "onblur":elem.onblur=new Function(hodnota);break;
				}
			}
		else {
	
			if (klic=='class')
				elem.className=hodnota;
			else
				elem.setAttribute(klic,hodnota);
			}
		}
	catch(e) { }

	}

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


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="http://sinz.zacatek.cz/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(', <a href="/e/?id='+id+'#topovat">topovat inzerát</a>');
	document.write(', <a href="/doporucit/?id='+id+'">doporučit kamarádovi</a>');
//	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(', <a href="/podobne/?id='+id+'">najít podobné inzeráty</a>');
//	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() {

	vlozxtop2();
	}
	
function xcountyi(hodnota) {

	if (hodnota==1)
		vlozxtop2();
	}
	
function vlozxtop2() {

	try {

		tmp=document.getElementById('xtopx');
		tmp2=document.createElement('img');
		tmp2.src='http://topl'+'ist.cz/count.asp?id='+'11'+'89220';
		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 &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='http://sinz.zacatek.cz/styles/img/hn-'+tmp+'.png';
		else
			el.src='http://sinz.zacatek.cz/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='http://sinz.zacatek.cz/styles/img/hn-plus.png';
			}
		else {
			tmp.className='hn-do';
			el.src='http://sinz.zacatek.cz/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=0;

	try {

		tmp=document.getElementById('item_kat_0');

		if (tmp.value>0) {

			}
		else {
			ok=2;
			}
		}
	catch(e) {

		}

	try {

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

		}
	catch(e) {

		}

	if (ok==1) {

		window.setTimeout("alert('Vyberte typ inzerátu.')",10);

		window.scrollTo(0,0);
		document.getElementById('item_x_blk_1').style.backgroundColor='#F06262';
		}
	else if (ok==2) {

		window.setTimeout("alert('Vyberte vhodnou kategorii inzerátu.')",10);

		window.scrollTo(0,0);
		document.getElementById('item_x_blk_2').style.backgroundColor='#F06262';
		}

	if (ok>0) return false;
	return true;
	}

function inz_redir_krok_do(krok) {

	try {

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

		}
	}

function inz_redir_krok_do_focus(krok,fid) {

	try {

		tmp=document.getElementById('item_krok');
		tmp.value=krok;

		tmp=document.getElementById('item_focus');
		tmp.value=fid;

		tmp.form.submit();
		}
	catch(e) {

		}
	}

function inz_redir_krok(krok) {

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

	return false;
	}

function inz_redir_krok_focus(krok,fid) {

	window.setTimeout('inz_redir_krok_do_focus('+krok+',\''+fid+'\')',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>100)
		inz_ilstops_val=0;

	try {

		tmp=document.getElementById('ilstops');

		tg=0;

		if (inz_ilstops_val<50) {

			tg=250-inz_ilstops_val;
			}
		else {

			tg=250-100+inz_ilstops_val;
			}

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

		}

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

function checkdiskusenova() {

	return true;
	}

function vloz_upravit(id) {

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

function iedinza(id) {

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

function zp_offtopx(obj) {

	var otop=0;
	if (obj.offsetParent) {
		
		otop=obj.offsetLeft;
		while (obj=obj.offsetParent)
			otop+=obj.offsetLeft;
		}
	return otop;
	}

function zp_offtopy(obj) {

	var otop=0;
	if (obj.offsetParent) {
		
		otop=obj.offsetTop;
		while (obj=obj.offsetParent)
			otop+=obj.offsetTop;
		}
	return otop;
	}


function i_u_infow(el,txt,txtbad) {
/*
	try {

		if (txt=='')
			document.getElementById('w-nadpis').style.display='block';
		else
			document.getElementById('w-nadpis').style.display='none';
		}
	catch(e) {

		}
*/
	try {

		tmp=document.getElementById('ihelper');
		if (txt!='') {
	
			tmp.style.display='block';
			tmp.innerHTML='';
	/*
			if (txtbad!='')
				tmp.innerHTML+='<span>'+txtbad+'</span>';
	*/
			tmp.innerHTML+='<p>'+txt+'</p>';
	
			tmpw=el.parentNode.offsetWidth;
//			if (tmpw>490) tmpw=490;

			tmpx=zp_offtopx(el)+tmpw;
			tmpwx=(910-tmpx);

			if (tmpwx<200) {

				tmpwx=200;
				tmpx=910-tmpwx;
				}

			tmp.style.width=tmpwx+'px';
			tmp.style.top=zp_offtopy(el)+'px';
			tmp.style.left=tmpx+'px';
			}
		else {
	
			tmp.style.display='none';
			}
		}
	catch(e) {

		}

	}

function inz_edit_focus_do(fid) {

	try {
		document.getElementById(fid).focus();
		}
	catch(e) {
		}
	}

function inz_edit_focus(fid) {

	window.setTimeout('inz_edit_focus_do(\''+fid+'\')',10);
	}

function vloz_ares(ico) {

	document.write(' <span class="aresx"><a href="http://wwwinfo.mfcr.cz/cgi-bin/ares/ares_es.cgi?jazyk=cz&obch_jm=&cestina=cestina&obec=&k_fu=&maxpoc=200&ulice=&cis_or=&cis_po=&setrid=ZADNE&pr_for=&nace=&nace_h=&xml=1&filtr=0&ico='+ico+'" target="_blank">informace o firmě (nové okno)</a></span>');
	}



function cansubmit() {

	if (!pom_cansubmit) return false;

	return true;
	}

function tvlozitpozn(pozn) {

	tmp=document.getElementById('vlozitpozn');

	tmp.innerHTML=pozn;
	if (pozn!='') 
		tmp.style.display='block';
	else
		tmp.style.display='none';

	}


var htrequest;
var ajax_search_counter=0;
var ajax_search_timer;

function load_htreq(url,targetfce) {

	if (window.XMLHttpRequest) {

		htrequest=new XMLHttpRequest();
		}
	else if (window.ActiveXObject) {
		try {
			htrequest=new ActiveXObject('Microsoft.XMLHTTP');
			}
		catch(e) {
			htrequest=new ActiveXObject('Msxml2.XMLHTTP');
			}
		}
	else {

		return false;
		}

	htrequest.open('GET',url,true);

	try {
		htrequest.overrideMimeType("text/html; charset=windows-1250");
		}
	catch(e) {

		}

	htrequest.onreadystatechange=targetfce;
	htrequest.send(null);

	return true;
	}

function ajax_search() {

	try {
		htrequest.abort();
		}
	catch(e) {
		}

	tmpover=document.getElementById('ajaxsearchblkover');
	tmp=document.getElementById('ajaxsearchblk');
	tmp2=document.getElementById('ajaxsearchblk2');
	tmp3=document.getElementById('ajaxsearchblk3');
	tmphelper=document.getElementById('ajaxsearchblk_helper');

	tmphelper.innerHTML='<span>ČEKEJTE PROSÍM</span><img src="http://sinz.zacatek.cz/img/wait.gif" width="132" height="132" alt="Prosím čekejte" />';
	
	tmphelper.style.width=tmp.offsetWidth+'px';
	tmphelper.style.height=tmpover.offsetHeight+'px';

	tmphelper.style.display='block';
	
	url='/_data/clscripts/ajaxsearch.php';
	url+='?kfield='+document.getElementById('kfield').value;
	url+='&qkat='+document.getElementById('qkat').value;
	url+='&ofield='+document.getElementById('ofield').value;
	url+='&qcod='+document.getElementById('qcod').value;
	url+='&qcdo='+document.getElementById('qcdo').value;
	url+='&typc='+document.getElementById('typc').value;
	url+='&q='+document.getElementById('q').value;

	load_htreq(url,ajax_search_res);
	} 

function ajax_search_res() {

	if (htrequest.readyState==4 && htrequest.status==200) {

		ajax_search_write();
		}
	else if (htrequest.readyState==4 && htrequest.status!=200) {
  
		}
	}


function ajax_search_write() {

	if (htrequest.responseText.length>0) {

		tmp=document.getElementById('ajaxsearchblk');
		tmp2=document.getElementById('ajaxsearchblk2');
		tmp3=document.getElementById('ajaxsearchblk3');
		tmphelper=document.getElementById('ajaxsearchblk_helper');

		tmp.innerHTML='';
		tmp2.innerHTML=htrequest.responseText;
		tmp3.innerHTML='';
		tmphelper.style.display='none';
		}
	}


function ajax_search_hard() {

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

function ajax_search_counter_do(counter) {

	if (ajax_search_counter==counter) {

		ajax_search();
		}
	} 

function ajax_search_delay() {

	try {
		window.clearTimeout(ajax_search_timer);
		}
	catch(e) {

		}

	ajax_search_counter++;
	ajax_search_timer=window.setTimeout('ajax_search_counter_do('+ajax_search_counter+')',500);
	} 


function xrban() {

	document.write('<div class="xrban">REKLAMA:<br /><a href="http://www.netstranky.cz" target="_blank"><img src="/_data/160x600.png" width="160" heght="600" /></a></div>');
	}




