isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;

function fensterl_weg() {
  if (isN4) document.fensterchen.visibility="hide";
  else document.getElementById("fensterchen").style.visibility="hidden";
  if (isN4) document.fensterchen2.visibility="hide";
  else document.getElementById("fensterchen2").style.visibility="hidden";
}

function verteilung(id,res){
	if (res == 0){
		field ="verteiler";
		filler = "n";
	} else if (res == 1){
		field ="svert";
		filler = "_";
	} else if (res == 2){
		field ="mvert";
		filler = "_";
	} else if (res == 3){
		field ="medium";
		filler = "n";
	} else if (res == 4){
		field ="cvert";
		filler = "_";
	}
	vert_val = document.getElementById(field).value;
	vert_val_new = "";
		for (i=0; i<20; i++){
			
			if(id == i){
				if (vert_val.substr(i,1) == "j"){
					vert_val_new += filler;
				} else {
					vert_val_new += "j";
				}
			} else {
				vert_val_new += vert_val.substr(i,1);
			}
		}
	
	document.getElementById(field).value = vert_val_new;
}

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 i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
//	
//	for (i=1; i<(args.length-2); i+=3) {
//		test=args[i+2]; val=MM_findObj(args[i]);
//		if (val) {
//			nm=val.name;
//			if ((val=val.value)!="") {
//				if (test.indexOf('isEmail')!=-1) {
//					p=val.indexOf('@');
//					if (p<1 || p==(val.length-1)) errors+='- '+nm+' muss eine gültige Mailadresse enthalten.\n';
//				} else if (test=='S') {
//					p=val.indexOf('j');
//					if (p<0) errors+='- Es muss ein Verteiler ausgewählt sein.\n';
//				} else if (test!='R') {
//					num = parseFloat(val);
//					if (isNaN(val)) errors+='- '+nm+' muss eine Zahl enthalten.\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+' muss eine Zahl zwischen '+min+' und '+max+' enthalten.\n';
//					}
//				}
//			} else if (test.charAt(0) == 'R'){
//				errors += '- '+nm+' ist erforderlich.\n';
//			}
//		}
//	}
//	if(args[0] == '0'){
//		if (errors) alert('Folgende Fehler sind aufgetreten:\n'+errors);
//		document.MM_returnValue = (errors == '');
//	} else {
//		if (errors){
//			alert('Folgende Fehler sind aufgetreten:\n'+errors);
//			return 1;
//		}
//		return 0;	
//	}
//}

function MM_validateForm() { //v4.0
  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; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' muss eine gültige Mailadresse enthalten.\n';
	} else if (test=='M') {
		p=val.indexOf('j');
		if (p<0) errors+='- Es muss ein Medium ausgewählt sein.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' muss eine Zahl enthalten.\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+' muss eine Zahl zwischen '+min+' und '+max+' enthalten.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' ist erforderlich.\n'; }
  } if (errors) alert('Folgende Fehler sind aufgetreten:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_validateForm_en() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm_en.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain a valid mailadress.\n';
	} else if (test=='M') {
		p=val.indexOf('j');
		if (p<0) errors+='- You must select a medium.\n';
      } 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'; }
  } if (errors) alert('Following errors occoured:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_openBrWindow(theURL) { //v2.0
//alert(theURL);
  window.open(theURL,'PopWindow','scrollbars=yes,resizable=yes,width=910,height=610');
  }

