// validates that the field value string has one or more characters in it
function isNotEmpty(elem) {
    var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        alert("Please fill in the required field.");
        return false;
    } else {
        return true;
    }
}

function isEmpty(elem) {
    var str = elem.value;
    var re = /.+/;
    return (!str.match(re));
}

   
//validates that the entry is a positive or negative number
function isNumber(elem) {
    var str = elem.value;
    var re = /^\d*\.?\d*$/;
    str = str.toString( );
    if (!str.match(re)) {
        alert("Enter only numbers into the field.");
        return false;
    }
    return true;
}

function isInteger(elem) {
    var str = elem.value;
    var re = /^\d*$/;
    str = str.toString( );
    if (!str.match(re)) {
        alert("Enter only integer numbers into the field.");
        return false;
    }
    return true;
}
   
 
// validates that the entry is formatted as an email address
function isEMailAddr(elem) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert("Verify the email address format.");
        return false;
    } else {
        return true;
    }
}
