var doc_type ="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"http://www.w3.org/TR/html4/loose.dtd\">";

function click_foto(pid, refid, name, photo_file, pformat, ptext, p_h_out_coord_x, p_h_out_coord_y, p_h_out_size_x, p_h_out_size_y, cox_k, coy_k)
{
	var zf_out_height = 0;
	var	zf_out_width  = 0;

	if (document.URL.lastIndexOf("mitm_switch=2") != -1)
	{
		//AENDERN
		Fenster1_aend = window.open(document.URL, "Zweitfenster",Fenster1_aend_parms);
		split_var=document.URL.split("=");
		sp_actid=split_var[1].replace(/&lid/,"");
		//Die <br> in normale LineFeeds zurückwandeln
		var ptext = ptext.replace(/<br>/g, "\n");
		//alert('ptext: '+ptext);
		schreibeFormular_mod_foto(Fenster1_aend,sp_actid,pid,refid,name,photo_file,pformat,ptext,cox_k,coy_k); 
		Fenster1_aend.focus();
	}
	else
	{
		if (document.URL.lastIndexOf("mitm_switch=3") != -1)
		{
			//LOESCHEN
			Check = prompt("Zum loeschen ist Passwort erforderlich!","");
			//Check = "audi80";
			if (Check != "audi80") 
			{
				alert ("Sie haben keine Berechtigung zum Loeschen!");
				return 1;
			}
			else
			{	
				Fenster1_loes = window.open(document.URL, "Zweitfenster",Fenster1_loes_parms);
				split_var=document.URL.split("=");
				sp_actid=split_var[1].replace(/&lid/,"");
				//Die <br> in normale LineFeeds zurückwandeln
				var ptext = ptext.replace(/<br>/g, "\n");
				//alert('ptext: '+ptext);
				schreibeFormular_del_foto(Fenster1_loes,sp_actid,pid,refid,name,photo_file,pformat,ptext,cox_k,coy_k); 
				Fenster1_loes.focus();
			}
			return 0;
		}
		else
		{	
			Fenster1_foto = "";
			zf_out_height = 0;
			zf_out_width  = 0;
	
			// p_h_out_size ergibt die größe des dargestellten fotos!
			if(navigator.appName == "Microsoft Internet Explorer")
			{
				zf_out_height = 30;     // 30 benötigt um 1. textzeile ohne zu scrollen auf auszugeben, vorher 10 ohne text
				zf_out_width  = 25;     // 25 benötigt um 1. textzeile ohne zu scrollen auf auszugeben, vorher 5 ohne text
			}
			else
			{
				if(navigator.appName == "Netscape")
				{
					zf_out_height = 20;   // 20 benötigt um 1. textzeile ohne zu scrollen auf auszugeben, vorher 0 ohne text
					zf_out_width  = 20;   // 20 benötigt um 1. textzeile ohne zu scrollen auf auszugeben, vorher 0 ohne text
				}
				else
				{
					alert("Unbekannter Browser");
				}
			}
		}
		// im msie flackerts, und das 1. laden dauert sehr lange!
		//zf_out_height = zf_out_height+p_h_out_size_y+40;
		zf_out_height = zf_out_height+p_h_out_size_y+100;
		//zf_out_width  = zf_out_width+p_h_out_size_x+40;
		zf_out_width  = zf_out_width+p_h_out_size_x+100;
		// foto-text in stautszeile, hat nachteil das von user dito ausgeschaltet werden kann!
		if (pformat == "H")
		{
			//alert("test");
			Fenster1_foto = window.open("", "Zweitfenster", "width="+zf_out_width+",height="+zf_out_height+",resizable=yes,scrollbars=yes,left="+p_h_out_coord_x+",top="+p_h_out_coord_y+"");
		}
		else
		{
			if (pformat == "Q")
			{
				//zf_out_height = 290;
				//zf_out_width = 320;
				//alert ("zf_out_height:"+zf_out_height+ "zf_out_width:"+zf_out_width);
				Fenster1_foto = window.open(document.URL, "Zweitfenster", "width="+zf_out_height+",height="+zf_out_width+",resizable=yes,scrollbars=yes,left="+p_h_out_coord_x+",top="+p_h_out_coord_y+"");
			}
			else
			{
				alert ("Falsches pformat");
			}	
		}

		Fenster1_foto.document.open();
		Fenster1_foto.document.writeln(doc_type);
		Fenster1_foto.document.writeln("<html>");
		Fenster1_foto.document.writeln("<head>");
		Fenster1_foto.document.writeln("<title>- Klick Foto -</title>");
		Fenster1_foto.document.writeln("<link rel=\"stylesheet\" type=\"text/css\" href=\"./formate.css\">");
		Fenster1_foto.document.writeln("<script type=\"text/javascript\">");
		Fenster1_foto.document.writeln("</script>");

		Fenster1_foto.document.writeln("</head>");
		if (pformat == "H")
		{
			Fenster1_foto.document.writeln("<body  style=\"margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;\"onload=\"window.resizeTo("+zf_out_width+","+zf_out_height+")\">");
			Fenster1_foto.document.writeln("<img src=\""+photo_file+"\",width=\""+p_h_out_size_x+"\", height=\""+p_h_out_size_y+"\",border=\"0\">");
		}
		else
		{
			Fenster1_foto.document.writeln("<body  style=\"margin-top:5px; margin-bottom:5px; margin-left:5px; margin-right:5px;\"onload=\"window.resizeTo("+zf_out_height+","+zf_out_width+")\">");
			Fenster1_foto.document.writeln("<img src=\""+photo_file+"\",width=\""+p_h_out_size_y+"\", height=\""+p_h_out_size_x+"\",border=\"0\">");
		}

		Fenster1_foto.document.writeln("<p class=\"urltext-blue\">");
		Fenster1_foto.document.writeln(ptext);
		Fenster1_foto.document.writeln("</p>");
	
		Fenster1_foto.document.writeln("</body>");
		Fenster1_foto.document.writeln("</html>");	
	
		Fenster1_foto.focus();
		Fenster1_foto.document.close();
	}
}

