// JavaScript Document
function cAlert(fArg)
{
    alert(fArg);
}

// validates that the field value string has one or more characters in it
function isNotEmpty(elem,msg) {
    var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        cAlert(msg);
		elem.focus();
        return false;
    } else {
        return true;
    }
}

// validates that the field value string has no characters in it and don't show message
function isEmpty(elem) {
    var str = elem.value;
    var re = /.+/;
    if(!str.match(re)) {
        return true;
    } else {
        return false;
    }
}
   
// validates that the entry is formatted as an email address
function isEMailAddr(elem,msg) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        cAlert(msg);
		elem.focus();
        return false;
    } else {
        return true;
    }
}

// validates that the entry is selected 
function isSelected(elem,msg){
	var str=elem.selectedIndex;
	if ((str==null) || (str==0)){
		cAlert(msg);
		elem.focus();
		return false;
	}
	else {
			return true;
	}
}

