/*  KIL - Key Induced Login, version 1.0
 *  (c) 2008 John Schroeter
 *  Uses Lightwindow to open login popup
/*--------------------------------------------------------------------------*/

// if a key is pressed catchkey function gets called
document.onkeypress=catchkey;
// rbx variable gets set to 0
var rbx=0;
// function checks keycodes at keyspress events
function catchkey(e){
  e=!e?event:e;
  tastenCode=e.keyCode?e.keyCode:e.which;
  // if a particular key is pressed the corresponding function gets called
  if(tastenCode==114) r();
  if(tastenCode==98)  b();
  if(tastenCode==120) x();
  // if neither r nor b nor x is hit rbx variable is set to 0
  if(tastenCode!=114 && tastenCode!=98 && tastenCode!=120) rbx=0;
}

function r(){
// if r is pressed rbx variable gets set to 1
rbx=1;
}

function b(){
  if(rbx==1){
    // if b is pressed after r was pressed rbx variable gets set to 1+2=3
    rbx=rbx+2;
  }else{
    // ...otherwise rbx variable is set to 0
    rbx=0;
  }
}

function x(){
  if(rbx==3){
    // if r and b have been pressed in correct otder rbx variable gets set to 0...
    rbx=0;
    // ...and login function gets called
    login();
  }else{
    // ...otherwise rbx variable is set to 0
    rbx=0;
  }
}

// opens lightwindow popup containing login site
function login(){
  myLightWindow.activateWindow({
	  href: 'rbx_inc/rbx_login.php', 
	  title: 'Login',
    width: '220',
    height: '110' 
  });
}