/*******************************
	Wechselt auf die Startseite.
********************************/

function gotoHome()
{
	document.location.href = "ezastro.htm";
}

/****************************************************
	Setzt den Fokus in das Eingabefeld für den Namen.
*****************************************************/ 

function setFocusToName()
{
	document.Gaeste.Name.focus();
}

/*****************************************************
	Löscht alle Daten im Formular zum Erstellen eines
	neuen Gästebuch-Eintrag.
******************************************************/ 

function clearForm()
{
	document.Gaeste.reset();
	document.Gaeste.Name.focus();
}

/*******************************************************
	Gibt die Daten aus dem Formular frei, um aus ihnen
	einen Eintrag für das Gästebuch erstellen zu lassen.
********************************************************/

function sendForm()
{
	var txtName = document.Gaeste.Name;
	var txtComment = document.Gaeste.Comment;
	var msg

	if(txtName.value == "" || txtComment.value == "")
	{
		if(txtName.value == "" && txtComment.value == "")
		{
			msg = "Bitte geben Sie einen Namen\n" +
				  "und einen Kommentar ein.";
			txtName.focus();
		}
		else
		{
			if(txtName.value == "")
			{
				msg = "Bitte geben Sie einen Namen ein.";
				txtName.focus();
			}
			if(txtComment.value == "")
			{
				msg = "Bitte geben Sie einen Kommentar ein.";
				txtComment.focus();
			}
		}

		alert(msg);
	}
	else
	{
		document.Gaeste.submit();
	}
}

/**********************************************************
	Prüft, ob Flash-nimationen wiedergegeben werden können.
***********************************************************/

function isFlashAvailable()
{
  var plugin = null;
	var isFlash = false;

	if(navigator.appName != "Microsoft Internet Explorer")
	{
		for(var i=0;i<navigator.plugins.length;i++)
		{
			plugin = navigator.plugins[i];

			if(plugin.name == "Shockwave Flash")
			{
				 isFlash = true;
				 break;
			}
		}
	}
	else isFlash = true;
	
	return isFlash;
}

/*************************************************************
	Falls Flash verfuegbar ist wird HTML-Code zur Anzeige und
	Wiedergabe der Rad-Flash-Animation eingefuegt. Falls nicht,
	dann erstellt die Funktion HTML-Code zur Anzeige eines
	statischen Radix-Bild.
**************************************************************/ 

function radixAnimation()
{
	var flash = isFlashAvailable();	

	if(flash)
	{
		addFlashAnimation("radix.swf",502,351,"Radix","",true);
	}
	else
	{
		document.write("<br><br><a href='frameset.htm'><img src='images/radix1024x768.gif' border='0' alt='Radix'></a><br><br>");
	}
}

/***********************************************
	Erzeugt den Quellcode fuer die Anzeige einer
	Flash-Animation
************************************************/

function addFlashAnimation(source,width,height,id,style,loop)
{
	if(loop == true) 	loop = "true";
	if(loop == false)	loop = "false";

	document.write("<embed src='" 	+ source + 
				   "' width='"    	+ width  + 
				   "' height='"		+ height +
				   "' id='"			+ id	 +
				   "' style='"		+ style  + 
				   "' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'" +
				   "  loop='"		+ loop + "'></embed>");
}

/**************************************************
	Setzt den Pfeil vor den Eintrag im Menü auf den
	der Mauszeiger gerade gerichtet ist.
**************************************************/

function setArrow(pos)
{
    for(i=1;i<document.images.length-2;i++)
	{
	   if(i==pos)
	       document.images[i].src="images/diverse/pfeil.gif";
	   else
	       document.images[i].src="images/diverse/leer.gif";
	}
}

/**********************************************************
	Sorgt für eine optimale Darstellung in jeder Auflösung.
***********************************************************/

function optimizeForResolution()
{
	if((screen.width==640) && (screen.height==480))
	{
		document.location.href = "lowres.htm";
	}
	else
	{
		var schlange = 	document.getElementById("Schlange");
		var elli = 		document.getElementById("Elli");
		var neu = 		document.getElementById("Neu");
		var vita = 		document.getElementById("Vita");
		var astro = 	document.getElementById("Astro");
		var beratung = 	document.getElementById("Beratung");
		var kontakt = 	document.getElementById("Kontakt");
		var gaeste =	document.getElementById("Gaeste");
		var gastbuch =	document.getElementById("Gastbuch");
		var radix = 	document.getElementById("Radix");
		var ezastro = 	document.getElementById("EZAstro");
		var radixalt =  document.getElementById("Radixalt");
		var seiten =  	document.getElementById("Seiten");
		var buchtips =  document.getElementById("Buchtips");
		var radioohr =  document.getElementById("RadioOhr");
		var stunden =  	document.getElementById("Stunden");
		var suchen =  	document.getElementById("Suchen");
		var finden =  	document.getElementById("Finden");
		var flash =		document.getElementById("Flash");
		var sterben =	document.getElementById("Sterben");
		var yvonne =	document.getElementById("Yvonne");
		var kurt =		document.getElementById("Kurt");
	}

	if((screen.width==800) && (screen.height==600))
	{
		if (radix != null)
		{
			 radix.width = radix.width - 120;
			 radix.height = radix.height - 120;
		}
	}
	
	else if((screen.width==1600) && (screen.height==1200))
	{
		document.location.href = "highres.htm"
	}

	else
	{
		document.getElementById("css").href = 		"css/1024x768.css";
		if (schlange != null)	schlange.src = 		"images/schlange1024x768.gif";

		if (neu != null) 		    neu.src = 		"images/neu1024x768.gif";
		if (astro != null) 		   	astro.src = 	"images/astro1024x768.gif";
		if (beratung != null)   	beratung.src = 	"images/beratung1024x768.gif";
		if (kontakt != null) 		kontakt.src = 	"images/kontakt1024x768.gif";
		if (gaeste != null)			gaeste.src =	"images/gaeste1024x768.gif";
		if (gastbuch != null)		gastbuch.src =	"images/gastbuch1024x768.gif"
		if (ezastro != null)		ezastro.src =	"images/ezastro1024x768.gif";
		if (vita != null)			vita.src =		"images/vita1024x768.gif";
		if (seiten != null)			seiten.src =	"images/seiten1024x768.gif";
		if (buchtips != null)		buchtips.src =	"images/buchtips1024x768.gif";
		if (stunden != null)		stunden.src =	"images/stunden1024x768.gif";
		if (radioohr != null)		radioohr.src =	"images/radioohr1024x768.gif";
		if (elli != null)			elli.src =		"images/elli1024x768.jpg";
		if (radixalt != null)		radixalt.src =	"images/radix1024x768.gif";
		if (suchen != null)			suchen.src =	"images/suchen1024x768.gif";
		if (sterben != null)		sterben.src =	"images/sterben1024x768.gif";
		if (finden != null)			finden.src =	"images/diverse/suchen1024x768.gif";
		if (yvonne != null)			yvonne.src =	"images/diverse/yvonne1024x768.png";
		if (kurt != null)			kurt.src =		"images/diverse/kurt1024x768.png";

		if (schlange != null)		schlange.width = 	200;
		if (neu != null)			neu.width = 		369;
		if (astro != null) 			astro.width = 		515;
		if (beratung != null) 		beratung.width = 	362;
		if (kontakt != null) 		kontakt.width = 	646;
		if (gaeste != null)			gaeste.width =		662;
		if (gastbuch != null)		gastbuch.width =	465
		if (ezastro != null)		ezastro.width =		852;
		if (vita != null)			vita.width =		277;
		if (seiten != null)			seiten.width =		703;
		if (buchtips != null)		buchtips.width =	736;
		if (stunden != null)		stunden.width =		789;
	  	if (radioohr != null)		radioohr.width =	742;
		if (elli != null)			elli.width =		160;
		if (radixalt != null)		radixalt.width =	280;
		if (suchen != null)			suchen.width =		760;
		if (finden != null)			finden.width =		669;
		if (sterben != null)		sterben.width =		1094;
		if (yvonne != null)			yvonne.width =		641;
		if (kurt != null)			kurt.width =		641;

		if (schlange != null)		schlange.height = 	114;
		if (neu != null) 			neu.height = 		109;
		if (astro != null) 			astro.height = 		109;
		if (beratung != null) 		beratung.height = 	109;
		if (kontakt != null) 		kontakt.height = 	109;
		if (gaeste != null)			gaeste.height =		109;
		if (gastbuch != null)		gastbuch.height =	109;
		if (ezastro != null)		ezastro.height =	109;
		if (vita != null)			vita.height =		109;
		if (seiten != null)			seiten.height =		109;
		if (buchtips != null)		buchtips.height =	109;
		if (stunden != null)		stunden.height =	109;
		if (radioohr != null)		radioohr.height =	109;
		if (suchen != null)			suchen.height =		109;
		if (sterben != null)		sterben.height =	109;
		if (elli != null)			elli.height =		202;
		if (radixalt != null)		radixalt.height =	280;
		if (finden != null)			finden.height =		645;
		if (yvonne != null)			yvonne.height =		629;
		if (kurt != null)			kurt.height =		630;
	}
	
	if((screen.width > 1024) && (screen.height > 768))
	{
    	if (flash != null)
    	{
    		flash.style.visibility = "visible";
    	}
    }
}

