function set_kraj(kraj,krajDiv){

	var krajeInputTmp	= document.getElementById('kraj_tmp');
	var krajeInput		= document.getElementById('kraj');
	var divId= document.getElementById(krajDiv);

	if(krajeInputTmp.value!=""){
		document.getElementById(krajeInputTmp.value+"_set").id=krajeInputTmp.value;
		krajeInput.value = '';
		krajeInputTmp.value='';
	}

	if(krajeInputTmp.value!=krajDiv && divId){
		divId.id = krajDiv+"_set";
		krajeInput.value=kraj;
		krajeInputTmp.value=krajDiv;
	}
}

function open_window(){
    window.open("http://www.abet.cz/images/iso.jpg","","toolbar=no location=no resizable=no scrollbars=no copyhistory=no menubar=no status=yes directories=no width=500 height=709");
}

function FullSearch(){
	document.forms["fullform"].submit();
}

function cz_search_submit(pk_obor){
	if(pk_obor){
		document.forms['cz_search']['search_input_cz'].value='';
	}
	document.forms['cz_search']['pk_obor'].value=pk_obor;
	document.forms['cz_search'].submit();
}

function change_namesimg(character){
	if(document.all[character].src.substring(document.all[character].src.length-6,document.all[character].src.length)=="re.gif"){
		document.all[character].src=document.all[character].lowsrc;
	} else {
		document.all[character].src="images/_kf/pismo/"+character+"_modre.gif";
	}
}

function change_pridatimg(pridat,what){
	if(what==1){
		document.all[pridat].src=document.all[pridat].lowsrc;
	}  else {
		document.all[pridat].src="lang/<?php echo $lang; ?>/images/tl_pridat.gif";
	}
}

function show_window(_source){
	window.open("/show_window.php?source="+_source,"","width=300 height=300 toolbar=no location=no resizable=no scrollbars=no copyhistory=no menubar=no status=no directories=no");

}

function change_view(which){
	switch(which){
		case "ft_eu":
			document.getElementById('ft_kf').style.display='none';
			document.getElementById('ft_zdr').style.display='none';
			document.getElementById('ft_inst').style.display='none';
			document.getElementById(which).style.display='block';
		break
		case "ft_kf":
			document.getElementById('ft_eu').style.display='none';
			document.getElementById('ft_zdr').style.display='none';
			document.getElementById('ft_inst').style.display='none';
			document.getElementById(which).style.display='block';
		break
		case "ft_zdr":
			document.getElementById('ft_kf').style.display='none';
			document.getElementById('ft_eu').style.display='none';
			document.getElementById('ft_inst').style.display='none';
			document.getElementById(which).style.display='block';

		break
		case "ft_inst":
			document.getElementById('ft_kf').style.display='none';
			document.getElementById('ft_eu').style.display='none';
			document.getElementById('ft_zdr').style.display='none';
			document.getElementById(which).style.display='block';
		break
	}
}

function showMore(what){
	if(what=="links"){
		if(HL = document.getElementById('hiddenLinks')){
			HL.style.display="block";
			document.getElementById('moreLinks').style.display="none";
		}
	} else {
		if(HA = document.getElementById('hiddenArticles')){
			HA.style.display="block";
			document.getElementById('moreArticles').style.display="none";
		}
	}
}
/*
function changeImg(section){
	image = document.getElementById('stred');
	switch(section){
		case "eu":
			image.src=i_eu.src;
		break
		case "kf":
			image.src=i_kf.src;
		break
		case "zdravotnictvi":
			image.src=i_zdravotnictvi.src;
		break
		case "burza":
			image.src=i_burza.src;
		break
		case "zajimavosti":
			image.src=i_zajimavosti.src;
		break
	}
}*/
/*
function searchIt(lang,modul){

	switch(modul){
		case "katalog-firem":
		case "zdravotnictvi":
			document.location="/"+lang+"/"+modul+"/?search_input="+document.forms["fullform"]["ft_input"].value+"&what=fulltext";
		break;

		case "eu-pro-vas":
			document.location="/"+lang+"/"+modul+"/?what=search&search_string="+document.forms["fullform"]["ft_input"].value+"";
		break;

		case "burza-poptavek-a-nabidek":
			document.location="/"+lang+"/"+modul+"/?search_string="+document.forms["fullform"]["ft_input"].value+"&typ=n";
		break;

		case "burza-poptavek-a-nabidek":
			document.location="/"+lang+"/"+modul+"/?search_string="+document.forms["fullform"]["ft_input"].value+"&typ=p";
		break;

		case "spolupracujici-instituce":
			document.location="/"+lang+"/eu-pro-vas/"+modul+"/?search_string="+document.forms["fullform"]["ft_input"].value;
		break;

		default:
			document.location="/"+lang+"/fulltext/?search_string="+document.forms["fullform"]["ft_input"].value+"&which=kf";
		break;
	}
}*/


function closeLayer(divElement){
	if(	document.getElementById(divElement).style.display != "none"){
//		showSelects();
		Effect.toggle(divElement,'appear');
	}
}

function showLayer(layer){

		lang = document.getElementById('langSitter').innerHTML;

		closeLayer("zdr"+lang+"TopMenu");
		closeLayer("si"+lang+"TopMenu");
		closeLayer("eu"+lang+"TopMenu");
		closeLayer("kf"+lang+"TopMenu");


	if(	document.getElementById(layer).style.display == "none"){
//		hideSelects();
		Effect.toggle(layer,'appear');
	}

}

function hideSelects(){
	selects = document.getElementsByTagName("select");
	for(i=0;i<selects.length;i++){
		selects[i].style.visibility="hidden";
	}
}

function showSelects(){
	selects = document.getElementsByTagName("select");
	for(i=0;i<selects.length;i++){
		selects[i].style.visibility="visible";
	}
}

function setSearchType(val,val2){
	document.getElementById('fulltextSelect').value = val;
//	document.getElementById('whereSearch').innerHTML = '<a id="whereSearchBut" href="javascript:void(0);" onclick="showLayer(\'whereSearchSelect\');"><img src="/images/s.gif" width="21" height="19" alt="" /></a>&nbsp;'+val2;
	document.getElementById('whereSearch').innerHTML = val2;

	frm = document.getElementById("searchForm");

	actionString = '/'+document.getElementById('searchLang').value+'/';
	modulString = document.getElementById('fulltextSelect').value;
	if(modulString == "fulltext"){
		frm.action = actionString;
	} else {
		frm.action = actionString+modulString+'/';
	}	
}

function setSearch(layer,title,link){
	if(link == 'undefined'){
		link = '';
	}
	document.getElementById('whereSearch').innerHTML = title;

	if(layer == "charSearch"){
		document.getElementById('oborSearch').style.display = "none";
		document.getElementById('whatSearch').style.display = "none";

	} else if(layer == "oborSearch"){

		document.location = link;

//		document.getElementById('charSearch').style.display = "none";
//		document.getElementById('whatSearch').style.display = "none";


	} else {
		document.getElementById('charSearch').style.display = "none";
		document.getElementById('oborSearch').style.display = "none";
	}



	document.getElementById(layer).style.display = "block";

}


function submitOnEnter(e){
	if(e == 13){
		frm = document.getElementById("searchForm");
		actionString = '/'+document.getElementById('searchLang').value+'/';
		modulString = document.getElementById('fulltextSelect').value;
		if(modulString == "fulltext"){
			frm.action = actionString;
		} else {
			frm.action = actionString+modulString+'/';
		}
		frm.submit();
	}
}

function setKraj(val){
	document.getElementById('kraj').value = val;
}

function setObor(val,id){
	document.getElementById('kraj').value = val;
	document.getElementById('obor').value = id;
}

function setRejstrikyType(type,val) {
	document.getElementById('rejstrikySearch').innerHTML = val;
	document.getElementById('rejstrikySearchType').value = type;
}

function searchOnEnter(e){
	if(e == 13){
		searchRejstriky();
	}
}

function searchRejstriky(){
	type = document.getElementById('rejstrikySearchType').value;
	searchString = document.getElementById('rejstrikySearchInput').value;

	switch(type){
		case "justice":
			searchLoc = 'http://www.justice.cz/xqw/xervlet/insl/index?sysinf.@typ=or&sysinf.@strana=searchResults&hledani.@typ=subjekt&hledani.format.typHledani=x*&hledani.podminka.subjekt='+searchString+'&Image1.x=7&Image1.y=4';
		break;
		case "ares":
			searchLoc = 'http://wwwinfo.mfcr.cz/ares/cgi-bin/ares/ares_es.cgi?jazyk=cz&xml=1&setrid=ZADNE&maxpoc=200&ico=&cestina=cestina&obch_jm='+searchString+'&id=0'; // 
		break;
	}


url = searchLoc+'&keepThis=true&TB_iframe=true&height=200&width=300';


//tb_show('Rejstříky', url, 0);

	msg=open(searchLoc,"rejstriky",'scrollbars=yes,resizable=yes,width=800,height=600');

}

