var now = new Date();
var newwindow;
var message = "test";



function GotoPage(peng, pger)
{
if (IsGerman()) 
{
if (pger.length > 0)
{
location.href=pger;
}
}
else
{
if (peng.length > 0)
{
location.href=peng; 
}
}
}


function IsGerman()
{
try
{
if (navigator.appName == 'Netscape')
{
var language = navigator.language;
}
else
{
var language = navigator.browserLanguage;
}
if (language.indexOf('de') > -1) 
{
return true;
}
return false;
}
catch(e) {return false;}
}

function Schreiben(n,w,e)
{
 var a = new Date();
 a = new Date(a.getTime() +e);
 document.cookie = n+'='+w+'; expires='+a.toGMTString()+';';
}

function Lesen(n)
{
 a = document.cookie;
 res = '';
 while(a != '')
 {
  while(a.substr(0,1) == ' '){a = a.substr(1,a.length);}
  cookiename = a.substring(0,a.indexOf('='));
  if(a.indexOf(';') != -1)
  {cookiewert = a.substring(a.indexOf('=')+1,a.indexOf(';'));}
  else{cookiewert = a.substr(a.indexOf('=')+1,a.length);}
  if(n == cookiename){res = cookiewert;}
  i = a.indexOf(';')+1;
  if(i == 0){i = a.length}
  a = a.substring(i,a.length);
 }
return(res)
}

function Loeschen(n)
{
 document.cookie = n+'=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
} 


if(parent.location.href==self.location.href)
{
if (Lesen('blind') != 'ok')
{
//top.location.replace ('http://www.lormer.com')
}
};


function closewin()
{
try{
newwindow.close();
}
catch(e) {}
}

function poptastic(url)
{
	newwindow=window.open(url,'name','height=219,width=275');
	if (window.focus) {newwindow.focus()}
}

// ----------------------------------------------------------------------------------------


function gMon() {
  this[0] = 'Januar';
  this[1] = 'Februar';
  this[2] = 'M&auml;rz';
  this[3] = 'April';
  this[4] = 'Mai';
  this[5] = 'Juni';
  this[6] = 'Juli';
  this[7] = 'August';
  this[8] = 'September';
  this[9] = 'Oktober';
  this[10] = 'November';
  this[11] = 'Dezember';
}


var monNames = new Array('Januar', 'Februar', 'M&auml;rz',
                         'April', 'Mai', 'Juni',
                         'Juli', 'August', 'September',
                         'Oktober', 'November', 'Dezember');
var monNames = new gMon();


var dayNames = new Array('Sonntag', 'Montag', 'Dienstag', 'Mittwoch',
                         'Donnerstag', 'Freitag', 'Samstag');

function t4(y) {
  return (y < 1000 ? y+1900 : y);
}



// ----------------------------------------------------------------------------------------


function MyDictionary() { 
    this.obj = new Object(); 
    this.Count = 0; 


    function MyDictionary_Add(key, value) { 
        if (this.obj[key] != null) return null; 
        this.obj[key] = value; 
        this.Count++; 
        return this.value; 
    } 


    function MyDictionary_Exists(key) { 
        return (this.obj[key] != null); 
    } 


    function MyDictionary_Remove(key) { 
        if (this.obj[key] == null) return null; 
        this.obj[key] = null; 
        Count--; 
        return this.key; 
    } 


    this.Add = MyDictionary_Add; 
    this.Exists = MyDictionary_Exists; 
    this.Remove = MyDictionary_Remove; 
   
} 


// ----------------------------------------------------------------------------------------
function click(evt){if (navigator.appName.indexOf("Microsoft") != -1){ if (event.button==2){copyright()}; }; if (navigator.appName.indexOf("Netscape") != -1) { if ( evt.which == 3 ){ alert('© Copyright 2009 by Thomas Rupp'); return false }; }; }; if (navigator.appName.indexOf("Netscape") != -1) { document.captureEvents( Event.MOUSEDOWN ) };document.onmousedown = click; 



function copyright()
{
try{
if (document.activeElement.type = 'undefined')
{
alert('© Copyright 2009 by Thomas Rupp'); 
return false;
}
}
catch(e) {}

}


function zu()
{
   parent.close();

}

// ----------------------------------------------------------------------------------------
function drucken()
{
try{ 
parent.frames['Hauptframe'].focus();
parent.frames['Hauptframe'].print();
}
catch(e) {
alert('Error can not print - Fehler es kann nicht gedruckt werden');
}
}

// ----------------------------------------------------------------------------------------

function printit()
{
try{
neu.parent.frames['Mitte'].print();
}
catch(e) {
alert('Error can not print - Fehler es kann nicht gedruckt werden');
}
}

// ----------------------------------------------------------------------------------------
function istEmail(feld) {
// werden regular expressions unterstuetzt?
var supported = 0;
if (window.RegExp) {
var tempStr = "a";
var tempReg = new RegExp(tempStr);
if (tempReg.test(tempStr)) supported = 1;
}
if (!supported)
return (feld.indexOf(".") > 2) && (feld.indexOf("@") > 0);
var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
var r2 =
   new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$");
return (!r1.test(feld) && r2.test(feld));
}

// -----------------------------------------------------------------------------------------
function trim(inputString) {
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function


// ----------------------------------------------------------------------------------------
function addHTML (html) {
  if (document.all)
    document.body.insertAdjacentHTML('beforeEnd', html);
  else if (document.createRange) {
    var range = document.createRange();
    range.setStartAfter(document.body.lastChild);
    var docFrag = range.createContextualFragment(html);
    document.body.appendChild(docFrag);
  }
  else if (document.layers) {
    var l = new Layer(window.innerWidth);
    l.document.open();
    l.document.write(html);
    l.document.close();
    l.top = document.height;
    document.height += l.document.height;
    l.visibility = 'show';
  }
}

// ----------------------------------------------------------------------------------------

function disableForm(theform) {
if (document.all || document.getElementById) {
for (i = 0; i < theform.length; i++) {
var tempobj = theform.elements[i];
if (tempobj.type.toLowerCase() == "submit" || tempobj.type.toLowerCase() == "reset")
tempobj.disabled = true;
}
setTimeout('alert("Ihre Nachricht wurde gesendet - bitte warten Sie einen Augenblick nicht zweimal drücken . /n/n/n Your form has been submitted.  Notice how the submit and reset buttons were disabled upon submission.")', 2000);
return true;
}
else {
alert("Ihre Nachricht wurde gesendet - bitte warten Sie einen Augenblick nicht zweimal drücken . /n/n/n The form has been submitted.  But, since you're not using IE 4+ or NS 6, the submit button was not disabled on form submission.");
return false;
   }
}
// ----------------------------------------------------------------------------------------	

function Checkfeld(feld,dofocus) 
{
		if (feld.type == "submit")
		{
		return true;
		}

		name  = feld.name.toUpperCase();
		
		value = trim(feld.value);	
		feld.value = value;
		ok = true;
		
		feld.style.backgroundColor  = "";
					
			
			if (name != "EMAIL")
			{
			if (value == "")			
				if (name.substr(0,1) == "_")
				{									
					message = message + " " + name + "\n\n";
					feld.style.backgroundColor = "red";	
					if (dofocus)
					{
					feld.focus();	
					}
					ok = false;	
				}
				}
			else{
				if (!istEmail(value))
				{
					message = message + " " + name + " bitte korregieren !\n\n";
					feld.style.backgroundColor  = "red";
					if (dofocus)
					{
					feld.focus();	
					}	
					ok = false;	
					
				}	
			}
return ok;
}
// ----------------------------------------------------------------------------------------	
function CheckAllFeld(dofocus)
{
	voll = true;
	anzahlFelder=window.document.forms(0).length-1;
	
	for(n=0; n < anzahlFelder; n++) 
	{		
	feld = window.document.forms(0).elements[n];
		if (!Checkfeld(feld,dofocus))
		{			
			voll = false;
		} 
	}	
	return voll;	
}

// ----------------------------------------------------------------------------------------	

	
function send() {	
	message = "Bitte füllen Sie folgende Felder aus:\n\n";
	
	voll = CheckAllFeld(true);
	
	if(!voll) 
	alert(message);
	if(voll)
		addHTML("<p align=\"center\"><font color=\"#FF0000\">&nbsp;Bitte warten / please wait...</font></p>");
	return voll;
}

// ----------------------------------------------------------------------------------------


