<!--
// These scripts unless otherwise notes are copyrighted to MadeRight Technology Group
// © 2002-2004 All Rights Reserved
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function DelDocument(DocumentID){
	msg = confirm("Delete this document ?")
  	if (msg) 
   		{window.navigate("admin_DocList.asp?action=del&DocumentID="+DocumentID);}
}

function MR_promptOpen(alstr,url,name,props) { 
	msg2 = confirm(alstr)
  	if (msg2)
		{
		window.open(url,name,props);
		}
}

// Opens New Widow - Compliments of MacroMedia
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//Closes window and refreshes parent when passed Close=True in QS Param
function MR_closeWin(x) {
if (x == 'true') {
	opener.location.href = opener.location;
	self.close()
	}
	else
		{}
}

function EAG_comparePass(x1,x2)
{
//vx1 = x1.toString();
//vx2 = x2.toString();
str1 = x1.value;
str2 = x2.value;
if (str1 != str2) {
	alert('the Passwords you entered do not match one another, please re-enter them now');
	x1.value = ''
	x2.value = ''
	}
	else
		{
		return true;
		}
}

// © Copyright 2002. All Rights Reserved - BICUS Services Corp.
// Unless otherwise noted, All Scripts written by Andrew Gscheidle, 2002-2003.
// Error handling

function BSC_blockError(msg,url,linenumber)
	{
		vW=screen.width;
		vH=screen.height;
		vRes = (vW + " X " + vH);
		vD=screen.colorDepth + "-bit";
		var agt=navigator.userAgent.toLowerCase();
		var strAgt = agt.toString();
		var strOS = strAgt.split(';');
		var strOStxt = strOS[2];
		var ref = document.referrer;
	
		document.location.href = "/report_errors.asp?Page=" + url + '&Msg=' + msg + '&Line=' + linenumber + '&Referrer=' + ref + '&uRes=' + vRes + '&uDepth=' +vD + '&uOS=' + strOStxt + '&SendMail=True';
	}
//window.onerror = BSC_blockError;

function BSC_convertUpper(vfld) {
var str = vfld.value;
var xstr = str.toUpperCase();
vfld.value = xstr;
}

function MM_openBrWindow(theURL,winName,features) 
{ //v2.0
  window.open(theURL,winName,features);
} 

function windowOpen(URL,WINNAME,PROPS)
{
window.open(URL,WINNAME,PROPS);
}


function BSC_count(x,fldname)
{
	var countfld = document.forms[x].cntr
	var ii = fldname.value.length;
	return countfld.value=ii
}


function BSC_checkLength(fld,allowed)
{
	//BSC_count(fld)
  var i = fld.value.length;
	var x = parseInt(allowed);
	if (i >= x) 
	{
	alert('Character Limit Exceeded! You may only enter in ' + allowed + ' characters.\nYou have entered ' + i + ' characters.\nPlease remove ' + (parseInt(i-x)) + ' characters.')
	return false;
	}
		else
		{
		return true
		}
}

// evaluates string to remove non-desired characters such as data masks, etc.
	// returns pure value back to page or calling function.
	function BSC_stripCharsNotInBag (s)
	{   
		var bag = "1234567890";
		var i;
			var returnString = "";
			for (i = 0; i < s.length; i++)
			{   
					// Check that current character isn't whitespace.
					var c = s.charAt(i);
					if (bag.indexOf(c) != -1) returnString += c;
			}
			return returnString;
	}
function BSC_returnCharsNotInBag (s,fld2)
	{   
		var bag = "1234567890";
		var i;
			var returnString = "";
			for (i = 0; i < s.length; i++)
			{   
					// Check that current character isn't whitespace.
					var c = s.charAt(i);
					if (bag.indexOf(c) != -1) returnString += c;
			}
			//alert(returnString)
			eval(fld2.value = returnString)
			//return returnString;
	}
	//Returns Error message with up to one parameter in the error msg.
	function BSC_onError(eIndex, addparam)
	{
	 var defaultmsg = "Your Date is Invalid.\n";
	 errormsg = new Array()
	 errormsg[0] = defaultmsg+"Date Too SHORT, please enter an 8 DIGIT date .\n(HELP: You should use a MMDDYYYY format, pad single digit months with 0.)";
	 errormsg[1] = defaultmsg+"Invalid MONTH entered.\nYou must enter a number between 01 and 12.\nPlease re-enter your MONTH";
	 errormsg[2] = defaultmsg+"Invalid DAY entered.\nPlease enter a number between 1-31.\nPlease re-enter your DAY";
	 errormsg[3] = defaultmsg+"Invalid DAY entered.\nThe month you entered only has 30 days.\nPlease re-enter your DAY";
	 errormsg[4] = defaultmsg+"February only has 28 days in " + addparam + ".\nPlease re-enter your DAY.";
	 errormsg[5] = defaultmsg+"Date Too LONG, Please enter no more than 8 digits.\nYou should use a MMDDYYYY format.";
	 errormsg[6] = "The Phone Number has TOO MANY digits. Please enter 10 digits.";
	 errormsg[7] = "The Phone Number has TOO LITTLE digits. Please only enter 10 digits.";
	 errormsg[8] = "You have not entered a valid email address, please re-enter a valid email address";
	 errormsg[9] = "Your Email address contains blank spaces.\nEmail Addresses cannot have blank spaces.\Please re-enter your email address";
	 
	 return alert(errormsg[eIndex]);
	}

	// February has 29 days in any year evenly divisible by four,
	// EXCEPT for centurial years which are not also divisible by 400.
	function BSC_daysInFebruary (year)
	{   
			return (  ((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0) ) ) ? 29 : 28 );
	}
	
	// Evaluates field for vaild date and reformats string to MM/DD/YYYY format
	function BSC_checkDate(dField,dValue)
	{	
		var fldDate = dValue;
		var strDate = BSC_stripCharsNotInBag(new String(fldDate));
		var lenDate = strDate.length;
		var txtYYYY = strDate.substring(4,8);
		var iYYYY = parseInt(txtYYYY);	
		
		if (lenDate > 8)
			{
			BSC_onError(5);
			dField.focus();
			return false;
			}
		
		if ((lenDate > 0) && (lenDate < 8))
			{	 
			BSC_onError(0);
			dField.focus();
			return false;
			}
		
		if (lenDate == 8)
			{
			var txtMM = strDate.substring(0,2);
				//alert(txtMM)
			var txtDD = strDate.substring(2,4);
			var iMM = parseInt(txtMM);
				//alert(iMM)
			var iDD = parseInt(txtDD)
			
			if ((txtMM < 1) || (txtMM >12))
				{
				BSC_onError(1);
				dField.focus();
				return false;
				}
	
			if ((txtDD < 1) || (txtDD > 31))
				{
				BSC_onError(2);
				dField.focus();
				return false;
				}
				
			if (((txtMM == 4) || (txtMM == 6) || (txtMM == 9) || (txtMM == 11)) && (txtDD > 30))
				{
				BSC_onError(3);
				dField.focus();
				return false;
				}
				
				if ((txtMM == 2) && (txtDD > BSC_daysInFebruary(iYYYY)))
					{
					BSC_onError(4,txtYYYY);
					dField.focus();
					return false;
					}
			var strDate = new String(txtMM + "/" + txtDD +"/" + txtYYYY);
			dField.value = strDate;
			return true;
			}
	}

	// Checks field for valid US Phone format and format the string for (999) 999-9999 format.
	function BSC_checkPhone(phField,phValue)
	{
		var strPhone = new String(phValue);
		var fxdPhone = BSC_stripCharsNotInBag(strPhone);
	
		if (fxdPhone.length > 10)
			{
				BSC_onError(6);
				phField.focus();
			}
		
		if ((fxdPhone.length > 0) && (fxdPhone.length < 10))
			{
				BSC_onError(7);
				phField.focus();
			}
		
		if (fxdPhone.length == 10)
			{
				var rtrnPhone = "(" + fxdPhone.substring(0,3) + ") " + fxdPhone.substring(3,6)+ "-" + fxdPhone.substring(6,10);
				phField.value = rtrnPhone;
				return true;
			}	
	}

	//Checks form field for email address (checks for @, and also . with at least one character after the .
	function BSC_checkEmail(emField,emValue)
	{
			var i = 1;
			var sLength = emValue.length;
		
		if (sLength > 0 )
		{
		if (emValue.indexOf(".") == -1)
			BSC_onError(8);
			
		if (emValue.indexOf(" ") == 1)
			BSC_onError(9);
			
		// look for @
			while ((i < sLength) && (emValue.charAt(i) != "@"))
			{ i++
			}
	
			if ((i >= sLength) || (emValue.charAt(i) != "@")) 
			BSC_onError(8);
			else i += 2;
	
	
			// look for .
			while ((i < sLength) && (emValue.charAt(i) != "."))
			{ i++
			}
	
			// there must be at least one character after the .
			if ((i >= sLength - 1) || (emValue.charAt(i) != ".")) 
			BSC_onError(8);
			else 
			return true;
		}
	}

function BSC_checkPassLength(fld,minlen)
{
	var i = fld.value.length;
	var x = parseInt(i);
	var y = parseInt(minlen);
	if (x < y) 
		{
		alert('PASSWORDS must contain at least '+ minlen + ' characters.\nPlease re-enter a PASSWORD that is at least ' + minlen + ' characters long.')
		//fld.focus();
		//return false;
		}
		else 
			{
			return true;
			}
}

function BSC_checkUserLength(fld,maxlen)
{
	var i = fld.value.length;
	var x = parseInt(i);
	var y = parseInt(maxlen);
	if ((x == 0) || (x > y))
		{
		alert('USER NAMES must be between 1 and '+ maxlen + ' characters.\nPlease re-enter a USER name that is between 1 and ' + maxlen + ' characters long.')
		//fld.focus();
		//return false;
		}
		else 
			{
			return true;
			}
}

function BSC_checkPassNum(fld)
{
 var alphanum = new Array('0','1','2','3','4','5','6','7','8','9','A','a','B','b','C','c','D','d','E','e','F','f','G','g','H','h','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','Q','q','R','r','S','s','T','t','U','u','V','v','W','w','X','x','Y','y','Z','z')

}


function BSC_comparePass(fld1,fld2)
{
	BSC_checkPassLength(fld1,6)
	BSC_checkPassLength(fld2,6)
	var strA = fld1.value;
	var strB = fld2.value;
	if (strA != strB)
	{
	alert('The PASSWORDS you entered do not match one another.\nIt is advised that you re-enter both PASSWORDS')
	return false;
	}
	else
		{
		//alert('Match')
		return document.forms[0].submit();
		}
}

function BSC_showOnOver(fld)
{
 alert(fld.value)	
}

function BSC_userConfirm(fld,fld1,fld2)
{
	BSC_checkUserLength(fld,8)
	BSC_checkPassLength(fld1,6)
	BSC_checkPassLength(fld2,6)
	var strA = fld1.value;
	var strB = fld2.value;
	if (strA != strB)
	{
	alert('The PASSWORDS you entered do not match one another.\nIt is advised that you re-enter both PASSWORDS')
	return false;
	}
	else
		{
		//alert('Match')
		return document.forms[0].submit();
		}
}

function BSC_toUpper(fld,str)
{
var fldname = fld;
var xx = str;
return fldname.value = xx.toUpperCase();
}
//-->



