/*=======================================================================================
function showHelp() 
{
document.getElementById("helpcont").style.visibility = "visible";
}
function hideHelp()
{
document.getElementById("helpcont").style.visibility = "hidden";
}
==========================================================================================*/
/* code below places focus (cursor) on text area on page. Uses OnLoad="placeFocus()" in the body tag*/

function placeFocus()
{
  if (document.forms.length > 0) 
  {
    var field = document.forms[0];
    for (i = 0; i < field.length; i++) 
    {
      if ((field.elements[i].type == "text") 
           || (field.elements[i].type == "textarea") 
           || (field.elements[i].type.toString().charAt(0) == "s")) 
      {
        document.forms[0].elements[i].focus();
        break;
      }
    }
  }
}

/*
function help(URL) applies to the help link in the upper right part of the pages. Link will open a new help
screen. Individual help page names are defined on the parent web pages:
<DIV id="Help">
<A HREF="javascript:help('file:///J:/DATA/SHARED/IS_SP/WebStudioProjects/InPComplaintsEnv/InPComplaintsEnv/pages/pagename.html')" class="help">| Help</A>
</DIV>
*/

function help(URL) 
{
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0, scrollbars=yes, resizable=yes, width=450, height=360, left=0, top=0');");
}

function credits(URL) 
{
  day = new Date();
  id = day.getTime();
  eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0, scrollbars=no, resizable=yes, width=450, height=200, left=0, top=0');");
}

/*========================================================================================
Code below applies to the quick scroll. If the description below doesn't explain the code then nothing I write is going to help AT ALL!! Enjoy.
==========================================================================================*/
// ===================================================================
// Author: Matt Kruse <matt@mattkruse.com>
// WWW: http://www.mattkruse.com/
//
// NOTICE: You may use this code for any purpose, commercial or private, without any further 
// permission from the author. You may remove this notice from your final code if you wish, 
// however it is appreciated by the author if at least my web site address is kept. 
//
// You may *NOT* re-distribute this code in any way except through its use.
// That means, you can include it in your product, or your web site, or any other form where the 
// code is actually being used. You may not put the plain javascript up on your site for download 
// or include it in your javascript libraries for download. 
// If you wish to share this code with others, please just point them to the URL instead.
// Please DO NOT link directly to my .js files from your site. Copy the files to your server
// and use them there. Thank you.
// ===================================================================
// -------------------------------------------------------------------
// autoComplete ( text_input, select_input, ["text"|"value"], [true|false] )
//   Use this function when you have a SELECT box of values and a text input box with a fill-in 
//   value.  Often, onChange of the SELECT box will fill in the selected value into the text input 
//  (working like a Windows combo box). Using this function, typing into the text box will 
//   auto-select the best matchin the SELECT box and do auto-complete in supported browsers.
//   Arguments:
//      field = text input field object
//      select = select list object containing valid values
//      property = either "text" or "value". This chooses which of the SELECT properties gets 
//                 filled into the text box - the 'value' or 'text' of the selected option
//      forcematch = true or false. Set to 'true' to not allow any text in the text box that does 
//                   not match an option. Only supported in IE (possible future Netscape).
// -------------------------------------------------------------------
function autoComplete( field, select, property, forcematch )
{
  var found = false;
  for( var i = 0; i < select.options.length; i++ )
  {
    if ( select.options[i][property].toUpperCase().indexOf( field.value.toUpperCase() ) == 0 )
    {
      found = true;
      break;
    }
  }
  if ( found ) 
  {
    select.selectedIndex = i;
  }
  else
  {
    select.selectedIndex = -1;
  }
  if ( field.createTextRange )
  {
    if ( forcematch && !found )
    {
      field.value = field.value.substring( 0, field.value.length - 1 );
      return;
    }
    var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
    if ( cursorKeys.indexOf( event.keyCode+";" ) == -1 )
    {
      var r1 = field.createTextRange();
      var oldValue = r1.text;
      var newValue = found ? select.options[i][property] : oldValue;
      if ( newValue != field.value )
      {
        field.value = newValue;
        var rNew = field.createTextRange();
        rNew.moveStart( 'character', oldValue.length );
        rNew.select();
      }
    }
  }
}

// The showCaseDetails() and showCaseEvents() functions toggle between
// showing a Case Details Pane (DIV) and a Case Events Pane (DIV)
//================================================================
function showCaseDetails() 
{
  document.getElementById("CaseDetailPane").style.visibility = "visible";
  document.getElementById("CaseEventPane").style.visibility = "hidden";
}
function showCaseEvents()
{
  document.getElementById("CaseEventPane").style.visibility = "visible";
  document.getElementById("CaseDetailPane").style.visibility = "hidden";
}
//==================================================================

function showMenu() 
{
  document.getElementById("Menu").style.visibility = "visible";
}
function closeMenu() 
{
  document.getElementById("Menu").style.visibility = "hidden";
}
function toggleMenu()
{
  if ( document.getElementById("Menu").style.visibility == "hidden" )
  {
    document.getElementById("Menu").style.visibility = "visible";
  }
  else
  {
    document.getElementById("Menu").style.visibility = "hidden";
  }
}

//==================================================================
//	function: doFocus
//	** allows cursor to automatically advance to next input box in a series; ie. ssn input
//  Code as it appears in an HTML input tag: 
//  <INPUT type="text" name="TAX_ID_1" tabindex="1" size="4" maxlength="4" onKeyUp="doFocus(TAX_ID_1,4,TAX_ID_2,doSelect)">
//	var doSelect = true; must be added within <SCRIPT language="Javascript"> tag
//================================================================
var doSelect = true;

function doFocus(thisctl,maxlen,nextctl,selectflag) 
   {
     if ((maxlen == false) || (maxlen < 1)) {
      return true
   }
   if (thisctl.value.length == maxlen) {
      nextctl.focus()
      if (selectflag == true) {
         nextctl.select()
      }
      return true
      }
   }

