function show_photo(text,file,width,height){
	no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
	with (no.document)
	{
		open();
		writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" style="border: 0px;" /></a></body>');
		close();
		no.focus();
	}
}

function openWindow(text,file,width,height,type){
	if (type=='img'){
		no=window.open("", "zoom", "left=5, top=5, width="+width+", height="+height+", toolbar=no, location=no, status=no, scrollbars=auto");
		with (no.document)
		{
			open();
			writeln('<body style="margin: 0px;"><a href="javascript:void window.close();"><img src="'+file+'" alt="'+text+'"style="border: 0px;" /></a></body>');
			close();
			no.focus();
		}
	}
	if (type=='file'){
		window.open(file, "zoom", "left=5, top=5, resizable,toolbar=no, location=no, status=no, scrollbars=yes");
		
		
	}
	return false;
}

function changeImage (url,foto) {
	if (document.getElementById) {
    	//window.alert(foto);    
                document.getElementById('mainphoto').src = url;
                document.getElementById('largephoto').href = foto;
               // photo_id = fotka_id;
        }
        return false;
}

function showLargeImage(url,width,height,type) {
	if (screen.height) {
		screenY = screen.height
		screenX = screen.width
	}
	var top = ((screenY/2)-(height/2));
	var left = ((screenX/2)-(width/2));
	window.open(url,'','resizable=no,status=no,scrollbars=no,width='+width+',height='+height+',top=50,left=50');
	return false;
}

function AddFavorite(linkObj,addUrl,addTitle){
  if (document.all && !window.opera)
  {
    window.external.AddFavorite(addUrl,addTitle);
    return false;
  }
  else if (window.opera && window.print)
  {
    linkObj.title = addTitle;
    return true;
  }
  else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
  {
    if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
    {
      window.sidebar.addPanel(addTitle,addUrl,'');
      return false;
    }
  }
  window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
  return false;
}

function countOsoby(data){
	var celkem = 0;
	
	if (document.getElementById('dospely').value) {
		dosp = parseInt(document.getElementById('dospely').value);
		celkem = celkem+dosp;
	}
	if (document.getElementById('student').value) {
		stud = parseInt(document.getElementById('student').value);
		celkem = celkem+stud;
	}
	if (document.getElementById('dite').value) {
		dit = parseInt(document.getElementById('dite').value);
		celkem = celkem+dit;
	}
	if (document.getElementById('porculanek').value) {
		porc = parseInt(document.getElementById('porculanek').value);
		celkem = celkem+porc;
	}
	
	var hodnota = new Array();
	
	if (data!='') hodnota = data.split("*");
	
	str = "<table>";
	for (i=1; i<=celkem; i++){
		if (hodnota[i-1]) str = str+"<tr><td><label>Osoba "+i+"</label></td><td><input type=\"text\" name=\"osoba"+i+"\" value=\""+hodnota[i-1]+"\" /></td></tr>";
		else str = str+"<tr><td><label>Osoba "+i+"</label></td><td><input type=\"text\" name=\"osoba"+i+"\" value=\"\" /></td></tr>";
	}
	str = str+"</table>pokud jestě nevíte jména všech účastníků, nechte pole prázdná";
	document.getElementById('osoby').innerHTML = str;
}
