function getKeyCode( evnt )
{
  var key;
  if( evnt.keyCode )
  {
    key = evnt.keyCode;
  }
  else
  {
    key = evnt.which;
  }

  return key;
}

function isReturn( evnt )
{
  var key = getKeyCode( evnt )
  return ( key == 13 );
}

function submitForm( item, evnt )
{
  if ( isReturn(evnt) )
  {
    if ( typeof(item)!="undefined" && typeof(item.form)!="undefined" && typeof(item.form.submit)!="undefined" )
    {
      item.form.submit();
    }
  }
}

var currentdiv = "";
var currentclass = "";
function swapdiv( dv, className )
{
  if ( currentdiv!="" )
  {
    getElt(currentdiv).style.display="none";
  }
  currentdiv = dv;
  if ( currentdiv!="" )
  {
    getElt(currentdiv).style.display="block";
  }
}
function sameheight( dv1, dv2 )
{
  if ( getlayerheight(dv1)>getlayerheight(dv2) )
  {
    sizelayer( dv2, getlayerwidth(dv2)+"px", getlayerheight(dv1)+"px" );
  }
  else
  {
    sizelayer( dv1, getlayerwidth(dv1)+"px", getlayerheight(dv2)+"px" );
  }
}
function changeSearchDropdown( disc, sector, line1, line2, lst )
{
  sector.options.length = 0;
  var optId = -1;
  if ( disc!=null && typeof(disc)!="undefined" )
  {
    optId = disc.options[disc.selectedIndex].value;
  }
  if ( optId>0 )
  {
    sector.options[sector.options.length] = new Option( sectornames[optId], optId );
    var arr = lst[optId];
    for ( i=0; typeof(arr)!="undefined" && i<arr.length; i++ )
    {
    	sector.options[sector.options.length] = new Option( " - " + arr[i][1], arr[i][0] );
    }
  }
  else
  {
    sector.options[sector.options.length] = new Option( line1, "" );
    sector.options[sector.options.length] = new Option( line2, "" );
  }
}
function passbox ( e )
{
  getElt("password_off").className="displayNone";
  getElt("password_on").className="displayBlock";
  e.form.elements["loginPassword"].focus();
}