
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ShowMD(locator, name, height, width, help, status) 
{ 
	srcheight = screen.height;
	srcwidth = screen.width;
	Top = ((srcheight - height)/2)-(srcheight*0.05)
	Left = (srcwidth - width)/2
	window.showModalDialog(locator,name,"dialogHeight: "+ height +"px; dialogWidth: "+ width +"px; dialogTop: "+ Top +"px; dialogLeft: "+ Left +"px; edge: Raised; center: Yes; help: "+ help +"; resizable: No; status: "+ status+";");	
}

function ReplaceTitle()
{
	window.document.title = window.document.title +" ";
}

function popup(locator, name, height, width, top, menubar, scrollbars) 
{ 
	srcheight = screen.height;
	srcwidth = screen.width;
	top = ((srcheight - height)/2)-(srcheight*0.05)
	left = (srcwidth - width)/2
	window.parent.open(locator, name, 'height='+ height +', width='+ width +', top='+ top +', left='+ left +', menubar='+ menubar +', titlebar=no,resizable=yes,status=no,tollbars=no,location=no,scrollbars='+ scrollbars);
}

function LoadForm(width, height)
{
	srcheight = screen.height;
	srcwidth = screen.width;
	PosTop = ((srcheight - height)/2)-(srcheight*0.05);
	PosLeft = (srcwidth - width)/2;
	resizeTo(width, height);
	moveTo(PosLeft, PosTop);

}
function LoadForm(width, height)
{
	srcheight = screen.height;
	srcwidth = screen.width;
	PosTop = ((srcheight - height)/2)-(srcheight*0.05);
	PosLeft = (srcwidth - width)/2;
	resizeTo(width, height);
	moveTo(PosLeft, PosTop);

}
var prevbgColor;

function MenuOver(cell)
{
	prevbgColor = cell.bgColor;
	cell.bgColor='#F2D887';
	cell.style.cursor='hand';

}
function MenuOut(cell)
{
	cell.bgColor= prevbgColor;
	cell.style.cursor='default';

}


function LogOff(){
	window.parent.location.href='logout.asp';
}

         function errorHandler(msg,url,lno)
         {             var alertmsg = "There has been an internal error. Please apologize for inconvenience.";             alertmsg += "\n\nPlease refresh this page and this error should go away.\n\n";             alertmsg += "If problem persists please contact site helpdesk.";
	     alert (alertmsg);             return (true);
         }
function screensize()
{
	var correctwidth=1024
	var correctheight=768
	if (screen.width<correctwidth||screen.height<correctheight)
	document.write("This webpage is bested viewed with screen resolution "+correctwidth+"*"+correctheight+" or above. Your current resolution is "+screen.width+"*"+screen.height+". If possible, please change the resolution!")
}

function NoRefresh()
{
	if (document.all)
	{ document.onkeydown = function ()
		{ var key_f5 = 116; // 116 = F5 
			if (key_f5==event.keyCode)
			{ event.keyCode = 27; 
		  	return false; 
			} 
		} 
	}
} 
function RowChange(row)
    {
    if (row.bgColor == '') 
		{row.bgColor = '#E8E8F0';} 
    else 
		{row.bgColor = '';}
    }
function CheckUncheckAll(form)
{	
	for (i=1; i < form.elements.length; i++) 
		{form.elements[i].checked = form.elements[0].checked}
}

function Confirmation(str)
{
	return confirm (str);
}
function UpperCase(Text)
{
	Text.value = (Text.value).toUpperCase();
}
function CheckString(Text, Constrain)
{ 
	for (var i=0; i < Text.value.length; i++) 
	{
		var chr = Text.value.charAt(i).toLowerCase();
		if (Constrain.indexOf(chr) == -1)
		{	alert("Invalid character: " + chr);
			Text.focus();
			break; 
		}
	}
}
function CheckValueRange(Text, ValueFrom, ValueTo)
{	
	if ((parseInt(Text.value) < ValueFrom)  || (parseInt(Text.value) > ValueTo) )
   	{
		alert ('Value range must be from '+ ValueFrom +' to '+ ValueTo);
		Text.focus();

   	}	
}
function validateDollar( fld ) 
{ 
   var temp_value = fld.value; 

   if (temp_value == "") 
   { 
     fld.value = "$0.00"; 
     return; 
   } 
   var Chars = "0123456789.,$"; 
   for (var i = 0; i < temp_value.length; i++) 
   { 
       if (Chars.indexOf(temp_value.charAt(i)) == -1) 
       { 
           alert("Invalid Character(s)\n\nOnly numbers (0-9), a dollar sign, a comma, and a period are allowed in this field."); 
           fld.focus(); 
       fld.select(); 
           return; 
       } 
   } 
} 
function textCounter(textField, counterField, maxLimit) 
{
	if (textField.value.length > maxLimit) 
	{
		textField.value = textField.value.substring(0, maxLimit);
	}
	else
	{
		counterField.value = maxLimit - textField.value.length;
	}
}


//checks all DataGrid CheckBoxes with the given name with the givenvalue
//http://www.devx.com/tips/Tip/20238
function CheckAllDataGridCheckBoxes(aspCheckBoxID, checkVal) {

        re = new RegExp(':' + aspCheckBoxID + '$')  //generated control name starts with a colon

        for(i = 0; i < document.forms[0].elements.length; i++) {

            elm = document.forms[0].elements[i]

            if (elm.type == 'checkbox') {

                if ((re.test(elm.name)) && (elm.disabled == false)) {

                    elm.checked = checkVal

                }
            }
        }
}

function UnCheckAllDataGridCheckBoxes(CheckBoxAllID)
{
	elm = eval('document.forms[0].' + CheckBoxAllID);
	elm.checked = false;
}

function TextAreaCounter(textField, maxLimit) 
{
	if (textField.value.length > maxLimit) 
	{
		textField.value = textField.value.substring(0, maxLimit);
	}
}
function TextAreaCounterLabel(textField, maxLimit, labelNumberChars) 
{
	if (textField.value.length > maxLimit)
	{
		textField.value = textField.value.substring(0, maxLimit);
	}
	labelNumberChars.innerHTML = 'Total characters '+ textField.value.length +' of max '+ maxLimit;
}

function UrlEncode(plaintext)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};

function UrlDecode(encoded)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};

function onBeforeUnloadAction(){	
		window.close();
	}
	
//window.onbeforeunload = 
	
//-->
