function frageAlpha( objName,sonderstr,minlen,maxlen ) {

	// Abfrage ob objName ein Object (es gilt nur FORM-Objekt) oder ein String ist
	if (typeof objName == "object") { 
		str = objName.value; 
	} else {
		str = objName;
	}
	
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	testmin = true;
	testmax = true;
	if (minlen+"" == "undefined" || minlen+"" == "null") { testmin = false; }		
	if (maxlen+"" == "undefined" || maxlen+"" == "null") { testmax = false; }
		
	var frageValid = true;

	str += "";	// convert to a string for performing string comparisons.
	sonderstr += "";

	// Loop through string one character at time,  breaking out of for
	// loop when an non Alpha character is found.
  	for (i = 0; i < str.length; i++) {
		// Alpha must be between "A"-"Z", or "a"-"z"
		if ( !( ((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z")) ) ) {
					if (sonderstr.indexOf(str.charAt(i))<0) {
    	   				frageValid = false;
		   			   	break;
					} 
      			}
   } // end for loop
   
	if ((testmin) && (str.length<minlen)) { frageValid = false; }
	if ((testmax) && (str.length>maxlen)) { frageValid = false; }

	if (!frageValid) {
		objName.select();
		objName.focus();
		alertsay = "Es sind nur Zeichen von \"A-Z\"";
		if (sonderstr!="") { alertsay = alertsay + " und \"" + sonderstr + "\""; }
		alertsay = alertsay + " erlaubt.";
		if (testmin) { alertsay = alertsay + "\n" + "Minimum " + minlen + " Zeichen."; }
		if (testmax) { alertsay = alertsay + "\n" + "Maximal " + maxlen + " Zeichen."; }
		alert(alertsay);
	}
   
	return frageValid;
}  // end frageAlpha 

function frageAlphaNum( objName,sonderstr,minlen,maxlen ) {

	// Abfrage ob objName ein Object (es gilt nur FORM-Objekt) oder ein String ist
	if (typeof objName == "object") { 
		str = objName.value; 
	} else {
		str = objName;
	}

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	testmin = true;
	testmax = true;
	if (minlen+"" == "undefined" || minlen+"" == "null") { testmin = false; }		
	if (maxlen+"" == "undefined" || maxlen+"" == "null") { testmax = false; }
		
	var frageValid = true;
	
	// convert to a string for performing string comparisons.
   	str += "";	
	sonderstr += "";

	// Loop through length of string and test for any alpha numeric 
	// characters
   	for (i = 0; i < str.length; i++)
   	{
			// Alphanumeric must be between "0"-"9", "A"-"Z", or "a"-"z"
      	if (!(((str.charAt(i) >= "0") && (str.charAt(i) <= "9")) || 
      			((str.charAt(i) >= "a") && (str.charAt(i) <= "z")) ||
      			((str.charAt(i) >= "A") && (str.charAt(i) <= "Z"))))
			{
				if (sonderstr.indexOf(str.charAt(i))<0) {
    		   		frageValid = false;
   				   	break;
				} 
			}	
   	} // END for   

	if ((testmin) && (str.length<minlen)) { frageValid = false; }
	if ((testmax) && (str.length>maxlen)) { frageValid = false; }

	if (!frageValid) {
		objName.select();
		objName.focus();
		alertsay = "Es sind nur Zeichen von \"A-Z\" und \"0-9\"";
		if (sonderstr!="") { alertsay = alertsay + " und \"" + sonderstr + "\""; }
		alertsay = alertsay + " erlaubt.";
		if (testmin) { alertsay = alertsay + "\n" + "Minimum " + minlen + " Zeichen."; }
		if (testmax) { alertsay = alertsay + "\n" + "Maximal " + maxlen + " Zeichen."; }
		alert(alertsay);
	}
   
   	return frageValid;
}  // end frageAlphaNum

function frageBlank( str ) {
	var frageValid = false;

 	if ( frageNull(str) || frageUndef(str) || (str+"" == "") )
 		frageValid = true;
		
	return frageValid;
}  // end frageBlank

function frageInt( objName,sonderstr,allowNegatives,minlen,maxlen ) {

	// Abfrage ob objName ein Object (es gilt nur FORM-Objekt) oder ein String ist
	if (typeof objName == "object") { 
		numstr = objName.value; 
	} else {
		numstr = objName;
	}

	// Return immediately if an invalid value was passed in
	if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
		return false;

	// Default allowNegatives to true when undefined or null
	if (allowNegatives+"" == "undefined" || allowNegatives+"" == "null")	
		allowNegatives = true;

	testmin = true;
	testmax = true;
	if (minlen+"" == "undefined" || minlen+"" == "null") { testmin = false; }		
	if (maxlen+"" == "undefined" || maxlen+"" == "null") { testmax = false; }
		
	var frageValid = true;
	
	// convert to a string for performing string comparisons.
	numstr += "";
	sonderstr += "";
		
	// Loop through string and test each character. If any
	// character is not a number, return a false result.
 	// Include special case for negative numbers (first char == '-').   
	for (i = 0; i < numstr.length; i++) {
    	if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || (numstr.charAt(i) == "-"))) {
			if (sonderstr.indexOf(numstr.charAt(i))<0) {
    	   		frageValid = false;
   			   	break;
			} 
		} else if ((numstr.charAt(i) == "-" && i != 0) || (numstr.charAt(i) == "-" && !allowNegatives)) {
	       	frageValid = false;
    	   	break;
		} 
		         	       
   } // END for   
   
	if ((testmin) && (numstr.length<minlen)) { frageValid = false; }
	if ((testmax) && (numstr.length>maxlen)) { frageValid = false; }
   
	if (!frageValid) {
		objName.select();
		objName.focus();
		alertsay = "Es sind nur Zeichen von \"0-9\"";
		if (sonderstr!="") { alertsay = alertsay + " und \"" + sonderstr + "\""; }
		alertsay = alertsay + " erlaubt.";
		if (testmin) { alertsay = alertsay + "\n" + "Minimum " + minlen + " Zeichen."; }
		if (testmax) { alertsay = alertsay + "\n" + "Maximal " + maxlen + " Zeichen."; }
		alert(alertsay);
	}
   
   	return frageValid;
}  // end frageInt

function frageNull( val ) {
	var frageValid = false;

 	if (val+"" == "null")
 		frageValid = true;
		
	return frageValid;
}  // end frageNull

function frageNum( numstr ) {
	// Return immediately if an invalid value was passed in
	if (numstr+"" == "undefined" || numstr+"" == "null" || numstr+"" == "")	
		return false;

	var frageValid = true;
	var decCount = 0;		// number of decimal points in the string

	// convert to a string for performing string comparisons.
	numstr += "";	

	// Loop through string and test each character. If any
	// character is not a number, return a false result.
 	// Include special cases for negative numbers (first char == '-')
	// and a single decimal point (any one char in string == '.').   
	for (i = 0; i < numstr.length; i++) {
		// track number of decimal points
		if (numstr.charAt(i) == ".")
			decCount++;

    	if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9") || 
				(numstr.charAt(i) == "-") || (numstr.charAt(i) == "."))) {
       	frageValid = false;
       	break;
		} else if ((numstr.charAt(i) == "-" && i != 0) ||
				(numstr.charAt(i) == "." && numstr.length == 1) ||
			  (numstr.charAt(i) == "." && decCount > 1)) {
       	frageValid = false;
       	break;
      }         	         	       
//if (!((numstr.charAt(i) >= "0") && (numstr.charAt(i) <= "9")) || 
   } // END for   
   
   	return frageValid;
}  // end frageNum

function frageUndef( val ) {
	var frageValid = false;

 	if (val+"" == "undefined")
 		frageValid = true;
		
	return frageValid;
}  // end frageUndef

function frageValidEmail( objName ) {

	// Abfrage ob objName ein Object (es gilt nur FORM-Objekt) oder ein String ist
	if (typeof objName == "object") { 
		str = objName.value; 
	} else {
		str = objName;
	}
	
	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str+"" == "null" || str+"" == "")	
		return false;

	var frageValid = true;

	str += "";

	namestr = str.substring(0, str.indexOf("@"));  // everything before the '@'
	domainstr = str.substring(str.indexOf("@")+1, str.length); // everything after the '@'

	// Rules: namestr cannot be empty, or that would indicate no characters before the '@',
	// domainstr must contain a period that is not the first character (i.e. right after
	// the '@').  The last character must be an alpha.
   	if (frageBlank(str) || (namestr.length == 0) || 
			(domainstr.indexOf(".") <= 0) ||
			(domainstr.indexOf("@") != -1) ||
			!frageAlpha(str.charAt(str.length-1)))
		frageValid = false;

	if (!frageValid) {
		objName.select();
		objName.focus();
		alert("Das ist keine gueltige eMail-Adresse.");
	}
	
   	return frageValid;
} // end frageValidEmail

function del( Word ) {
	a = Word.indexOf("<");
	b = Word.indexOf(">");
	len = Word.length;
	c = Word.substring(0, a);
	if(b == -1)
		b = a;
	d = Word.substring((b + 1), len);
	Word = c + d;
	tagCheck = Word.indexOf("<");
	if(tagCheck != -1)
		Word = del(Word);
	return Word;
}

function delHTML( objName ) {

	// Abfrage ob objName ein Object (es gilt nur FORM-Objekt) oder ein String ist
	if (typeof objName == "object") { 
		ToCheck = objName.value; 
		Checked = del(ToCheck);
		objName.value = Checked;
	} else {
		ToCheck = objName;
		Checked = del(ToCheck);
		return Checked
	}
	return true;
}

