function OpenFeeScheduleWindow(sid, relPath) {
	if(relPath != undefined) 
	{
		window.open(relPath + 'WebAssistNet/FeeSchedules.aspx?id=' + sid, '_blank', 'menubar=0,scrollbars=1,resizable=1, toolbar=0,top=100,left=100,width=700,height=600');
	}	
	else
	{
	window.open('WebAssistNet/FeeSchedules.aspx?id=' + sid, '_blank', 'menubar=0,scrollbars=1,resizable=1,toolbar=0,top=100,left=100,width=700,height=600');
	}
}

function emailOK(emailAddr,emailObj) { //Added by mb for email verification.
	var emailAddrTrimmed;
	if (emailAddr == "")
	   return true;

	emailAddrTrimmed = checkTrimEmail(emailAddr,emailObj);
	if (!(checkEmail(emailAddrTrimmed))) {
		alert("Please check the e-mail address you entered, it is not in the right format.");
		emailObj.select();
		emailObj.focus();

	}
}

function checkTrimEmail(emailAddr,emailObj) {
	// check for empty spaces, if they exist - update the form with the truncated address.
	var emailAddrTrimmed;
	emailAddrTrimmed = emailAddr.replace(/^\s+|\s+$/g,"");

	if (emailAddr.length == emailAddrTrimmed.length)
		return emailAddr;
	else {
		emailObj.value = emailAddrTrimmed;
		return emailAddrTrimmed;
	}
}

function checkEmail(emailAddrSrc) {
	// this function checks for a well-formed e-mail address in the format: user@domain.com

	var i;

	// Normalize email address
	emailAddr = emailAddrSrc.toLowerCase();

	// check for @
	i = emailAddr.indexOf("@");
	if (i == -1) {
		return false;
	}

	// separate the user name and domain
	var username = emailAddr.substring(0, i);
	var domain = emailAddr.substring(i + 1, emailAddr.length)

	// look for spaces at the beginning of the username
	i = 0;
	while ((username.substring(i, i + 1) == " ") && (i < username.length)) {
		i++;
	}
	// remove any found
	if (i > 0) {
		username = username.substring(i, username.length);
	}

	// look for spaces at the end of the domain
	i = domain.length - 1;
	while ((domain.substring(i, i + 1) == " ") && (i >= 0)) {
		i--;
	}
	// remove any found
	if (i < (domain.length - 1)) {
		domain = domain.substring(0, i + 1);
	}

	// make sure neither the username nor domain is blank
	if ((username == "") || (domain == "")) {
		return false;
	}

	// check for bad characters in the username
	var ch;
	for (i = 0; i < username.length; i++) {
		ch = (username.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) ||
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}

	// check for bad characters in the domain
	for (i = 0; i < domain.length; i++) {
		ch = (domain.substring(i, i + 1)).toLowerCase();
		if (!(((ch >= "a") && (ch <= "z")) ||
			((ch >= "0") && (ch <= "9")) ||
			(ch == "_") || (ch == "-") || (ch == "."))) {
				return false;
		}
	}

	var aSuffix = new Array("com","edu","org","gov","mil","ca","net", "us", "tv", "info", "biz", "coop", "pro", "tel", "travel", "jobs", "asia", "aero");
	// var aSuffix = new Array("com","edu","org","gov","mil","ca","net");
	var bFoundSuffix = false;
	i = 0;
	while (i < aSuffix.length) {
		if (("." + aSuffix[i]) == domain.substring(domain.length - aSuffix[i].length - 1, domain.length)) {
			return true;
		}
		i++;
	}
	// we would have exited if we'd found a good suffix, so return false
	return false;
}
