/* 
(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) { 
if (fZoom.arguments.length>2){
  if (scroll == 'yes'){
    newWindow = window.open("","newWindow","width="+599+",height="+400+",scrollbars=yes");
  }else{
    newWindow = window.open("","newWindow","width="+599+",height="+400+",scrollbars=no,resizable=yes");
  }
}else{
  if (scroll == 'no'){
    newWindow = window.open("","newWindow","width="+599+",height="+400+",scrollbars=no resizable=no");
  }else{
    newWindow = window.open("","newWindow","width="+599+",height="+400+",scrollbars=yes,resizable=no");
  }
}

newWindow.document.open();
newWindow.document.writeln('<html><head><title>Obermoarhof</title>');
newWindow.document.writeln('</head>');
newWindow.document.writeln('<body topmargin="0" marginheight="0" leftmargin="0" marginleft="0" onload="window.resizeTo(document.bild.width+24,document.bild.height+30);" onBlur="self.close()">');
newWindow.document.writeln('<p align="center"><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;
{if (bildhoehe>640) { newWindow.resizeTo(bildbreite+27,600);}
 else {
  if (fZoom.arguments.length>2) { newWindow.resizeTo(bildbreite,bildhoehe+50); }
  else { newWindow.resizeTo(bildbreite,bildhoehe+29) }}}}
}





//	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];}
}

// Popup Fenster zentriert in der Mitte öffnen
// Aufruf erfolgt ueber: <A href="javascript:fOpenWindow('DATEI.html')">TEXT></A>
function fOpenWindow(url)
	{
	neuesFenster=open(url,"Printservice","width=760,height=420,scrollbars=2,status=0,resizable=0,toolbar=0");
	offX=screen.availWidth;
	offY=screen.availHeight;
	//neuesFenster.moveTo(((offX/2)-(720/2)-6),((offY/2)-(420/2)-20));
	neuesFenster.moveTo(((offX/2)-(720/2)),((offY/2)-(420/2)));
	neuesFenster.focus();
	}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

function MM_nbGroup(event, grpName) { //v3.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1];
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    if ((nbArr = document[grpName]) != null)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = args[i+1];
      nbArr[nbArr.length] = img;
  } }
}

//##############################################################################################
function chkForm()
{
		var valid
		valid = true;
		
		//Namen generell ueberpruefen
		if(!chkName())  	
		{
			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 "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;
		}

	if(!chkPrivacy())  
	{
		valid = false;
		return valid;
		exit;  
		return valid;
	}
}
//############
function chkName()
{
	if ((document.Anfrage.Nachname.value == "") 
	|| (document.Anfrage.Vorname.value == ""))
	{
		alert("Bitte geben Sie Ihren Namen 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;
}
//############
function chkPrivacy()
{
	if(document.Anfrage.Privacy.checked != "1")
	{
		alert("Bitte akzeptieren Sie die Privacy-Bestimmungen!");
		document.Anfrage.Privacy.focus();
		return false;
		exit;
	}
	else
	return true;
}

//#############################################
function chkForm_EN()
{
		var valid
		valid = true;
		
		//Namen generell ueberpruefen
		if(!chkName_EN())  	
		{
			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 "per Email":
				if(!chkEmail_EN())		//Email-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
			
			case "per Fax":
				if(!chkFax_EN())		//Fax-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
		
			case "per Post":
				if(!chkAdresse_EN())	//Post-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
		}

	if(!chkPrivacy_EN())  
	{
		valid = false;
		return valid;
		exit;  
		return valid;
	}
}
//############
function chkName_EN()
{
	if ((document.Anfrage.Nachname.value == "") 
	|| (document.Anfrage.Vorname.value == ""))
	{
		alert("Please insert your Name!");
		document.Anfrage.Nachname.focus();
		return false;
	}
	else
	return true;
}
//############
function chkAdresse_EN()
{
	if ((document.Anfrage.Strasse.value == "") 
	|| (document.Anfrage.PLZ.value == "")
	|| (document.Anfrage.Ort.value == "")
	|| (document.Anfrage.Land.value == ""))
	{
		alert("Please insert your Adress");
		document.Anfrage.Strasse.focus();
		return false;
	}
	else
	return true;
}
//############
function chktelfon_EN()
{
	if(document.Anfrage.Telefon.value == "")
	{
		alert("Please enter your Phonenumber");
		document.Anfrage.Telefon.focus();
		return false;
		exit;
	}
	else
	return true;
}
//############
function chkEmail_EN()
{
var adress = document.Anfrage.Email.value;
	if ((adress =="")
	|| (adress.indexOf ('@') == -1)
	|| (adress.indexOf ('.') == -1))
	{
		alert("Please enter your Email!");
		document.Anfrage.Email.focus();
		return false;
		exit;
	}
	else
	return true;
}
//############
function chkFax_EN()
{
	if(document.Anfrage.Telefax.value == "")
	{
		alert("Please enter your Faxnumber");
		document.Anfrage.Telefax.focus();
		return false;
		exit;
	}
	else
	return true;
}
//############
function fCheckEmail_EN(adress)
{
	if ((adress =="")
	|| (adress.indexOf ('@') == -1)
	|| (adress.indexOf ('.') == -1))
	return false;
	return true;
}
//############
function chkPrivacy_EN()
{
	if(document.Anfrage.Privacy.checked != "1")
	{
		alert("Please accept our Privacy-terms!");
		document.Anfrage.Privacy.focus();
		return false;
		exit;
	}
	else
	return true;
}

//#############################################
function chkForm_IT()
{
		var valid
		valid = true;
		
		//Namen generell ueberpruefen
		if(!chkName_IT())  	
		{
			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 "per Email":
				if(!chkEmail_IT())		//Email-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
			
			case "per Fax":
				if(!chkFax_IT())		//Fax-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
		
			case "per Post":
				if(!chkAdresse_IT())	//Post-Anfrage
				{
					valid = false;
					return valid;
				}
			break;
		}

	if(!chkPrivacy_IT())  
	{
		valid = false;
		return valid;
		exit;  
		return valid;
	}
}
//############
function chkName_IT()
{
	if ((document.Anfrage.Nachname.value == "") 
	|| (document.Anfrage.Vorname.value == ""))
	{
		alert("Indichi per favore suo nome e cognome!");
		document.Anfrage.Nachname.focus();
		return false;
	}
	else
	return true;
}
//############
function chkAdresse_IT()
{
	if ((document.Anfrage.Strasse.value == "") 
	|| (document.Anfrage.PLZ.value == "")
	|| (document.Anfrage.Ort.value == "")
	|| (document.Anfrage.Land.value == ""))
	{
		alert("Indichi per favore suo indirizzo completo!");
		document.Anfrage.Strasse.focus();
		return false;
	}
	else
	return true;
}
//############
function chktelfon_IT()
{
	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_IT()
{
var adress = document.Anfrage.Email.value;
	if ((adress =="")
	|| (adress.indexOf ('@') == -1)
	|| (adress.indexOf ('.') == -1))
	{
		alert("Indichi per favore suo indirizzo E-Mail!");
		document.Anfrage.Email.focus();
		return false;
		exit;
	}
	else
	return true;
}
//############
function chkFax_IT()
{
	if(document.Anfrage.Telefax.value == "")
	{
		alert("Indichi per favore suo numero fax!");
		document.Anfrage.Telefax.focus();
		return false;
		exit;
	}
	else
	return true;
}
//############
function fCheckEmail_IT(adress)
{
	if ((adress =="")
	|| (adress.indexOf ('@') == -1)
	|| (adress.indexOf ('.') == -1))
	return false;
	return true;
}
//############
function chkPrivacy_IT()
{
	if(document.Anfrage.Privacy.checked != "1")
	{
		alert("Si accetto Rispettiamo la Vostra privacy");
		document.Anfrage.Privacy.focus();
		return false;
		exit;
	}
	else
	return true;
}
