/************************************************
* eingaben_ueberpruefen							*
* * * * * * * * * * * * * * * * * * * * * * * * *
* Überprüft die Eingaben im Gästebuch-Formular	*
************************************************/
function eingaben_ueberpruefen()
{
	if (document.Form.message.value=="" || document.Form.name.value=="")
	{
  		alert("Name und Nachrichtenfeld müssen ausgefüllt werden!");
  		return false;
 	}
	if(!checkemail(document.Form.mail.value))
	{
		alert("Email-Adresse ungültig!");
		return false;
	}
	if(!checkurl(document.Form.web.value))
	{
		alert("Homepage-Adresse ungültig!");
		return false;
	}
	if (document.Form.eingabe.value.length != 5)
	{
		alert("Bitte geben Sie den Code ein!");
		document.Form.eingabe.focus();
		return false;
	}
	else
	{
		var codetext = new Array('dsnxn','bx5ka','c6u4h','ehewh','fswnb','la8m2','mvinb','gskaw','wtwem','r7sxs','4pvkb','4x8uw','aetfx');
		var casechanged=document.Form.eingabe.value.toLowerCase();
		if(casechanged != codetext[document.Form.code.value-1])
		{
			alert("Falscher Code!");
			return false;
		}
	}
 	return true;
}
function checkemail(email) 
{
	if(email == "")	
	{
		return true;
	}
	var suche = /([a-zA-Z0-9_])@(.*)\.([a-zA-Z])/;
	if(!suche.exec(email)) 
	{
		return false;
	}
	return true;
}
function checkurl(url) {
	if(url == "http://")
	{
		url = "";
	}
	if(url == "") {
		return true;
	}
	var suche = /^(http:\/\/www)\.(.*)\.([a-zA-Z])/
	if(!suche.exec(url)) {
		suche = /^(www)\.(.*)\.([a-zA-Z])/
		if(suche.exec(url)) {
			document.Form.url.value = "http://" + document.Form.url.value;
			return true;
		}
		else {
			suche = /^(http:\/\/)(.*)\.([a-zA-Z])/
			if(suche.exec(url))	{
				return true;
			}
			return false;
		}
		return false;
	}
	return true;
}

/************************************************
* RND											*
* * * * * * * * * * * * * * * * * * * * * * * * *
* Liefert eine Zufallszahl zur Ansicht eines	*
* Spam-Schutz Bildes							*
************************************************/
function RND()
{
	Zufall = Math.round(Math.random()*12+1);
	document.Form.code.value=Zufall;
	return Zufall;
}

/************************************************
* ShowBild1										*
* * * * * * * * * * * * * * * * * * * * * * * * *
* Zeigt ein neues Fenster mit dem Bild in 		*
* Originalgröße									*
* code generated with                           *
* http://www.free-solutions.de/js/              *
* browser_tool_neuwin.htm                       *
************************************************/
function ShowBild1(wintype)
{
  ShowBild=window.open(	wintype,
  						'Monis Hundesport-Photogalerie', 
						'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=yes, width=800, height=600, left=22, top=22');
  ShowBild.window.focus();
}


function OpenFoto(img)
{
	foto= new Image();
	foto.src=(img);
	ControlFoto(img);
}

function ControlFoto(img)
{
	if((foto.width!=0)&&(foto.height!=0))
	{
		ViewFoto(img);
	}
	else
	{
		interval_a="ControlFoto('"+img+"')";
		interval_b=setTimeout(interval_a,20);
	}
}
function ViewFoto(img)
{
	width=foto.width+20;
	height=foto.height+24;

	try 
	{
		if (output.closed == false) throw "offen";
	}
	catch (e) 
	{
		if (e=="offen") 
		{
			output.close();
		}
	}
	output=window.open("","output","left=40,top=40,width="+width+",height="+height+",location=no,toolbar=no,menubar=no,status=no,scrollbars=yes,resizable=no");
	output.document.writeln("<html><head><title>..:: Foto ::..<\/title><\/head>");
	output.document.writeln("<body bgcolor=\"white\" text=\"white\" link=\"white\" vlink=\"white\" alink=\"white\" leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\">");
	output.document.writeln("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"100%\">");
	output.document.writeln("<tr><td width=\"100%\" height=\"100%\" align=\"left\" valign=\"top\"><p><a href=\"javascript:self.close()\"><img src=\""+img+"\" width=\""+foto.width+"\" height=\""+foto.height+"\" border=\"10\" alt=\"click here to close the window\"></a><\/p><\/td><\/tr>");
	output.document.writeln("<\/table><\/body><\/html>");
	output.focus();
}