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;

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

function openUp(el) {
	if (!capable) return;
	closeAll();
	
	if(DOM) {
		whichEl = document.getElementById(el);
		whichEl.className='open';
	} else if (IE4) {
		document.all[eval('el')].style.top = MouseY+"px";
		document.all[eval('el')].className='open';
	} else if(NS4) {
		whichEl = eval("document." + el);
		whichEl.className='open';
	} 
}

function closeAll(){
  closeAllByName("open");
}

function closeAllByName(name){
	if(DOM) {
		tempColl = document.getElementsByTagName("UL");
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl[i];
			if (whichEl.className == name){
				whichEl.className='close';
			}
		}
	} else if (NS4) {
		for (i=0; i<document.layers.length; i++) {
			whichEl = document.layers[i];
			if (whichEl.id.toLowerCase().indexOf(name) != -1) {
				whichEl.className='close';
			}
		}
	} else if(IE4) {
		tempColl = document.all.tags("UL");
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl(i);
			if (whichEl.className == name){
				whichEl.className='close';
			}
		}
	} 
}

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

function validatecareer() {
	if(document.karriere.name_komplett.value == '' || document.karriere.inputemail.value == '') { 
		alert("Sie haben vergessen ein Pflichtfeld auszufüllen.");
		document.validatecareer_returnValue = false;
	} else { 
		document.validatecareer_returnValue = true; 
	}
}

function validatecontact() {
	if(document.kontakt.name_komplett.value == '' || document.kontakt.inputemail.value == '') { 
		alert("Sie haben vergessen ein Pflichtfeld auszufüllen.");
		document.validatecontact_returnValue = false;
		if (document.kontakt.name_komplett.value == '') {
			document.kontakt.name_komplett.focus();
		} else if (document.kontakt.inputemail.value == '') {
			document.kontakt.inputemail.focus();
		}
		return;
	} else {
		document.validatecontact_returnValue = true; 
	}

	if (!document.kontakt.method[0].checked && !document.kontakt.method[1].checked && !document.kontakt.method[2].checked) {
		alert("Bitte geben Sie an, wie wir Sie kontaktieren dürfen.");
		document.kontakt.method[0].focus();
		document.validatecontact_returnValue = false;
		return;
	}

	if (document.kontakt.method[0].value == 'E-Mail' && document.kontakt.method[0].checked) {
  		if(document.kontakt.inputemail.value == '') { 
			alert("Sie haben um Erstkontakt per E-Mail gegeben und keine E-Mail Adresse angegeben.");
			document.kontakt.inputemail.focus();
			document.validatecontact_returnValue = false;
		} else {
			document.validatecontact_returnValue = true; 
		}
	}

	if (document.kontakt.method[1].value == 'Telefon' && document.kontakt.method[1].checked) {
		if(document.kontakt.telefon.value == '' && document.kontakt.mobiltelefon.value == '') { 
			alert("Sie haben um Erstkontakt per Telefon gegeben und keine Telefonnummer oder Handynummer angegeben.");
			document.validatecontact_returnValue = false;
			if (document.kontakt.telefon.value == '') {
				document.kontakt.telefon.focus();
			} else if (document.kontakt.mobiltelefon.value == '') {
				document.kontakt.mobiltelefon.focus();
			}
		} else {
			document.validatecontact_returnValue = true; 
		}
	}
	
	if (document.kontakt.method[2].value == 'Post' && document.kontakt.method[2].checked) {
		if(document.kontakt.strasse.value == '' || document.kontakt.plzort.value == '') { 
			alert("Sie haben um Erstkontakt per Post gegeben und keine Straße oder PLZ/Ort angegeben.");
			document.validatecontact_returnValue = false;
			if (document.kontakt.strasse.value == '') {
				document.kontakt.strasse.focus();
			} else if (document.kontakt.plzort.value == '') {
				document.kontakt.plzort.focus();
			}
		} else {
			document.validatecontact_returnValue = true; 
		}
	}
}