/* 
(c)2004 www.parallaxis.de  
  Funktionsbibliothek
*/


//	Funktion des Browser-Zurueck-Buttons 
function fBack()
{ 
history.back(1);
} 

// Popup

var PopupFenster= null;

function fPopup(seite,breite,hoehe) {
    if(PopupFenster != null) {
      if(!PopupFenster.closed) {
        PopupFenster.close();
      }
    }
    PopupFenster =open(seite, 'Popup', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+breite+',height='+hoehe+',screenY=130,screenX=110');
}



// Variable Zoomfunktion Parallaxis - Manuel Bieh, 03.09.2004
function fZoom(imageName,scroll,bildunterschrift) { 
  
    newWindow = window.open("","newWindow","width="+640+",height="+640+",scrollbars=no resizable=no");
 

newWindow.document.open();
newWindow.document.writeln('<html><head><title>Jägerstübchen</title>');
newWindow.document.writeln('<link rel=stylesheet type="text/css" href="style.css"></head>');
newWindow.document.writeln('<body topmargin="0" marginheight="0" leftmargin="0" marginleft="0" onload="window.resizeTo(document.bild.width,document.bild.height+30);" onBlur="self.close()">');
newWindow.document.writeln('<a href="javascript:self.close()"><img src=\"'+imageName+'\" name="bild" align="absmiddle" border=0></a>'); 
if (fZoom.arguments.length>2){
newWindow.document.writeln('<b>'+ bildunterschrift+'</b>')}
newWindow.document.write('</body></html>');
newWindow.document.close();
newWindow.focus(); 
if(navigator.appName == "Microsoft Internet Explorer") {
var bildhoehe = newWindow.document.bild.height;
var bildbreite = newWindow.document.bild.width;
newWindow.resizeTo(bildbreite,bildhoehe);}
 else {
newWindow.resizeTo(bildbreite,bildhoehe);  
  }
  
  
  }


//	Email Plausibilitaetsabfrage
function chkForm()
		{
		  var valid
		  valid = true;
		  if(!chkName())  	//Namen generell ueberpruefen
		    {
		    valid = false;
		    return valid;
		    exit;
		    }
					//Abfrage ob Email, Fax oder Postversand
		  for (i=0;i<=2;i++)
		    {
		      if (document.Anfrage.antwort[i].checked==1)
			var Eingabe = document.Anfrage.antwort[i].value;
		    }
		  switch(Eingabe)
		    {
                    case "telefon":
			if(!chktelefon())		//Telefon-Anfrage
			  {
			  valid = false;
			  return valid;
			  }
			break;
		      case "per Email":
			if(!chkEmail())		//Email-Anfrage
			  {
			  valid = false;
			  return valid;
			  }
			break;
		      case "per Fax":
			if(!chkFax())		//Fax-Anfrage
			  {
			  valid = false;
			  return valid;
			  }
			break;
		      case "per Post":
			if(!chkAdresse())	//Post-Anfrage
			  {
			  valid = false;
			  return valid;
			  }
			break;
		    }
		  return valid;
		}


	function chkName()
		{
		if((document.Anfrage.Nachname.value == "") || (document.Anfrage.Vorname.value == ""))
		  {
		    alert("Bitte geben Sie Ihren Namen und Vornamen ein!");
		    document.Anfrage.Nachname.focus();
		    return false;
		  }
		else
		  return true;
		}

	function chkAdresse()
		{
		if((document.Anfrage.Strasse.value == "") 
			|| (document.Anfrage.PLZ.value == "")
			|| (document.Anfrage.Ort.value == "")
			|| (document.Anfrage.Land.value == ""))
		  {
		  alert("Bitte geben Sie Ihre komplette Adresse ein!");
		  document.Anfrage.Strasse.focus();
		  return false;
		  }
		else
		  return true;
		}

         function chktelfon()
		{
		if(document.Anfrage.Telefon.value == "")
		 {
		  alert("Bitte geben Sie Ihre Telefon-Nummer ein!");
		  document.Anfrage.Telefon.focus();
		  return false;
		  exit;
		 }
		else
		  return true;
		}


	function chkEmail()
		{
		var adress = document.Anfrage.Email.value;
		if ((adress =="")
			|| (adress.indexOf ('@') == -1)
			|| (adress.indexOf ('.') == -1))
		 {
		  alert("Bitte geben Sie Ihre Email-Adresse ein!");
		  document.Anfrage.Email.focus();
		  return false;
		  exit;
		 }
		else
		  return true;
		}

	function chkFax()
		{
		if(document.Anfrage.Telefax.value == "")
		 {
		  alert("Bitte geben Sie Ihre Fax-Nummer ein!");
		  document.Anfrage.Telefax.focus();
		  return false;
		  exit;
		 }
		else
		  return true;
		}

function fCheckEmail(adress)
	{
	if ((adress =="")
		|| (adress.indexOf ('@') == -1)
		|| (adress.indexOf ('.') == -1))
		return false;
	return true;
	}



//	Macromedia Swapimage-Funktionen
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

 