// this function will test the page for a form, and apply focus on the first non hidden field of the first form 
function GimmeFocus()
    {
	// test for the existance of a form
    if(document.forms[0])
	    {

		var count1 = 0;
		var count2 = 0;
        // loop over forms until you find the first non hidden form
        while(count1<document.forms.length)
    		{
    		if(document.forms[count1].parentNode.style.display!='none'&&document.forms[count1].parentNode.style.visibility!='hidden')
        		{
           		// loop over fields until you find the first non hidden field
    		    while(count2<document.forms[count1].elements.length)
            		{
             		if(document.forms[count1].elements[count2].type !='hidden'&&document.forms[count1].elements[count2].type.search('select') == -1)
                        {
            			document.forms[count1].elements[count2].focus();
            			return true;
            			}// end of if(current field is not hidden)
        	    count2++;
                    }// end of while(x is less than number of fields)
                }// end of if form is visible
             count1++;
             }// end of while looping over forms

   		}// end of if(document.forms[0])
    } // end of function GimmeFocus()

function popUp() {
  var newWind=window.open('', 'remote', 'menubar=1,resizable=1,scrollbars=1');
  if (newWind.opener == null) {
  	newWind.opener = window;
	};
}

function formHandler(){
var URL = document.frm1.ID.options
[document.frm1.ID.selectedIndex].value;
window.location.href = URL;
}

function dateHandler(){
var URL = document.frm1.catchdate.options
[document.frm1.catchdate.selectedIndex].value;
window.location.href = URL;
}

function calendar(passedbox){
var x = 300; // the width of the window
var y = 220; // the height of the window
// calculate the center of the screen for positioning window there	
var xPos = Math.round( (screen.width/2) - (x/2) );
var yPos = Math.round( (screen.height/2) - (y/2) );
var url = "default.cfm?fuseaction=tools.popupcalendar&passedbox=" + passedbox;
var newWindow = window.open(url, 'newWin', 'width=' + x + ', height=' + y + ',scrollbars=yes,resizable=yes,left=' + xPos 
+ ',top=' + yPos + ',screenX=' + xPos + ',screenY=' + yPos,true)
}

function activeHelp(){
var x = 612; // the width of the window
var y = 400; // the height of the window
// calculate the center of the screen for positioning window there	
var xPos = Math.round( (screen.width/2) - (x/2) );
var yPos = Math.round( (screen.height/2) - (y/2) );
var url = "default.cfm?fuseaction=help.content";
var newWindow = window.open(url, 'newWin', 'width=' + x + ', height=' + y + ',scrollbars=yes,resizable=yes,left=' + xPos 
+ ',top=' + yPos + ',screenX=' + xPos + ',screenY=' + yPos,true)
}
