function menu_over(element) {
	element.style.backgroundImage = 'url(./images/menu_bg_on.gif)'; 
}
function menu_out(element)  {
	element.style.backgroundImage = 'url(./images/menu_bg.gif)'; 
}
function submenu_over(element) {
	element.style.backgroundColor = '#858585'; 
}
function submenu_out(element)  {
	element.style.backgroundColor = '#696969'; 
}
function decision(message, url) {
	if(confirm(message)) location.href = url;
}
function showdiv(elementID) {
    var idc = "C" + elementID;
    var idn = "N" + elementID;
/*    var idi = "I" + elementID; */
	if (document.all.item(idc).style.display=="none") {
	    document.all.item(idc).style.display = "";
	    document.all.item(idn).innerHTML = 'Skrýt přílohy';
/*	    document.all.item(idi).src = '/images/minus.gif'; */
	} else {
	    document.all.item(idc).style.display = "none";
	    document.all.item(idn).innerHTML = 'Zobrazit přílohy';
/*	    document.all.item(idi).src = '/images/plus.gif'; */
	}
}
function Popup_Window(mypage,myname,w,h,scroll,pos) {
	if (pos=="random") {
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100; 
	}
	if (pos=="center") {
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100; 
	}
	else if ((pos!="center" && pos!="random") || pos==null) {
		LeftPosition=0;
		TopPosition=20; 
	}
	settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
	win=window.open(mypage,myname,settings);
	window.win.focus();
}

function odesli_podani (action) {
	
	if (action==1) {
		document.podani_4.akce.value='zalozit_nove_podani';
		document.podani_4.submit();
	}
	else if (action==2) {
		document.podani_3.akce.value='pridat_dokument';
		document.podani_3.submit();
	}
	else if (action==3) {
		document.podani_1.akce.value='edit_podani';
		document.podani_1.submit();
	}
	else if (action==4) {
		document.podani_2.akce.value='';
		document.podani_2.submit();
	}
	else if (action==5) {
		var message = 'Jsem si vědom, že odeslání tohoto podání je nevratné, uvidí jej rozhodce a druhá strana sporu.';
		if(confirm(message)) { 
			document.podani_2.akce.value='odeslat_podani';
			document.podani_2.submit();
		}
	}
	else if (action==6) {
		var message = 'Jsem si vědom, že tímto bude podání připuštěno do spisu.';
		if(confirm(message)) { 
			document.podani_pripustit.akce.value='provest';
			document.podani_pripustit.submit();
		}
	}
	else if (action==7) {
		var message = 'Jsem si vědom, že tímto nebude podání připuštěno do spisu.';
		if(confirm(message)) { 
			document.podani_pripustit.akce.value='nepripustit';
			document.podani_pripustit.submit();
		}
	}
}

function nacti_vzor (idEmail) {
	if (idEmail != "") {
		var vzor_nazev = document.getElementById('vzor_nazev_'+idEmail).value;
		var vzor_text = document.getElementById('vzor_text_'+idEmail).value;
		var vzor_typ = document.getElementById('vzor_typ_'+idEmail).value;

		document.getElementById('nazev').value = vzor_nazev;
		document.getElementById('text').value = vzor_text;
		document.getElementById('typ').value = vzor_typ;
	}
}
	
function update_popis() {
	var novy_soubor = document.getElementById('novy_soubor').value;
	for (i=0; i <= novy_soubor.length; i++) {
		if (novy_soubor.substring(i,i+1)=='\\') { var lom = i+1; }
		if (novy_soubor.substring(i,i+1)=='.') { var dot = i; }
	}
	document.getElementById('novy_soubor_popis').value = novy_soubor.substring(lom,dot);
}

function set_ic_rc_disabled(strana, poradi) {
	var values = new Array("ic", "rc", "birth");
	var radio_val = $("input[name='" + strana + "_ic_rc[" + poradi + "]']:checked").val();
	var strana_nazev = (strana=="zal" ? "zalobce" : "zalovany");

	var input_text = document.getElementById(strana_nazev + "_" + radio_val + "[" + poradi + "]");
	$(input_text).attr("disabled", false);
	$(input_text).css("backgroundColor", "#ffffff");

	$.each(values, function(index, value) {
		if (value != radio_val) {
			input_text = document.getElementById(strana_nazev + "_" + value + "[" + poradi + "]");
			$(input_text).attr("disabled", true);
			$(input_text).css("backgroundColor", "#cccccc");
			$(input_text).val('');
		}
	});
}


