var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4)) ? true : false;
DOM=(!document.layers && !document.all && bV>=4) ? true : false;
KHTML = (navigator.vendor == 'KDE')?true:false; 
KONQUERER = ((navigator.vendor == 'KDE') ||(document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)) && (navigator.vendor != "Apple Computer, Inc." ) ?true:false; 
SAFARI = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName)?true:false; 
OMNI = (document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(navigator.accentColorName)?true:false; 

// alert(navigator.vendor+'\nbV=' + bV +'\nNS4=' + NS4 + '\nIE4=' + IE4 + '\nDOM=' + DOM + '\nKHTML=' + KHTML + '\nKONQUERER=' + KONQUERER + '\nSAFARI=' + SAFARI +'\nOMNI=' + OMNI );

// A hack to guess if the browser supports the DOM
capable = (NS4 || IE4 || DOM || SAFARI) ? true : false;


var active;

function startclose(){
     active = window.setTimeout("closeAll()",1200);
}
function stopclose(){
     if(active){
		window.clearTimeout(active);
	}
}

function expandDiv(el) {
	if (!capable) return;
	closeAll();
	if (IE4 && document.all[eval('el + "Child"')]) {
		document.all[eval('el + "Child"')].style.display = "block";
		document.all[eval('el + "Child"')].style.visibility = "visible";
	} else if(NS4 && eval("document." + el + "Child")) {
		whichEl = eval("document." + el + "Child");
		whichEl.visibility = "show"; 
		whichEl.display = "block";
	} else if(DOM && document.getElementById(el + "Child")) {
		whichEl = document.getElementById(el + "Child");
		whichEl.style.visibility = "visible";
		whichEl.style.display = "block";
	}
} 
 
function expandDiv(el) {
	if (!capable) return;
	closeAll();
	if (IE4 && document.all[eval('el + "Child"')]) {
		document.all[eval('el + "Child"')].style.display = "block";
		document.all[eval('el + "Child"')].style.visibility = "visible";
	} else if(NS4 && eval("document." + el + "Child")) {
		whichEl = eval("document." + el + "Child");
		whichEl.visibility = "show"; 
		whichEl.display = "block";
	} else if(DOM && document.getElementById(el + "Child")) {
		whichEl = document.getElementById(el + "Child");
		whichEl.style.visibility = "visible";
		whichEl.style.display = "block";
	}
}

function getPosition(obj) {
  var pos = { x:0, y:0 };
  do {
    pos.x += obj.offsetLeft;
    pos.y += obj.offsetTop;
  } while (obj = obj.offsetParent);
  return pos;
}
 
function expandIt(el) {
	if (!capable) return;
	closeAll();
	var BILD = document.getElementById(el+'bild');
   	var coords = getPosition(BILD);
 
	
   	
  // alert(coords.x +" - "+coords.y);
   	
   	if (coords){
		var poserX = coords['x'];
		var poserY = coords['y'];
	} 
	
	
	
	MouseY=poserY+20;
	MouseX=poserX;
	// alert(MouseX + " " +MouseY);
	
	if (IE4 && document.all[eval('el + "Child"')]) {
		document.all[eval('el + "Child"')].style.position = "absolute";
		document.all[eval('el + "Child"')].style.top = MouseY+"px";
		document.all[eval('el + "Child"')].style.left = MouseX+"px";
		document.all[eval('el + "Child"')].style.display = "block";
		document.all[eval('el + "Child"')].style.visibility = "visible";
	} else if(NS4 && eval("document." + el + "Child")) {
		whichEl = eval("document." + el + "Child");
		whichEl.position = "absolute";
		whichEl.top = parseInt(MouseY)+"px";
		whichEl.left = parseInt(MouseX)+"px";  
		whichEl.visibility = "show"; 
		whichEl.display = "block";
	} else if(DOM && document.getElementById(el + "Child")) {
		whichEl = document.getElementById(el + "Child");
		whichEl.style.position = "absolute";
		whichEl.style.top = MouseY+"px";
		whichEl.style.left = MouseX+"px";
		whichEl.style.visibility = "visible";
		whichEl.style.display = "block";
	}
}

function closeAll(){
	stopclose();
	if (NS4) {
		for (i=0; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id.indexOf("Child") != -1) {
				whichEl.display = "none";
				whichEl.visibility = "hide";
			}
		}
	} else if(IE4) {
		tempColl = document.all.tags("DIV");
		for (i=0; i<tempColl.length; i++) {
			if (tempColl(i).className == "Child"){
				tempColl(i).style.display = "none";
				tempColl(i).style.visibility = "hidden";
			}
		}
	} else if(DOM) {
		tempColl = document.getElementsByTagName("DIV");
		for (i=0; i<tempColl.length; i++) {
			if (tempColl[i].className == "Child") {
				tempColl[i].style.display = "none";
				tempColl[i].style.visibility = "hidden";
			}
		}
	}
}

function EMail(s)
{
 var a = false;
 var res = false;
 if(typeof(RegExp) == 'function')
 {
  var b = new RegExp('abc');
  if(b.test('abc') == true){a = true;}
  }

 if(a == true)
 {
  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
  res = (reg.test(s));
 }
 else
 {
  res = (s.search('@') >= 1 &&
         s.lastIndexOf('.') > s.search('@') &&
         s.lastIndexOf('.') >= s.length-5)
 }
 return(res);
}

function checkcontact(){
	var error=0;
	var error_msg="Bitte alle Pflichfelder* korrekt ausfuellen !";

	
	if(document.forms.contactform.bemerkung.value==""){
		error=1;
	}
	
	if(document.forms.contactform.vorname.value==""){
		error=1;
	}
	if(document.forms.contactform.nachname.value==""){
		error=1;
	}
	if(document.forms.contactform.plz.value==""){
		error=1;
	}
	
	if(document.forms.contactform.ort.value==""){
		error=1;
	}
	
	if(document.forms.contactform.strasse.value==""){
		error=1;
	}
	
	if(document.forms.contactform.land.value==""){
		error=1;
	}
	
	if(document.forms.contactform.tel.value==""){
		error=1;
	}
	if(document.forms.contactform.mail.value=="" || !EMail(document.forms.contactform.mail.value)){
		error=1;
	}

	if(error==1){
		alert(error_msg);
		return false;
	} else {
		return true;
	}

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

