
<!--
//-----------------------------------------------------------------

function stripTrailingAndLeadingSpaces(str)
{
    size = str.length;
    while (str.slice(0,1) == " ") {        //Strip leading spaces
        str = str.substr(1,size-1);
        size = str.length;
    }
    while(str.slice(size-1,size)== " ") {  //Strip trailing spaces
        str = str.substr(0,size-1);
        size = str.length;
    }
    return str;
}//function
//-----------------------------------------------------------------

function isEmpty(str)
{
    if(str==null){
        return true;
    }
    else if ( stripTrailingAndLeadingSpaces(str) == ""){
        return true;
    }
    else{
        return false;
    }
}
//-----------------------------------------------------------------
function isInteger (str)
{
    var i;

    // 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 < str.length; i++)
    {
        // Check that current character is number.
        var c = str.charAt(i);

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

    return true;    // All characters are numbers.
}//end isInteger()
//-----------------------------------------------------------------
// Returns true if character c is a digit
// (0 .. 9).
function isDigit (c)
{
    return ((c >= "0") && (c <= "9"))
}
//-----------------------------------------------------------------
function validPassword(password){
    var valid = true;
    if( isEmpty(password) ){
        valid = false;
    }

    var length = password.length;
    if(valid){
        if(length < 6){
            valid = false;
        }
    }

    if(valid){
        //alert("valid: " + valid);
        var foundDigit = false;
        for (i = 0; i < length; i++){
            // Check that current character is number.
            var c = password.charAt(i);
            //alert("c: " + c);
            if (isDigit(c)) {
                foundDigit = true;
                break;
            }
        }
        if(!foundDigit){
            valid = false;
        }
    }
    return valid;

}

function isEmailValidFormat(str)
{
    var at="@";
    var dot=".";
    var lat=str.indexOf(at);
    var lstr=str.length;
    var ldot=str.indexOf(dot);

    if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
        return false;
    if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
        return false;
    if (str.indexOf(at,(lat+1))!=-1)
        return false;
    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
        return false;
    if (str.indexOf(dot,(lat+2))==-1)
        return false;
    if (str.indexOf(" ")!=-1)
        return false;
    return true;
}//end function

//-----------------------------------------------------------------

//  -->
