function checkRequiredText(txtFieldName,txtMessage) {
	if( document.getElementById(txtFieldName).value == "" ) { 
		return txtMessage + "\n"; 
	} else {
		return ""; 
	}
}
function checkRequiredDropDown(txtFieldName,txtMessage) {
	if( document.getElementById(txtFieldName)[document.getElementById(txtFieldName).selectedIndex].value == "" ) { 
		return txtMessage + "\n"; 
	} else {
		return ""; 
	}
}
function checkRequiredEmail(txtFieldName,txtMessage) {
	if( document.getElementById(txtFieldName).value == "" ) { 
		return txtMessage + "\n"; 
	} else {
		var isValid = isEmail( document.getElementById(txtFieldName).value );
		if( !isValid ) {
			return txtMessage + "\n";
		} else {
			return "";
		}
	}
}
function checkRequiredZip(txtFieldName,txtMessage) {
	if( document.getElementById(txtFieldName).value == "" ) { 
		return txtMessage + "\n"; 
	} else {
		var isValid = isZipCode( document.getElementById(txtFieldName).value );
		if( !isValid ) {
			return txtMessage + "\n";
		} else {
			return "";
		}
	}
}

function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}

function isZipCode(string) {
    if (string.search(/(^\d{5}$)|(^\d{5}-\d{4}$)/) != -1)
        return true;
    else
        return false;
}

function makeAlert(msgString) {
	if( msgString.length > 0 ) { 
		alert("The following error(s) occurred:\n\n" + msgString );
		return false; 
	} else {
		return true;
	}
}
