// JavaScript Document
function MM_openBrWindow(theURL,winName,features,messe_id) {
	theURL=theURL+"?messe_id="+messe_id;
  window.open(theURL,winName,features);
}

function showServices(){
	window.open("losdetail.php", "_blank", "width=400,height=260,left=0,top=0,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
}

function searchFor(lang){
	//if(document.getElementById("txt_search").value!=""){
	 if(document.getElementById("suchfeld").value!=""){
		if(lang == "de"){
		window.location.href = "/de/suche.php?SEARCH="+document.getElementById("suchfeld").value;
		}
		if(lang == "en"){
		window.location.href = "/search.php?SEARCH="+document.getElementById("suchfeld").value;
		}
	}
	return false;
}

function link(){
var wort = begriff();

var link ="<a href='mailto:?subject=GEA Westfalia Separator - " + wort + "&body=Hallo!%0ABesuchen Sie doch einmal die Website von GEA Westfalia Separator !%0A%0ADiese Seite finde ich besonders interessant: " + window.location.href + "'><img src='http://www.westfalia-separator.com/bilder/weiterempfehlen.gif' width='8' height='7' border='0'> Weiterempfehlen</a>";

return link;
}

// IE Wrapper for CSS dropdwon menu --------------------------------------------
sfHover = function() {
	//alert("sfhover");
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");     
	for (var i=0; i<sfEls.length; i++) {         
		sfEls[i].onmouseover=function() {             
			this.className+=" sfhover"; 
		}         
		sfEls[i].onmouseout=function() {             
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");         
		}     
	} 
}

// menueSwitsh wird auf Seiten gesetzt, die KEIN Menü haben

if(!window.menueSwitch){
	//alert("keinMenue");
	menueSwitch="true";
} 


if (window.attachEvent && menueSwitch=="true") window.attachEvent("onload", sfHover); 

// Funktion umd den Hauptmenüpunkt bei MausOver des Untermenüs trotzdem anzuzeigen

function mainMenueSetIn(layer){
	//alert("set In "+layer);
	document.getElementById(layer).style.color="#01482a";
	document.getElementById(layer).style.backgroundImage="url(images/navmain-ico-hover.gif)";
}

function mainMenueSetOut(layer){
	// Testen, welche Seite gerade angezeigt wird
		
		var aktClass=document.body.className;
		aktClassShort=aktClass.slice(5);
		layerShort=layer.slice(4);

		//alert(aktClassShort + " - " + layerShort);
		
		if(aktClassShort!=layerShort){
			document.getElementById(layer).style.color="#6a8f7d";
			document.getElementById(layer).style.backgroundImage="url(images/navmain-ico-std.gif)";
		}
}


// IE Wrapper for CSS dropdwon menu --------------------------------------------

// Favoriten hinzufügen
 
function addFavoriten(url,titel){
    if (navigator.appName.indexOf("Opera") != -1){
   
     }else if (navigator.appName.indexOf("Explorer") != -1){
         if(window.external){
             window.external.AddFavorite(url,titel);
          } else {
              window.sidebar.addPanel(titel,url,'');
          }
 
     }else{
        window.sidebar.addPanel(titel,url,'');
     }
}

function checkInput_digest(id){
	var check = true;
	if(check==true && document.getElementById("amount"+id).value.Length==0){
		check=false;
	}
	if(check==true && document.getElementById("amount"+id).value.Length==1 && document.getElementById("amount"+id).value.charAt(0)=="0"){
		check=false;
	}
	if(check==true && document.getElementById("amount"+id).value.Length==2 && document.getElementById("amount"+id).value.charAt(0)=="0" && document.getElementById("amount"+id).value.charAt(1)=="0"){
		check=false;
	}
	if(check==true){
		for(i=0; i<document.getElementById("amount"+id).value.Length; i++){
			if(document.getElementById("amount"+id).value.charAt(i) < "0" || document.getElementById("amount"+id).value.charAt(i) > "9"){
				check=false;
			}
		}
	}
	if(check==false){
		alert("Please enter a value between 1 and 99");
	}else{
		window.location.href = "separators-digest-customer-magazine-order.php?DIGEST="+id+"&AMOUNT="+document.getElementById("amount"+id).value;
	}
}

function checkInput_digest_de(id){
	var check = true;
	if(check==true && document.getElementById("amount"+id).value.Length==0){
		check=false;
	}
	if(check==true && document.getElementById("amount"+id).value.Length==1 && document.getElementById("amount"+id).value.charAt(0)=="0"){
		check=false;
	}
	if(check==true && document.getElementById("amount"+id).value.Length==2 && document.getElementById("amount"+id).value.charAt(0)=="0" && document.getElementById("amount"+id).value.charAt(1)=="0"){
		check=false;
	}
	if(check==true){
		for(i=0; i<document.getElementById("amount"+id).value.Length; i++){
			if(document.getElementById("amount"+id).value.charAt(i) < "0" || document.getElementById("amount"+id).value.charAt(i) > "9"){
				check=false;
			}
		}
	}
	if(check==false){
		alert("Please enter a value between 1 and 99");
	}else{
		window.location.href = "separators-digest-kunden-magazin-order.php?DIGEST="+id+"&AMOUNT="+document.getElementById("amount"+id).value;
	}
}



function checkInput_digest_order(){
	var check = true;
	
	for(i=0; i<document.order.elements.length; i++){
		if(document.order.elements[i].name.substring(0, 6)=="amount"){
			if(check==true && document.order.elements[i].value.length==1 && document.order.elements[i].value=="0"){
				check=false;
			}
			if(check==true && document.order.elements[i].value.length==2 && document.order.elements[i].value=="00"){
				check=false;
			}
			if(check==true){
				for(k=0; k<document.order.elements[i].value.length; k++){
					if(document.order.elements[i].value.charAt(k) < "0" || document.order.elements[i].value.charAt(k) > "9"){
						check=false;
					}
				}
			}
			if(check==false){
				break;
			}
		}
	}
	if(check==false){
		alert("Please enter nothing or a value between 1 and 99");
	}else{
		checkFill_digest();
	}
}

function checkFill_digest(){
	var check = true;
	if(document.order.vorname.value==""){
		check=false;
	}
	if(document.order.name.value==""){
		check=false;
	}
	if(document.order.street.value==""){
		check=false;
	}
	if(document.order.zip.value==""){
		check=false;
	}
	if(document.order.city.value==""){
		check=false;
	}
	if(document.order.country.value==""){
		check=false;
	}
	if(document.order.email.value==""){
		check=false;
	}
	
	if(check==false){
		alert("Please fill out all fields marked with an *.");
	}else{
		// hier noch absenden
		document.order.submit();
	}
}

<!-- Checkfuntion für messe anmeldungen -->
function checkFill(){
	var filled=true;
	var dated=true;
	var timed=true;
	var tmp="";
	var fd, fm, fy, td, tm, ty, ad, am, ay; // from/to/actual day/month/year
	
	if(document.getElementById("date").value==""){
		filled=false;
	}
	if(document.getElementById("name").value==""){
		filled=false;
	}
	if(document.getElementById("street").value==""){
		filled=false;
	}
	if(document.getElementById("city").value==""){
		filled=false;
	}
	if(document.getElementById("country").value==""){
		filled=false;
	}
	if(document.getElementById("mail").value==""){
		filled=false;
	}
	
	if(filled==true){
		if(document.getElementById("vtime").value.search(/^\d\d\:\d\d$/)==-1){
			timed=false;
		}else{
			var vhours = document.getElementById("vtime").value.substring(0,2);
			var vminutes = document.getElementById("vtime").value.substring(3,5);
			vhours=((vhours.charCodeAt(0)-48)*10)+(vhours.charCodeAt(1)-48);
			vminutes=((vminutes.charCodeAt(0)-48)*10)+(vminutes.charCodeAt(1)-48);
			if(!(vhours>=0 && vhours<=23 && vminutes>=0 && vminutes<=59)){
				timed=false;
			}
		}
		
		if(timed==true){
			if(document.getElementById("date").value.search(/^\d\d\.\d\d\.\d\d\d\d$/)==-1){
				dated=false;
			}
			if(dated==true && checkIsDate(document.getElementById("date").value)==false){
				dated=false;
			}
			if(dated==true){
				tmp=document.getElementById("from").value;
				fd=tmp.substring(0,2);
				fd=((fd.charCodeAt(0)-48)*10)+(fd.charCodeAt(1)-48);
				fm=tmp.substring(3,5);
				fm=((fm.charCodeAt(0)-48)*10)+(fm.charCodeAt(1)-48);
				fy=tmp.substring(6,10);
				fy=((fy.charCodeAt(0)-48)*1000)+((fy.charCodeAt(1)-48)*100)+((fy.charCodeAt(2)-48)*10)+(fy.charCodeAt(3)-48);
				tmp=document.getElementById("till").value;
				td=tmp.substring(0,2);
				td=((td.charCodeAt(0)-48)*10)+(td.charCodeAt(1)-48);
				tm=tmp.substring(3,5);
				tm=((tm.charCodeAt(0)-48)*10)+(tm.charCodeAt(1)-48);
				ty=tmp.substring(6,10);
				ty=((ty.charCodeAt(0)-48)*1000)+((ty.charCodeAt(1)-48)*100)+((ty.charCodeAt(2)-48)*10)+(ty.charCodeAt(3)-48);
				tmp=document.getElementById("date").value;
				ad=tmp.substring(0,2);
				ad=((ad.charCodeAt(0)-48)*10)+(ad.charCodeAt(1)-48);
				am=tmp.substring(3,5);
				am=((am.charCodeAt(0)-48)*10)+(am.charCodeAt(1)-48);
				ay=tmp.substring(6,10);
				ay=((ay.charCodeAt(0)-48)*1000)+((ay.charCodeAt(1)-48)*100)+((ay.charCodeAt(2)-48)*10)+(ay.charCodeAt(3)-48);
				
				var edited=am+1;
				fromDate = new Date(fy, fm-1, fd);
				tillDate = new Date(ty, tm-1, td);
				actDate = new Date(ay, am-1, ad);
				
				if(actDate>=fromDate && actDate<=tillDate){
					// absenden
					document.appointment.submit();
				}else{
					alert("Please choose date between start- and enddate.");
				}
			}else{
				alert("Please enter date like: dd.mm.yyyy");
			}
		}else{
			alert("Please enter time like: hh:mm (00:00 to 23:59)");
		}
	}else{
			alert("Please fill out all fields marked with an *.");
	}
}

function checkIsDate(datum){
	tag=datum.slice(0, 2);
	monat=datum.slice(3, 5);
	jahr=datum.slice(6);

	if(jahr.search(/20[0-9][0-9]/)==-1){
		return false;
	}
	
	switch(monat){
		case "01":
		case "03":
		case "05":
		case "07":
		case "08":
		case "10":
		case "12":
			if((tag.search(/[012][0-9]/)!=-1 || tag=="30" || tag=="31") && tag!="00"){
				return true;	
			}else{
				return false;
			}
			break;
		case "04":
		case "06":
		case "09":
		case "11":
			if((tag.search(/[012][0-9]/)!=-1 || tag=="30") && tag!="00"){
				return true;	
			}else{
				return false;
			}
			break;
		case "02":
			if((tag.search(/[012][0-9]/)!=-1) && tag!="00"){
				return true;	
			}else{
				return false;
			}
			break;
		default:
			return false;
			break;
	}
}


<!-- Diese Funktionen sind fuer automatische Begriffe und die extras.php wichtig -->
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function flow(){
}

function MM_sHL() { //v9.0
  var i,p,v,obj,args=MM_sHL.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}



<!-- Checkfuntion für messe anmeldungen -->

function validEmail(email) {
  var strReg = "^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
  var regex = new RegExp(strReg);
  return(regex.test(email));
}

function check_empty(text) { 
return (text.length > 0); // returns false if empty 
} 

function checkFillOutBuyback(lang){
	var filled=true;

	if(!check_empty(document.buyback.manu.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.model.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.frame.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.bowl.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.comp.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.name.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.phone.value)){
		filled=false;
	}
	if(!check_empty(document.buyback.email.value)){
		filled=false;
	}else{
		if (validEmail(document.buyback.email.value)){
		}else{
			filled=false;
		}}
	
	if(filled==true){
		document.buyback.submit();
	}else{
		if (lang == "en"){
			alert("Please fill out all fields marked with an * correctly.");
		}else{
			alert("bitte füllen Sie die, mit * gekennzeichneten Felder, korrekt aus.");
		}
	}
}


