function KeyShort(param)
{
  if (param.exec)
  {
    if (typeof param.exec == 'string')
      this.exec_=new Function('item',param.exec);
    else
      this.exec_=param.exec;
  }
  else
    this.exec_="";

  if (param.act)
    this.act_=param.act;
  else
    this.act_="";
  if (param.actp)
    this.actp_=param.actp;
  else
    this.actp_="";

  if (param.actmult)
    this.actmult_=param.actmult;
  else
    this.actmult_="";
  if (param.actpmult)
    this.actpmult_=param.actpmult;
  else
    this.actpmult_="";

  if (param.operation)
    this.operation_=param.operation;
  else
    this.operation_="";

  if (param.target)
    this.target_=param.target;
  else
    this.target_="";

  if (param.winstyle)
    this.winstyle_=param.winstyle;

  if (param.url)
    this.url_=param.url;
  else
    this.url_="";

  if (param.opobj)
    this.opobj_=param.opobj;
  else
    this.opobj_=false;
}

KeyShort.prototype.exec=function(obj)
{
  if (this.exec_){
    this.exec_();
  }
  var theurl="";
  if (this.act_)
  {
    if (!this.opobj_ || typeof move !="function")
      theurl=obj;
    theurl+=getAction(this.act_,this.actp_);
  }
  else if (this.url_)
    theurl=this.url_;

  var theurlmult="";
  if (this.actmult_)
    theurlmult=obj+getAction(this.actmult_,this.actpmult_);

  if (theurl.length)
  {
    if((this.op_ || this.opobj_) && typeof move=="function")
    {
      move((this.operation_!="")?this.operation_:this.actp_,{target:this.target_,url:theurl,urlmult:theurlmult,onsel:this.opobj_});
    }
    else
    {
      if (this.target_){
        if (typeof opDlg =="function")
        {
          if (this.winstyle_)
            opDlg(theurl,this.target_,this.winstyle_);
          else
          {
            opDlg(theurl,this.target_);
          }
        }
        else
        {
          var h=window.screen.height;
          h*=0.75;
          window.open(theurl,this.target_,"status=yes,toolbar=no,scrollbars=yes,resizable=yes,width=640,height="+h);
        }
      }
      else {window.location.href=theurl;}
    }
  }
}

function KeyShorts()
{
  this.obj_="";
  this.keyShorts_=new Array();
}

KeyShorts.prototype.setObj=function(obj)
{
  this.obj_=obj;
}

KeyShorts.prototype.add=function(param)
{
  if (param.key)
  {
    this.keyShorts_[param.key]=new KeyShort(param);
    if (param.obj)
      this.obj_=param.obj;
  }
}

KeyShorts.prototype.exec=function(letter)
{
  if (this.keyShorts_[letter])
  {
    this.keyShorts_[letter].exec(this.obj_);
  }
}

var keyShortcuts=new KeyShorts();

function keypressed(e)
{
  var key=getKeyObject(e);
  if (key.shiftKey && key.ctrlKey && key.keyCode!=0)
  {
    keyShortcuts.exec(key.letter);
  }

  if (typeof kp != "undefined" && kp.sonkeypress)
      return kp.sonkeypress(e);
  else if (navigator.appName=="Netscape")
    return routeEvent(e); // return if handled
  else
    window.event.returnValue = true;
  return true;
}

function getKeyObject(e)
{
  if (navigator.appName=="Netscape")
    return new KeyObject(e);
  else
    return new KeyObject(window.event);
}

function KeyObject(e)
{
  this.ALT_MASK=1;
  this.CONTROL_MASK=2;
  this.SHIFT_MASK=4;
  if (navigator.appName=="Netscape")
  {
    this.keyCode=e.which;
    this.ctrlKey=(e.modifiers&Event.CONTROL_MASK)?true:false;
    this.shiftKey=(e.modifiers&Event.SHIFT_MASK)?true:false;
    this.altKey=(e.modifiers&Event.ALT_MASK)?true:false;
  }
  else
  {
    this.keyCode=e.keyCode;;
    this.ctrlKey=e.ctrlKey;
    this.shiftKey=e.shiftKey;
    this.altKey=e.altKey;
  }
  this.modifiers=(this.ctrlKey?0:this.CONTROL_MASK)||(this.shiftKey?0:this.SHIFT_MASK)||(this.altKey?0:this.ALT_MASK);
  if (navigator.appName=="Netscape")
  {
    var inc=0;
    if (this.ctrlKey && this.keyCode<32 && this.keyCode>0)
      inc=64;
    this.letter=String.fromCharCode(this.keyCode+inc);
  }
  else
  this.letter=String.fromCharCode(this.keyCode);
}

if (navigator.appVersion.indexOf("X11",0) == -1)
{
  if (navigator.appName=="Netscape")
  {
    window.captureEvents(Event.KEYDOWN);
    window.onkeydown=keypressed;
  }
  else
  {
    window.document.onkeydown=keypressed;
  }
}


