﻿// JScript File
		function handleEnter (field, event) {
			var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
			if (keyCode == 13) {
				var i;
				for (i = 0; i < field.form.elements.length; i++)
					if (field == field.form.elements[i])
					break;
					i = (i + 1) % field.form.elements.length;
					field.form.elements[i].focus();
				return false;
			} 
			else
			return true;
	}
	
	//*************************************************************************************************************
	
   function OnDailyRecNomKeyDown(sender, evt)  
   {  
      //if event is undefined, define it  
      if (!evt)  
         evt = window.event;  
      //if key pressed was "enter", change it to "tab"  
      if (evt.keyCode == 13)  
         evt.keyCode = 9;  
   }  
   
   //*****************************************************************************************************************
   
function FormatNumber(num, format, shortformat)
{
	if(format==null)
	{
			// Choose the default format you prefer for the <b style="color:black;background-color:#a0ffff">number</b>. 
		//format = "#-(###) ###-#### ";		// Telephone w/ LD Prefix and Area Code
		format = "(###) ###-#### ";			// Telephone w/ Area Code
		//format = "###-###-####";			// Telephone w/ Area Code (dash seperated)
		//format = "###-##-####";			//Social Security <b style="color:black;background-color:#a0ffff">Number</b>
	}					

	if(shortformat==null)
	{
		// Choose the short format (without area code) you prefer. 
		//If you do not want multiple formats, leave it as "".

		//var shortformat = "###-#### ";
		var shortformat = "";
	}
	


	var validchars = "0123456789";
	var tempstring = "";
	var returnstring = "";
	var extension = "";
	var tempstringpointer = 0;
	var returnstringpointer = 0;
	count = 0;

	// Get the length so we can go through and remove all non-numeric characters
	var length = num.value.length;
		

	// We are only concerned with the format of the phone <b style="color:black;background-color:#a0ffff">number</b> - extensions can be left alone.
	if (length > format.length)
	{
		length = format.length;
	};
	
	// scroll through what the user has typed
	for (var x=0; x<length; x++)
	{
		if (validchars.indexOf(num.value.charAt(x))!=-1)
		{
		tempstring = tempstring + num.value.charAt(x);
		};
	};
	// We should now have just the #'s - extract the extension if needed
	if (num.value.length > format.length)
	{
		length = format.length;
		extension = num.value.substr(format.length, (num.value.length-format.length));
	};
	
	// if we have fewer characters than our short format, we'll default to the short version.
	for (x=0; x<shortformat.length;x++)
	{
		if (shortformat.substr(x, 1)=="#")
		{
			count++;
		};
	}
	if (tempstring.length <= count)
	{
		format = shortformat;
	};

	
	//Loop through the format string and insert the numbers where we find a # sign
	for (x=0; x<format.length;x++)
	{
		if (tempstringpointer <= tempstring.length)
		{
			if (format.substr(x, 1)=="#")
			{
				returnstring = returnstring + tempstring.substr(tempstringpointer, 1);
				tempstringpointer++;
			}else{
				returnstring = returnstring + format.substr(x, 1);
			}
		}
		
	}

	num.value = returnstring;
}	

function Reset1_onclick() {

}


var persistclose=0 //set to 0 or 1. 1 means once the bar is manually closed, it will remain closed for browser session
//var startX = 310 //set x offset of bar in pixels
var startX = 2
var startY = 30 //set y offset of bar in pixels
var verticalpos="fromtop" //enter "fromtop" or "frombottom"

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function closebar(){
if (persistclose)
document.cookie="remainclosed=1"
document.getElementById("topbar").style.visibility="hidden"
}

function staticbar(){
	barheight=document.getElementById("topbar").offsetHeight
	var ns = (navigator.appName.indexOf("Netscape") != -1) || window.opera;
	var d = document;
	function ml(id){
		var el=d.getElementById(id);
		if (!persistclose || persistclose && get_cookie("remainclosed")=="")
		el.style.visibility="visible"
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x+"px";this.style.top=y+"px";};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : iecompattest().scrollTop + iecompattest().clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function(){
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : iecompattest().scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight - barheight: iecompattest().scrollTop + iecompattest().clientHeight - barheight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("topbar");
	stayTopLeft();
}

