// JavaScript Document
//-----------------------------------------------------------------------------------------------
var defaultEmptyOK = false


function isInteger (s)
{

var i;

if (isEmpty(s))
    if (isInteger.arguments.length == 1) return defaultEmptyOK;
   else return (isInteger.arguments[1] == true);
   for (i = 0; i < s.length; i++)
    {
         // Check that current character is number.
         var c = s.charAt(i);
         if (!isDigit(c)) return false;
    }
// All characters are numbers.
return true;
}

//------------------------------------------------------------------------------------------------

// Returns true if character c is a digit
// (0 .. 9).

function isDigit (c)
{
    return ((c >= "0") && (c <= "9"));
}

//------------------------------------------------------------------------------------------------

function isEmpty(s)
{

var whitespace = new String(" ");

//   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
    {
      // We have a string with trailing blank(s)...
      var i = s.length - 1;       // Get length of string
      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }




    return ((s == null) || (s.length == 0))
}
//------------------------------------------------------------------------------------------------

function isFloat (s)

{
    var i;
    var decimalPointDelimiter = "."
	var decimalPointDelimiter2 = ","
    var seenDecimalPoint = false;

   if (isEmpty(s)) 
       if (isFloat.arguments.length == 1) return false;
      else return (isFloat.arguments[1] == true);

  if ((s == decimalPointDelimiter)||(s == decimalPointDelimiter2)) return false;
//   if (s == decimalPointDelimiter) return false;

   // Search through string's characters one by one
   // until we find a non-numeric character.
   // When we do, return false; if we don't, return true.

   for (i = 0; i < s.length; i++)
   {   
        // Check that current character is number.
       var c = s.charAt(i);

  //     if ( (c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;
    if ( ((c == decimalPointDelimiter) || (c == decimalPointDelimiter2)) && !seenDecimalPoint) seenDecimalPoint = true;
       else if (!isDigit(c)) return false;
   }

   // All characters are numbers.
   return true;
}

//------------------------------------------------------------------------------------------------

// isNegativeInteger (STRING s [, BOOLEAN emptyOK])
// 
// Returns true if string s is an integer < 0.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isNegativeInteger (s)
{   var secondArg = defaultEmptyOK;

   if (isNegativeInteger.arguments.length > 1)
       secondArg = isNegativeInteger.arguments[1];

   // The next line is a bit byzantine.  What it means is:
   // a) s must be a signed integer, AND
   // b) one of the following must be true:
   //    i)  s is empty and we are supposed to return true for
   //        empty strings
   //    ii) this is a negative, not positive, number

   return (isSignedInteger(s, secondArg)
        && ( (isEmpty(s) && secondArg)  || (parseInt (s) < 0) ) );

}

//------------------------------------------------------------------------------------------------

// isIntegerInRange (STRING s, INTEGER a, INTEGER b [, BOOLEAN emptyOK])
// 
// isIntegerInRange returns true if string s is an integer 
// within the range of integer arguments a and b, inclusive.
// 
// For explanation of optional argument emptyOK,
// see comments of function isInteger.


function isIntegerInRange (s, a, b)
{   if (isEmpty(s)) 
       if (isIntegerInRange.arguments.length == 1) return defaultEmptyOK;
      else return (isIntegerInRange.arguments[1] == true);

   // Catch non-integer strings to avoid creating a NaN below,
   // which isn't available on JavaScript 1.0 for Windows.
   if (!isInteger(s, false)) return false;

   // Now, explicitly change the type to integer via parseInt
   // so that the comparison code below will work both on 
    // JavaScript 1.2 (which typechecks in equality comparisons)
   // and JavaScript 1.1 and before (which doesn't).
   var num = parseInt (s);
   return ((num >= a) && (num <= b));
}

//------------------------------------------------------------------------------------------------

// isSignedFloat (STRING s [, BOOLEAN emptyOK])
// 
// True if string s is a signed or unsigned floating point 
// (real) number. First character is allowed to be + or -.
//
// Also returns true for unsigned integers. If you wish
// to distinguish between integers and floating point numbers,
// first call isSignedInteger, then call isSignedFloat.
//

// Does not accept exponential notation.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isSignedFloat (s)

{   if (isEmpty(s)) 
       if (isSignedFloat.arguments.length == 1) return defaultEmptyOK;
      else return (isSignedFloat.arguments[1] == true);

   else {
       var startPos = 0;
       var secondArg = defaultEmptyOK;

       if (isSignedFloat.arguments.length > 1)
           secondArg = isSignedFloat.arguments[1];

       // skip leading + or -
       if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
          startPos = 1;    
       return (isFloat(s.substring(startPos, s.length), secondArg))
   }
}
//------------------------------------------------------------------------------------------------

// removes all spaces from a string

function trim (s)
{
    var iLen = s.length;
    var sOut = "";
    var chr = "";

    for (var i=0; i<iLen; i++)
    {
         chr = s.charAt (i); 
          if (chr!=" ")
         {
              sOut = sOut + chr; 
          }
    }
    return sOut;
}



//------------------------------------------------------------------------------------------------

function isAlphaNumeric(s)
{
  var validChars = "abcdefghijklmnopqrstuvwxyz0123456789";
  s = s.toLowerCase();
  
   for (var i = 0; i < s.length; i++) 
   {
     if (validChars.indexOf(s.charAt(i)) == -1)
     return false;
  }
  return true; 
  }
  
//---------------------------------------------------------------------------------------------------

function VerifeMail(adresse)
	{
	//adresse = document.form1.zugemail.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{
		return true;
		}
	else
		{
		return false;
		}
	}

function trim(str)
{ 
	while (str.substring(str.length-1,str.length)==' ')
	str = str.substring(0, str.length-1);

	while (str.substring(1,0)==' ')
	str = str.substring(1,str.length);

	return str;
}
function nachoben()
{
	//window.scrollTo(0,0); // nach oben - nur für IE
	document.body.scrollTop = 0; // nach oben - funktioniert überall außer NN4.x
	//document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight; // nach unten - funktioniert überall außer NN4.x
}

function VerifeSuchFeld(event)
{
	if (event.keyCode==13)
	{
		SucheChk();
		return false;
	}
	
}

function SucheChk()
{
	var feld, sstr
	
		feld=document.suchform.suchen;
		sstr=feld.value;
		sstr=trim(sstr);

		if ((isEmpty(sstr)==true) || (sstr.length<3))
		{
    		alert("Sie sollen mindestens drei Buchstaben eingeben.");
    		feld.focus();
			return false;
		}
		else 
		{
			document.suchform.submit();
		}
}

function nWin(trg,param)
 { //v3.0
  var newWindow, trg, param
  newWindow = window.open(trg,"subWind", param);
  newWindow.focus();
}
function enableActiveX (containerID)
// Use it, improve it
// by Dirk Alban Adler // KLITSCHE.DE
{
	// No IE = no need to enable
    if (getInternetExplorerVersion () != -1)
    {
        // Get container
        var container = document.getElementById (containerID);
        // Get html in noscript 
        var html = container.innerHTML; 
        // Write html back to container
        container.innerHTML = html;
    }
}
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// Found at: 
// http://msdn.microsoft.com/workshop/author/dhtml/overview/browserdetection.asp
{
    var rv = -1; // Return value assumes failure
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        var ua = navigator.userAgent;
        var re  = new RegExp ("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec (ua) != null)
        {
        	rv = parseFloat (RegExp.$1);
        }
    }
    return rv;
}
function checkSearch(Org, Lan) {
	Cat		=	document.getElementById( 'searchcat' ).value;
	Form	=	document.getElementById( 'searchForm' );
	Form.action	=	"default.asp?oid=" + Org + "&lid=" + Lan + "&navid=" + Cat;
	Form.submit();
	
}

  	function displayCorrect() {
		correctBorder( "NAVTD", "NAVBORDER" );
		correctBorder( "NAVTD02", "NAVBORDER02" );
		correctBorder( "NAVTD03", "NAVBORDER03" );
	}
	
	var TempHeight	=	0;

	function correctBorder( ID, Border ) {
		if( ( td = document.getElementById( ID ) ) && ( border = document.getElementsByName( Border ) ) ) {
			Height	=	parseInt( td.offsetHeight ) - 14;
			if( ID == "NAVTD02" ) {
				TempHeight	=	parseInt( border[ 0 ].style.height );
			}
			border[ 0 ].style.height	=	Height + "px";
			border[ 1 ].style.height	=	Height + "px";
		}
	}
	
	function recorrectBorder( ID, Border ) {
		if( ( td = document.getElementById( ID ) ) && ( border = document.getElementsByName( Border ) ) ) {
			Height	=	TempHeight;
			if( isNaN( Height )  ) {
				Height	=	parseInt( td.offsetHeight ) - 14;
			}
			border[ 0 ].style.height	=	Height + "px";
			border[ 1 ].style.height	=	Height + "px";
		}
	}
	
	// Zoom Div anzeigen, bzw. ausblenden
	function showZoom( id ) {
		div	=	document.getElementById( 'zoom' + id );
		if( div.style.display == "block" ) {
			div.style.display = "none";
		}
		else {
			div.style.display = "block";
		}
	}

	// Listeneintrag - Content ausblenden, Überschrift und Kurztext einblenden
	function TableAusblenden(table,headline,kurz)
	{
	document.getElementById(table).style.display = 'none';
	document.getElementById(kurz).style.display = 'block';
	document.getElementById(headline).onclick=function(){TableEinblenden(table,headline,kurz);};
	document.getElementById(headline).className='inact';
	recorrectBorder( "NAVTD02", "NAVBORDER02" );
	}
	// Listeneintrag - Content einblenden, Überschrift und Kurztext ausbleneden
	function TableEinblenden(table,headline,kurz)
	{
	alleAusblenden();
	document.getElementById(table).style.display = 'block';
	document.getElementById(kurz).style.display = 'none';
	document.getElementById(headline).onclick=function(){TableAusblenden(table,headline,kurz);};
	document.getElementById(headline).className='act';
	displayCorrect();
	}
	
	function alleAusblenden() {
		Counter = 0;
		while( ( d1 = document.getElementById( "content" + Counter ) ) && ( d2 = document.getElementById( "head" + Counter ) ) && ( d3 = document.getElementById( "short" + Counter ) ) ) {
			TableAusblenden( d1.id, d2.id, d3.id );
			Counter++;
		}
	}

function DocDetailOnOff (url)
{
document.location.href = url;
//document.body.scrollTop = document.body.scrollHeight - document.body.clientHeight;
}

function DCDownload(url, lan)
{
			var height = 100
			var iLeft = 0;
			//alert(iLeft);
			var iTop  = 0 ;
			var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
			sOptions += ",width=" + '200' ;
			sOptions += ",height=" + height ;
			sOptions += ",left=" + iLeft ;
			sOptions += ",top=" + iTop ;
			document.location.href = url + lan;
		//	var PopUpFenster = window.open(url, 'DCDownload', sOptions ) ;
		//	PopUpFenster.opener = self;
}

function DCDocDownload(url, lan)
{
			var height = 100
			var iLeft = 0;
			//alert(iLeft);
			var iTop  = 0 ;
			var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
			sOptions += ",width=" + '200' ;
			sOptions += ",height=" + height ;
			sOptions += ",left=" + iLeft ;
			sOptions += ",top=" + iTop ;
			document.location.href = url + lan;
		//	var PopUpFenster = window.open(url, 'DCDownload', sOptions ) ;
		//	PopUpFenster.opener = self;
}

// Formularchecker auch gleich mit rein
function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var mailfailure = false;
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; feld = val; if ((val=val.value)!="") {
	  feld.style.backgroundColor = '';
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) { errors+='- '+nm+' must contain an e-mail address.\n'; mailfailure = true; feld.style.backgroundColor = '#FF3333'; }
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') { errors += '- '+nm+' is required.\n'; feld.style.backgroundColor = '#FF3333'; } }
  } if (errors!='') { if( mailfailure ) { alert(FormFailure+"\n"+EmailFailure); } else { alert(FormFailure); } }
  document.MM_returnValue = (errors == '');
}
// --- Flash aktivieren ----------------------------------------------------------------------------------
function enableActiveX (containerID)
// Use it, improve it
// by Dirk Alban Adler // KLITSCHE.DE
{
	// No IE = no need to enable
    if (getInternetExplorerVersion () != -1)
    {
        // Get container
        var container = document.getElementById (containerID);
        // Get html in noscript 
        var html = container.innerHTML; 
        // Write html back to container
        container.innerHTML = html;
    }
}
function getInternetExplorerVersion()
// Returns the version of Internet Explorer or a -1
// Found at: 
// http://msdn.microsoft.com/workshop/author/dhtml/overview/browserdetection.asp
{
    var rv = -1; // Return value assumes failure
    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        var ua = navigator.userAgent;
        var re  = new RegExp ("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec (ua) != null)
        {
        	rv = parseFloat (RegExp.$1);
        }
    }
    return rv;
}
var PrintContent	=	"";
// Öffnet eine Seite zum Druck und aktiviert den Druck dort auch sofort
function getPrint() {
	try {
		PrintWin.close();
	}
	catch( e ) { }
	var	PrintWin	=	window.open( "/druckversion.asp", "", "width=610,height=400,resizable=no,menubar=no,status=no" );
	if( Div = document.getElementById( "MIDDLE" ) ) {
		PrintContent	=	Div.innerHTML;
	}
}
function getPrintContent() {
	return	PrintContent;	
}
function get( ID ) {
	return document.getElementById( ID );	
}




AktBild = 1;
function BildVor( Ebene, AnzahlBilder )
{
	AktTagId = Ebene+''+AktBild;
	if( AnzahlBilder > AktBild )
	{
		Next_TagId = Ebene+''+(AktBild+1);
		AktBild = AktBild+1;
	}
	else
	{
		Next_TagId = Ebene+'1';
		AktBild = 1;
	}
	get(AktTagId).style.display = "none";
	get(Next_TagId).style.display = "block";
	// manche Bilder oder blöcke sind zu groß - falls dies so ist, 
	// muss die höhe des divs "andere" entsprechend angepasst werden - 
	// weil alles position absolute hat würde es sich sonst gegenseitig 
	// überlagern mit dem text, der drunter kommt
	next = get(Next_TagId);
	if( drumrum = get( "galeriediv" ) ) {
		if( drumrum.offsetHeight < next.offsetHeight ) {
			drumrum.style.height	=	next.offsetHeight + "px";	
		}
	}
}

function BildZurueck( Ebene, AnzahlBilder )
{
	AktTagId = Ebene+''+AktBild;
	if( 1 < AktBild )
	{
		Next_TagId = Ebene+''+(AktBild-1);
		AktBild = AktBild-1;
	}
	else
	{
		Next_TagId = Ebene+''+AnzahlBilder;
		AktBild = AnzahlBilder;
	}
	get(AktTagId).style.display = "none";
	get(Next_TagId).style.display = "block";
}

/* ---------------------------------------------------------------------------- */
/* --- FUNKTION UM CUTEEDITOR IN SEPERATEM FENSTER FÜR BILDUPLOAD ZU ÖFFNEN --- */
/* ---------------------------------------------------------------------------- */

/*
Funktion geht sowohl im IE als auch im FireFox
Bilder sowie auch die Flash Dateien werden über das Frame "Insert Image" ausge-
wählt. Für Bilder gibt es eine Vorschau. Für die Flash Dateien gibt es keine Vor-
schau.

Editor1.ImageFilters = ".jpg, .jpeg, .gif, .png, .swf" beim erstellen des 
CuteEditor muss diese Zeile hinzugefügt werden
*/

/* ---------------------------------------------------------------------------- */

function callInsertImage(InputFieldId)  
{
	var editor = obj_CuteEditor;

	editor.FocusDocument();  
	_Format(editor, "New"); 
	_Format(editor, "InsertImage");

	InputURL();

	document.getElementById(InputFieldId).setAttribute('autocomplete', 'off');
	document.getElementById(InputFieldId).focus();

	function InputURL()
	{
		var editdoc = editor._frame.contentWindow.document;
		var params = editdoc.getElementsByTagName("img");

		if(params.length>0)  
		{
			//imgs[imgs.length-1].src
			var string = params[0].getAttribute('src');				
			var string_pos;

			string = string.replace("http://", "");
			string_pos = string.indexOf("/");
			string = string.substr(string_pos);

			document.getElementById(InputFieldId).value = string;
		}  
		else
		{
			setTimeout(InputURL,500);
		}
	}
}

/**/

	/*
	Funktion geht sowohl im IE als auch im FireFox
	Bilder sowie auch die Flash Dateien werden über das Frame "Insert Image" ausgewählt. Für Bilder
	gibt es eine Vorschau. Für die Flash Dateien gibt es keine Vorschau.

	Editor1.ImageFilters = ".jpg, .jpeg, .gif, .png, .swf" beim erstellen des CuteEditor muss diese Zeile
	hinzugefügt werden


 var GlbInputFieldId	=	0;
 // die übergebene InputFieldId wird nun global gesetzt, da sie beim Timeout nicht übergeben wird - dadurch kann der FF sie auch wieder aus den globalen Variablen holen.
 // die bisherige InputFieldId bei InputURL wird komplett ignoriert
	function callInsertImage(InputFieldId)  
	{  
		GlbInputFieldId	=	InputFieldId;
		var editor1 = document.getElementById('CE_Editor1_ID') )
		editor1.FocusDocument();  
		var editdoc = editor1.GetDocument();  
		editor1.ExecCommand('new');
		editor1.ExecCommand('InsertImage');
		InputURL(InputFieldId);
		// document.getElementById("docFld").focus(); 
		document.getElementById(InputFieldId).setAttribute('autocomplete', 'off');
		document.getElementById(InputFieldId).focus();
	}    
                            
function InputURL(InputFieldId)
{ 
var editor1 = document.getElementById('CE_Editor1_ID');
var editdoc = editor1.GetDocument();  
var params = editdoc.getElementsByTagName("img");

if(params.length>0)  
{
//imgs[imgs.length-1].src
var string = params[0].getAttribute('src');	
var string_pos;

string = string.replace("http://", "");
string_pos = string.indexOf("/");
string = string.substr(string_pos);
// Globale Variable für get Funktion nutzen
document.getElementById(GlbInputFieldId).value = string;
}  
else
{
setTimeout(InputURL,500);
}
}       
*/

onLoad = SetAttrib();

function SetAttrib()
{
	if( div = document.getElementById("obj_LangText_editBox") ) {
		div.style.height = "0";
		div.style.width = "0";
		div.style.border = "0px";
	}
}
/* ---------------------------------------------------------------------------- */


soundaktiv = false;
function makesound() {
  if(soundaktiv || soundsrc=="") {
    document.getElementById("sound").innerHTML="";
	soundaktiv = false;
  }
  else {
    document.getElementById("sound").innerHTML="<noembed></noembed><embed width=0 height=0 src='" + soundsrc + "' loop=false autostart=true mastersound hidden=true pluginspage='http://www.microsoft.com/windows/windowsmedia/player/version64/plugin.aspx'><\/embed>";
	soundaktiv = true;
  }
}