var ort = 1;
function gehezur(zahl)
{
	if(window.location.search != "")
		{
		goort=window.location.search;
 		ort=goort.substr(1,goort.length)-1;
 		if (ort < 0 || ort > fotos )
 			{
 			ort = start;
 			}
		}
	else
		{
		ort = start;
	}
	diashowright(ort)
}

function big_foto(datei)
{
		var newWindow;
		var props = 'scrollBars=no,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=680,height=680';
		newWindow = window.open("","Foto", props);
		newWindow.document.write("<html><head><title>Einzelfoto - PENZING</title></head><body onBlur='window.close()' bgcolor='#91C1B1'>")
		newWindow.document.write("<img src="+datei+" border=1>")
		newWindow.document.write("<form><input type='button' value='Foto schließen' OnClick='window.close()'></form>")
		newWindow.document.write("</body></html>")
}	
function old_foto(zahl) 
{
		var newWindow;
		var props = 'scrollBars=no,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=680,height=680';
		newWindow = window.open("","Foto", props);
		newWindow.document.write("<html><head><title>Einzelfoto - PENZING</title></head><body onBlur='self.focus()' bgcolor='#91C1B1'>")
		textx='<script language="JavaScript" src="db.js"><\/script>'
		//newWindow.document.write(textx)
		newWindow.document.write("<h3>"+db[zahl][0]+"</h3>")
		newWindow.document.write("<img src=vimg/a_"+db[zahl][1]+".jpg border=1>")
		//newWindow.document.write("<table border='0' width='100%'>")
		//newWindow.document.write("<tr>")
		//newWindow.document.write("<td width='48' align='center'><a href='#' onClick='diashowleft(zahl)'><img border='0' src='img/left.gif' align='left' width='48' height='28'></a></td>")
		//newWindow.document.write("<td width='48' align='center'>")
		//newWindow.document.write("<p align='center'><font face='Arial' size='2'><b>voriges<br>")
		//newWindow.document.write("Bild</b></font></td>")
		//newWindow.document.write("<td align='center'><input type='Text' name='direkt' size='50' value='Penzinger Pfarrkirche'></td>")
		//newWindow.document.write("<td width='48' align='center'>")
		//newWindow.document.write("<p align='center'><font face='Arial' size='2'><b>nächstes<br>")
		//newWindow.document.write("Bild</b></font></td>")
		//newWindow.document.write("<td width='48' align='center'><a href='#' onClick=diashowright(zahl)><img border='0' src='img/right.gif' align='right' width='48' height='28'></a></td>")
		//newWindow.document.write("</tr>")
		//newWindow.document.write("</table>")
		newWindow.document.write("<form><input type='button' value='Foto schließen' OnClick='window.close()'></form>")
		newWindow.document.write("</body></html>")
}	

function new_foto(zahl) 
{
		var newWindow;
		var props = 'scrollBars=no,resizable=yes,toolbar=no,menubar=no,location=no,directories=no,width=680,height=680';
		newWindow = window.open("","Foto", props);
		newWindow.document.write("<html><head><title>Einzelfoto - PENZING</title></head><body onBlur='window.close()' bgcolor='#91C1B1'>")
		//newWindow.document.write("<script language='JavaScript' src='db.js'><\/script>")
		//newWindow.document.write("<script language='JavaScript' src='dias.js'><\/script>")
		//newWindow.document.write("<script language='JavaScript'>ort = 1;<\/script>")
		newWindow.document.write("<h3>"+db[zahl][0]+"</h3>")
		newWindow.document.write("<img src=vimg/n_"+db[zahl][1]+".jpg border=1>")
		//newWindow.document.write("<table border='0' width='100%'>")
		//newWindow.document.write("<tr>")
		//newWindow.document.write("<td width='48' align='center'><a href='#' onClick=diashowleft(ort)><img border='0' src='img/left.gif' align='left' width='48' height='28'></a></td>")
		//newWindow.document.write("<td width='48' align='center'>")
		//newWindow.document.write("<p align='center'><font face='Arial' size='2'><b>voriges<br>")
		//newWindow.document.write("Bild</b></font></td>")
		//newWindow.document.write("<td align='center'><input type='Text' name='direkt' size='50' value='Penzinger Pfarrkirche'></td>")
		//newWindow.document.write("<td width='48' align='center'>")
		//newWindow.document.write("<p align='center'><font face='Arial' size='2'><b>nächstes<br>")
		//newWindow.document.write("Bild</b></font></td>")
		//newWindow.document.write("<td width='48' align='center'><a href='#' onClick=diashowright(ort)><img border='0' src='img/right.gif' align='right' width='48' height='28'></a></td>")
		//newWindow.document.write("</tr>")
		//newWindow.document.write("</table>")
		newWindow.document.write("<form><input type='button' value='Foto schließen' OnClick='window.close()'></form>")
		newWindow.document.write("</body></html>")
}	

function diashowleft(zahl)
{
	if (zahl > 1)	
	{
		zahl = zahl-1
	}
	else
	{
		zahl=fotos
	}	
		ort = zahl
	  bilda="vimg/a_"+db[zahl][1]+"_s.jpg"
	  bildn="vimg/n_"+db[zahl][1]+"_s.jpg"
	  window.document.images[2].src=bilda;
	  window.document.images[3].src=bildn;
  	//window.document.forms[0].titel.value = db[zahl][0];
  	window.document.forms[0].direkt.options[ort-1].selected = true;
  	var text;
  	text = db[zahl][4];
  	while (text.indexOf("§") > -1)
  	{
  		text=text.substring(0,text.indexOf("§"))+String.fromCharCode(13)+text.substring(text.indexOf("§")+1,text.length);
  	}
  	window.document.forms[0].oldtext.value = text;
  	text = db[zahl][5];
  	while (text.indexOf("§") > -1)
  	{
  		text=text.substring(0,text.indexOf("§"))+String.fromCharCode(13)+text.substring(text.indexOf("§")+1,text.length);
  	}
  	window.document.forms[0].newtext.value = text;
  	xx = db[zahl][2];
  	yy = db[zahl][3];
	set_cursor();
}

function diashowright(zahl)
{
	if (zahl < fotos)	
	{
		zahl = zahl+1
	}
	else
	{	
		zahl=1
	}	
		ort = zahl
	  bilda="vimg/a_"+db[zahl][1]+"_s.jpg"
	  bildn="vimg/n_"+db[zahl][1]+"_s.jpg"
	  window.document.images[2].src=bilda;
	  window.document.images[3].src=bildn;
  	//window.document.forms[0].titel.value = db[zahl][0];
  	window.document.forms[0].direkt.options[ort-1].selected = true;
  	var text;
  	text = db[zahl][4];
  	while (text.indexOf("§") > -1)
  	{
  		text=text.substring(0,text.indexOf("§"))+String.fromCharCode(13)+text.substring(text.indexOf("§")+1,text.length);
  	}
  	window.document.forms[0].oldtext.value = text;
  	text = db[zahl][5];
  	while (text.indexOf("§") > -1)
  	{
  		text=text.substring(0,text.indexOf("§"))+String.fromCharCode(13)+text.substring(text.indexOf("§")+1,text.length);
  	}
  	window.document.forms[0].newtext.value = text;
  	xx = db[zahl][2];
  	yy = db[zahl][3];
	set_cursor()

}
 
function set_cursor()
{
	xxx=694;
	yyy=264; 
	if (xx<1 || xx>698)
		{
		xx=485;
		}
	if (yy<1 || yy>268)
		{
		yy=130;
		}	
		
	window.document.images[pics+0].width=xx-1;
	window.document.images[pics+0].height=yy-6;
	window.document.images[pics+1].height=yy-6;
	window.document.images[pics+2].width=xxx-xx-1;
	window.document.images[pics+2].height=yy-6;

	window.document.images[pics+3].width=xx-6;
	window.document.images[pics+5].width=xxx-xx-6;
	
	window.document.images[pics+6].width=xx-1;
	window.document.images[pics+6].height=yyy-yy-1;
	window.document.images[pics+7].height=yyy-yy-1;
	window.document.images[pics+8].width=xxx-xx-1;
	window.document.images[pics+8].height=yyy-yy-1;
}
