//allgemeine variable


function MM_openBrWindow(theURL,winName,features) { 
window.open(theURL,winName,features);
}
function MM_openBrWindow1(theURL,winName,features) { 
fenster=window.open(theURL,winName,features);
fenster.focus();
}


function checkMail(entry){
 var val = entry.value + "";
  val = val.replace(/ */, "");
if (val.indexOf('@') != -1) { return true; }
entry.focus();
entry.select();
alert("Die eingegebene Mailadresse ist ungültig !");
return false;
}

function checkText(entry) {
  var val = entry.value + "";
  val = val.replace(/ */, "");
  if (val.length > 0)  { return true; }
  entry.focus();
  entry.select();
  alert("Dieses Feld darf nicht leer sein.");
  return false;
}

function checkAnzahl(entry) {
  var val = entry.value + "";         
  var maxDecimalPlaces; 
  if (entry.form[entry.name+"_decimalPlaces"] == null) { 
    maxDecimalPlaces = 0; 
  } else { 
    maxDecimalPlaces = parseInt(eval(entry.form[entry.name+"_decimalPlaces"].value));
  }
  var newVal = ""; 
  var decimalPoint=false;
  var decimalPlaces=0;
  var thousandFoundIndex = -1;
  var dotFoundIndex = -1;
  var invalidNumber = false;
  if (val.length == 1 && val.substring(0,1) =="-") {      
    invalidNumber = true;
  }
  for (var i=0;i<val.length;i++)   {      
    letter=val.substring(i,i+1);          
    if ( ((letter<"0" || "9"<letter)&&(letter!=",")&&(letter!="-") && (letter!="."))
         || ((letter==",")&&(decimalPoint==true)) ) {
      entry.focus();
      entry.select();
      alert("Bitte nur Zahlen eingeben!");
      return false;
    }
    if ((decimalPoint==true)&&(letter!="-")) { decimalPlaces++; }
    if (decimalPlaces>maxDecimalPlaces && letter!="0") {
      entry.focus();
      entry.select();
      alert("Maximal erlaubte Dezimalstellen: " +maxDecimalPlaces);
      return false;
    }
    if ((letter=="-") && i!=0) {
      entry.focus();
      entry.select();
      alert("Ungültige Zahl");
      return false;
    }
    if (letter==",") { decimalPoint=true; }
    if (letter==".") {
      if (dotFoundIndex >= 0) {
        invalidNumber = true;
      } else {
        thousandFoundIndex = i;
      }
    }
    if (letter==",") {
      dotFoundIndex = i;
    }
    if (dotFoundIndex == i && i == (val.length - 1))  {
      invalidNumber = true;
    }
    if (thousandFoundIndex >= 0 && dotFoundIndex == i && ((dotFoundIndex - thousandFoundIndex) != 4))  {
      invalidNumber = true;
    }
    if (thousandFoundIndex >= 0 && dotFoundIndex < 0 && (i == val.length - 1) && (i - thousandFoundIndex != 3 )){
      invalidNumber = true;
    }
    newVal = newVal + letter;
  }
  entry.value = newVal;
  if (invalidNumber) {
    alert("Ungültige Zahl");
    entry.focus();
    entry.select();
    return false;
  }
  return true;
}

function createXMLHttpRequest() {
var ua;
if(window.XMLHttpRequest) {
    try {
      ua = new XMLHttpRequest();
    } catch(e) {
      ua = false;
    }
  } else if(window.ActiveXObject) {
    try {
      ua = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
      ua = false;
    }
  }
  return ua;
}




function open_foto(pname,bild,titel,param){
dhtmlwindow.open(pname, 'inline', '<img src="'+bild+'">', titel, param, 'recal');
}	


function chngFrame(dropdown) {
	var index = dropdown.selectedIndex;
	var chosen = dropdown.options[index].value;
	if (index > 0){	
		Fenster1 = window.open(chosen);
		//Fenster1 = window.open(Adresse, "Zweitfenster", "width=300,height=400,left=100,top=200");
  		Fenster1.focus();
	}
	
}

function chngFrameself(dropdown) {
	var index = dropdown.selectedIndex;
	var chosen = dropdown.options[index].value;	
	//if (index > 0) {window.location = chosen;}
	window.location = chosen;
}

function checksuchbegriff(){
if(!checkText(f1.suchbegriff)) { return false; }
x=document.f1.suchbegriff.value;
if(x.length<3){
	alert("Suchbegriff zu kurz");
	document.f1.suchbegriff.focus();
	return false;
}
return true;
}

