function isEMailAddr(elem) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        return false;
    } else {
        return true;
    }
}

var sErrorFields = '';
var sErrorTexts = '';
function addError(errorText, errorField) {
	sErrorTexts += '   ' + errorText + '\n';
	sErrorFields += errorField + ',';
}
function setFormFocus(f, e) {
	if(e) {
		f.elements[e].focus();
	}
}
function unhighlightErrors(f, s) {
	a = s.split(',');
	if(a.length > 0) {
		for(i = 0; i < (a.length -1); i++) {
			if(a[i].toString().length > 0) { f.elements[a[i]].style.backgroundColor = ''; f.elements[a[i]].style.borderColor = ''; }
		}
	}
}
function highlightErrors(f, s) {
	if(s.length > 0) {
		a = s.split(',');
		if(a.length > 0) {
			for(i = 0; i < (a.length -1); i++) {
				if(a[i].toString().length > 0) { f.elements[a[i]].style.backgroundColor = '#FFF2F2'; f.elements[a[i]].style.borderColor = '#FFD1D1'; }
			}
			setFormFocus(f, a[0])
		}
	}
}


function checknumber(x){
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
		return false
	else
		return true
}