function getPage(m,s,u) {
	//alert(m + " " + s + " " + u);
	//if(m=="m8" && s == "s8e")
	//	{
	//	newWindow("outline.doc","");
	//	return;
		
	//	}
	
	if(s=="ex")
		{
		var winRef;
		
		winRef = window.open(u)
		return;;
		}
	else
		{
	document.nextPage.action = "../inc/" + u;
	document.nextPage.nav.value = m;
	document.nextPage.subNav.value = s;
	document.nextPage.submit();
		}
}
function newWindow(pg,pm) {
	//page, function, parms
	//window.open('roster2.asp', 'newWin', 'scrollbars=yes width=500, height=450 menubar=yes toolbar=yes');
	//window.open('roster2.asp', 'newWin', 'menubar=yes,scrollbars=yes,height=500,width=600,resizable=yes');
	
	window.open(pg,'newWin',pm);
}
function getHelp(h) {
var hp = "../inc/help.asp?topic=" + h;
	//page, function, parms
	//window.open('roster2.asp', 'newWin', 'scrollbars=yes width=400, height=450 menubar=yes toolbar=yes');
	//window.open('roster2.asp', 'newWin', 'menubar=yes,scrollbars=yes,height=500,width=600,resizable=yes');
	
	window.open(hp,'Help', 'menubar=yes,scrollbars=yes,height=500,width=400,resizable=yes');
}
function ValidEMail(n)
	{
	if (/[\!\:\$\&\#\%\^\+\;\"\'\<\>\/\\\~\`\*\{\}\[\]\|]/.test(n)) return false;
	sect = n.split("@");
	if (sect.length < 2) return false;
	if (sect[0].length < 1) return false;
	sect2 = sect[1].split(".");
	if (sect2.length < 2) return false;
	if (sect2[0].length < 1) return false;
	if (sect2[1].length < 1) return false;
	return true;
	}

function CheckEMail(name,msg)
	{
	s = document.details[name].value;
	if (!ValidEMail(s))
		{
		if (arguments.length > 1) 
			{
			document.details[name].focus()
			alert(msg);
			}
		return false;
		}
	return true;
	}
function CheckLength(name,min,max,msg,f)
	{
	//if (arguments.length < 5)
		//document.[name].value = trim(document.[name].value);
	s = eval("document.getElementById('" + name + "').value;")
	s = trim(s);
	
	if ((s.length < min) || (s.length > max))
		{
		if (arguments.length > 3) 
			{
			eval("document.getElementById('" + name + "').focus();")
			alert(msg);
			}
		return false;
		}
	return true;
	}
function trim(str) {
	while (str.charAt(0) == ' ')
		str = str.substring(1);
	while (str.charAt(str.length - 1) == ' ')
		str = str.substring(0, str.length - 1);
	return str;
}
function CheckNumeric(name,msg)
	{
	s = eval("document.getElementById('" + name + "').value;");
	s = trim(s);
	if (s.search(/[^0-9]/g) != -1) 
		{
		if (arguments.length > 1) 
			{
			eval("document.getElementById('" + name + "').focus();");
			alert(msg);
			}
		return false;
		}
	return true;
	}
function CheckCurrency(name,msg)
	{
	s = document.details[name].value;
	if (s.search(/[^0-9\.]/g) != -1) 
		{
		if (arguments.length > 1) 
			{
			document.details[name].focus()
			alert(msg);
			}
		return false;
		}
	return true;
	}
function CheckAlpha(name,msg)
	{
	//s = document.details[name].value;
	s = eval("document.getElementById('" + name + "').value;");
	if (s.search(/[^A-Za-z]/g) != -1) 
		{
		if (arguments.length > 1) 
			{
			//document.details[name].focus()
			eval("document.getElementById('" + name + "').focus();");
			alert(msg);
			}
		return false;
		}
	return true;
	}
function isDate(strString){
	//verifies numeric dates much the same way as the vbscript function
	//does NOT check for valid dates!!  Can build this in however
	var strTemp;
	var boolCheck = false;
	var i = 0;
	var pos = 0;
	var strLength;
	var charFind = "-.*";
	var findLen;
	var strSlice;

	if(typeof(strString) == 'undefined')
		return boolCheck;
	
	strTemp = strString;
	findLen = charFind.length;
	strLength = strTemp.length;

	if(strLength > 5){
		if(strLength > 6){
			for(i = 0; i < findLen; i++)
				strTemp = vbReplace(strTemp, charFind.charAt(i), "/");
		}
		i = strTemp.indexOf("/", pos);
		if(i != -1){
			strSlice = strTemp.slice(pos, i);
			if(!isNaN(strSlice)){
				//month
				if(strSlice < 13){
					pos = i;
					i = strTemp.indexOf("/", pos + 1);
					strSlice = strTemp.slice(pos + 1, i);
					if(!isNaN(strSlice)){
						//day
						if(strSlice < 32){
							pos = i + 1;
							if(!isNaN(strTemp.slice(pos)))
								//year
								boolCheck = true;
						}
					}
				}
			}
		}
		else{
		if((strTemp.length == 8 || strTemp.length == 6) && !isNaN(strTemp))
			boolCheck = true;
		}
	}
	return boolCheck;
}
function formatCurrency(num) 
	{
	num = num.toString().replace(/\,/g,'');
	if(isNaN(num)) num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10) cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3)) + num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') +  num + '.' + cents);
	}
function vbReplace(Expression, Find, Replacement){
	//replaces substrings much the same way as the vbscript function
	var strTemp;
	var strFind;
	
	if(typeof(Expression == 'undefined'))
		return Expression;
		
	//create regular expression (new RegEx() did not work well)
	strFind = eval("/" + Find + "/gi;");
	strTemp = Expression.replace(strFind, Replacement);
	return strTemp;
}
function WelcomeMsg(FirstName)
{	
	var timeValue;
	var strMessage;

	//Get local hour
	dateObject = new Date();
	timeValue = dateObject.getHours();

	//Use appropriate welcome message based on the local time
	if (timeValue < 12){
		strMessage = "Good Morning, ";
	}
	else{
		if (timeValue < 17){
			strMessage = "Good Afternoon, ";
		}
		else{
			strMessage = "Good Evening, ";
		}
	}
	return(strMessage + FirstName);
}
//var allowedPostitCharacters = ".,- '!$()?/ and @";
var allowedAddressCharacters = ".,- '#.,()@";
var allowedPasswordCharacters = "";
var allowedUserIdCharacters = "#-'.@";
var allowedTitleCharacters = ".,- '#,()?%$!=+@/:";
var allowedMessageCharacters = ".,- '#,()?%$!=+@/:\r\n";
var allowedPostitCharacters = ".,- '#,()?%$!=+@[]<>/*:";
var allowedURLCharacters = ".,- '#,()?%$!=+@[]<>/_:";
var allowedNameCharacters = ".,- '";
var allowedCityCharacters = ".,- '";
var allowedPhoneCharacters = "-()";
var allowedZipCharacters = "-";
function CheckSpecialChars(name,chars,msg)
	{
	s = eval("document.getElementById('" + name + "').value;");
	var regexp = new RegExp("[^A-Za-z0-9" + makeRegEx(chars) + "]","g");
	if (regexp.test(s))
		{
		if (arguments.length > 2) 
			{
			if(chars.length > 0) alert(msg + " Please use only letters, numbers and the following special characters:\n" + chars);
			else alert(msg + " Please use only letters and numbers.");		
			//document.getElementbyId.[name].focus()
			eval("document.getElementById('" + name + "').focus();");
			}
		return false;
		}
	return true;
	}
function makeRegEx(s)
	{
	var r = "";
	for(var a=0;a<s.length;a++) 
		{
		r += "\\" + s.charAt(a);
		}
	return r;
	}



