<!--
// These scripts unless otherwise notes are copyrighted to MadeRight Technology Group
// © 2002-2004 All Rights Reserved
// ***** Popup Control *********************************************************

// ***** at_show_aux *****

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

// ***** at_show *****

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

// ***** at_hide *****

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

// ***** at_click *****

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
  return false;
}

// ***** at_attach *****

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

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();
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') {
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

//-->
