
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-heslo').value.length==0) {

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

	return true;
	}




function setfoto(foto,fx,fy) {

	try {

		var fid=document.getElementById('nfoto');

		fid.width=fx;
		fid.height=fy;
		fid.src='/_data/foto/'+foto+'x1.jpg';
		}
	catch (e) {

		}
	}

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) {

		}
	}


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 odkazopen(url) {

	try {

		window.open(url,'');
		}
	catch (e) {

		}
	}

function zmenokres(url,okres) {

	var tar='';

	if (okres!='') {

		tar=url+'-'+okres+'/';
		}
	else {

		tar=url;
		}

	location.href=tar;
	}










