function validate() {
var defaultEmptyOK = true;
	var title=document.Mem.Titel.value;
	var anrede=document.Mem.Anrede.value;
	var email=document.Mem.Email.value;
	var name=document.Mem.Vorname.value;
	var last_name=document.Mem.Nachname.value;
/*
	//Check if they entered a anrede
	if  (isEmpty(anrede)) {
		display_alert ("Das Anrede feld ist leer.  \nDieses Feld muss ausgefüllt werden");
		return false;
	}
	//Check if they entered a name
	if  (isEmpty(name)) {
		display_alert ("Das Vorname feld ist leer.  \nDieses Feld muss ausgefüllt werden");
		return false;
	}
	//Check if they entered a surname
	if  (isEmpty(last_name)) {
		display_alert ("Das Nachname feld ist leer.  \nDieses Feld muss ausgefüllt werden");
		return false;
	}
*/	
	//Check if they entered an email
	if  (isEmpty(email)) {
		display_alert ("Das email feld ist leer.  \nDieses Feld muss ausgefüllt werden");
		return false;
	}
	//Check if they entered a valid email
	if  (!validEmail(email)){
		display_alert ("Das email feld ist ungultig.  \nBitte korrekt.");
		return false;
	}

return true;



}

function validEmail(email) {
	var cLength 	= email.length;
//display_alert ("We are "+cLength+email);
	//Must be at least 3 long
	if (cLength < 4) {
		return false;
	}
	var hasAt=email.indexOf('@');
	var hasFS=email.indexOf('.');
	//display_alert("tring at"+hasAt+hasFS );
	if (hasAt == -1) {
		//display_alert ("No at! ");
		return false;
	}
	if (hasFS == -1) {
		//display_alert ("No at! ");
		return false;
	}
return true;
}


function strToZero(anyval) {
     anyval = ""+anyval
     if (anyval < "0" || anyval > "999999999999999999999")
	return true;
     else
	return false;
}

// Check for a blank field
function isFieldBlank(theField) {
//display_alert("got "+theField);
        if(theField.value == "")
	  return true;
        else
	display_alert("ret false "+theField);
            return false;
}

// Check for a valid numeric range
function isInRange(theMin, theMax, theField) {

//	theMax++;
        if( (theField >=theMin)
	&&  (theField <= theMax) ) {

		  return true;
	}
        else {
//		display_alert ("date is NOT in range  "+theField +theMin+theMax );
            return false;
	}
}

function display_alert(s) {
	return alert ("Angaben unvollständig!\nBitte füllen Sie alle mit * gekennzeichneten Felder aus.\n\n" + s);
}

// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

// isInteger (STRING s [, BOOLEAN emptyOK])
//
// Returns true if all characters in string s are numbers.
//
// Accepts non-signed integers only. Does not accept floating
// point, exponential notation, etc.
//
// We don't use parseInt because that would accept a string
// with trailing non-numeric characters.
//
// By default, returns defaultEmptyOK if s is empty.
// There is an optional second argument called emptyOK.
// emptyOK is used to override for a single function call
//      the default behavior which is specified globally by
//      defaultEmptyOK.
// If emptyOK is false (or any value other than true),
//      the function will return false if s is empty.
// If emptyOK is true, the function will return true if s is empty.
//
// EXAMPLE FUNCTION CALL:     RESULT:
// isInteger ("5")            true
// isInteger ("")             defaultEmptyOK
// isInteger ("-5")           false
// isInteger ("", true)       true
// isInteger ("", false)      false
// isInteger ("5", false)     true

function isInteger (s)

{   var i;

    if (isEmpty(s))
       if (isInteger.arguments.length == 1) return true;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

// Returns true if character c is a digit
// (0 .. 9).

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}


//}
