/**
 * @author Administrator
 */
// validates that the field value string has one or more characters in it
function isNotEmpty(elem, errorstr) {
    var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        alert(errorstr);
		elem.focus();
		elem.select();
        return false;
    } else {
        return true;
    }
}
   
//validates that the entry is a positive or negative number
function isNumber(elem,errorstr) {
    var str = elem.value;
    var re = /^[-]?\d*\.?\d*$/;
    str = str.toString( );
    if (!str.match(re)) {
		alert(errorstr);
		elem.focus();
		elem.select();
		return false;
    }
    return true;
}
   
// validates that the entry is 16 characters long when
// input field's maxlength attribute is set to 16
function isLen8(elem,errorstr) {
    var str = elem.value;
    var re = /\b.{8,30}\b/;
    if (!str.match(re)) {
		alert(errorstr);
		elem.focus();
		elem.select();
        return false;
    } else {
        return true;
    }
}

function isLen16(elem,errorstr) {
    var str = elem.value;
    var re = /\b.{16}\b/;
    if (!str.match(re)) {
        alert(errorstr);
        return false;
    } else {
        return true;
    }
}
   
// validates that the entry is formatted as an email address
function isEMailAddr(elem,errorstr) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        alert(errorstr);
		elem.focus();
		elem.select();
        return false;
    } else {
        return true;
    }
}
