function nove_okno(adresa)
{
	window.open(adresa,"","");
}

function HideInfo(id){
	document.getElementById(id).style.display='none';
}

function winH(){
	/* NN4 a kompatibiln prohlee */
	if (window.innerHeight)
		return window.innerHeight;
	/* MSIE6 v std. reimu - Opera a Mozilla ji usply s window.innerHeight */
	else if (document.documentElement && document.documentElement.clientHeight)
		return document.documentElement.clientHeight;
	/* star MSIE + MSIE6 v quirk reimu */
	else if (document.body && document.body.clientHeight)
		return document.body.clientHeight;
	else
		return null;
}

function winW(){
	/* NN4 a kompatibiln prohlee */
	if (window.innerWidth)
		return window.innerWidth;
	/* MSIE6 v std. reimu - Opera a Mozilla ji usply s window.innerHeight */
	else if (document.documentElement && document.documentElement.clientWidth)
		return document.documentElement.clientWidth;
	/* star MSIE + MSIE6 v quirk reimu */
	else if (document.body && document.body.clientWidth)
		return document.body.clientWidth;
	else
		return null;
}

function Okno(width,height,scrollbars,url){
	posX = (winW()/2)-(width/2);
	posY = (winH()/2)-(height/2);
	add=window.open("popup.php?filename="+url,"add","left="+posX+",top="+posY+",width="+width+",height="+height+",menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars="+scrollbars+",resizable=yes");
	add.focus();
}

function NewWin(url,name,width,height,scrollbars) {
	posX = (winW()/2)-(width/2);
	posY = (winH()/2)-(height/2);
	add=window.open(url,name,"left="+posX+",top="+posY+",width="+width+",height="+height+",menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars="+scrollbars+",resizable=yes");
	add.focus();
}

function VyskakovaciOkno(width, height, scrollbars, url)
{
	posX = (winW()/2)-(width/2);
	posY = (winH()/2)-(height/2);
	add = window.open(url, "add", "left="+posX+", top="+posY+", width="+width+", height="+height+", menubar=no,directories=no,toolbar=no,location=no,status=no,scrollbars="+scrollbars+",resizable=yes");
	add.focus();
}

function VyslednaVyse()
{
	/*
		1 => "Hodinová odmena lektora vcetne odvodu", 
		2 => "Ubytování lektoru", 
		3 => "Stravování a droprava lektoru", 
		4 => "Náklady na zajištení prostor", 
		5 => "Doprava úcastníku", 
		6 => "Stravování úcastníku", 
		7 => "Ubytování úcastníku", 
		8 => "Odmena organizátorum", 
		9 => "Príprava, preklad, autor. práva", 
		10 => "Rozmnožení textu", 
		11 => "Stravné a dopravné organizátoru", 
		12 => "Ubytování organizátoru", 
		13 => "Poštovné, telefony", 
		14 => "Doprava a pronájem techniky", 
		15 => "Propagace", 
		16 => "Ostatní náklady"
*/
//	alert('start');

	if(document.getElementById("hodin").value && document.getElementById("pocet_min").value && document.getElementById("fin_udaje_1").value)
	{

		var vyse = 0;
		var fin_udaje = 0;
	
		var hodin = parseFloat(document.getElementById("hodin").value);
		var pocet_min = parseFloat(document.getElementById("pocet_min").value);
		var fin_udaje_1 = parseFloat(document.getElementById("fin_udaje_1").value);
	
		for(i = 2; i <= 13; i++)
		{
			if(document.getElementById("fin_udaje_" + i).value)
			{
				fin_udaje += parseFloat(document.getElementById("fin_udaje_" + i).value);
	
				//alert(i + ' - ' + fin_udaje);
			}
		}

	//	alert('end: ' + fin_udaje);
	
		vyse = (fin_udaje_1 * hodin) + fin_udaje;
		vyse = Math.ceil(vyse / pocet_min);
	
		//alert('vyse: ' + vyse);
	
		if(isNaN(vyse))
		{
			document.getElementById("v_vyse").value = '';
		}
		else
		{
			document.getElementById("v_vyse").value = (vyse).toString();
		}
	}

/*
	if(document.getElementById("hodin").value && document.getElementById("pocet_min").value)
	{
		var vyse = 0;
		var fin_udaje = 0;

		/*var fin_udaje_2 = parseFloat(document.getElementById("fin_udaje_2").value);
		var fin_udaje_3 = parseFloat(document.getElementById("fin_udaje_3").value);
		var fin_udaje_4 = parseFloat(document.getElementById("fin_udaje_4").value);
		var fin_udaje_5 = parseFloat(document.getElementById("fin_udaje_5").value);
		var fin_udaje_6 = parseFloat(document.getElementById("fin_udaje_6").value);
		var fin_udaje_7 = parseFloat(document.getElementById("fin_udaje_7").value);
		var fin_udaje_8 = parseFloat(document.getElementById("fin_udaje_8").value);
		var fin_udaje_9 = parseFloat(document.getElementById("fin_udaje_9").value);
		var fin_udaje_10 = parseFloat(document.getElementById("fin_udaje_10").value);
		var fin_udaje_11 = parseFloat(document.getElementById("fin_udaje_11").value);
		var fin_udaje_12 = parseFloat(document.getElementById("fin_udaje_12").value);
		var fin_udaje_13 = parseFloat(document.getElementById("fin_udaje_13").value);
		var fin_udaje_14 = parseFloat(document.getElementById("fin_udaje_14").value);
		var fin_udaje_15 = parseFloat(document.getElementById("fin_udaje_15").value);
		var fin_udaje_16 = parseFloat(document.getElementById("fin_udaje_16").value);*/

/*		vyse = (fin_udaje_1 * hodin) + (fin_udaje_2 + fin_udaje_3 + fin_udaje_4 + fin_udaje_5 + fin_udaje_6 + fin_udaje_7 + fin_udaje_8 + fin_udaje_9 + fin_udaje_10 + fin_udaje_11 + fin_udaje_12 + fin_udaje_13 + fin_udaje_14 + fin_udaje_15 + fin_udaje_16);
		//vyse = Math.ceil(vyse / pocet_min);
	}*/

	//if(vyse) document.getElementById("v_vyse").value = (vyse / pocet_min).toString();
}
