var arrowMove = 1;

// to catch the key press events with charcode
//first, tell the browsers to react to the event
if( document.captureEvents && Event.KEYUP ) {
  //remove this part if you do not need Netscape 4 to work
  document.captureEvents( Event.KEYUP );
}
/*if( document.captureEvents && Event.KEYDOWN ) {
  //remove this part if you do not need Netscape 4 to work
  document.captureEvents( Event.KEYDOWN );
}*/

/* this next line tells the browser to detect a keyup
event over the whole document and when it detects it,
it should run the event handler function 'alertkey' */
document.onkeyup = alertkey;
//document.onkeydown = alertkeydown;
//now create the event handler function to process the event
function alertkey(e) {
  if( !e ) {
    //if the browser did not pass the event information to the
    //function, we will have to obtain it from the event register
    if( window.event ) {
      //Internet Explorer
      e = window.event;
    } else {
      //total failure, we have no way of referencing the event
      return;
    }
  }
  if( typeof( e.keyCode ) == 'number'  ) {
    //DOM
    e = e.keyCode;
  } else if( typeof( e.which ) == 'number' ) {
    //NS 4 compatible
    e = e.which;
  } else if( typeof( e.charCode ) == 'number'  ) {
    //also NS 6+, Mozilla 0.9+
    e = e.charCode;
  } else {
    //total failure, we have no way of obtaining the key code
    return;
  }
  //window.alert('The key pressed has keycode ' + e +
   //' and is key ' + String.fromCharCode( e ) );
  if (e==27)
  Close();
/*  if (e==83) and (altKey = true)
  addEvent('<%=request("d")%>');*/
 /* if ((e==37) && (arrowMove == 1)) {
	  if(datecursor > 1){
		removeCursor();
		 datecursor -= 1;
		 moveCursor();
	  }
  }
    if ((e==38) && (arrowMove == 1)){
		if(datecursor > 7){
		removeCursor();
  datecursor -= 7;
		 moveCursor();
		}
  }
    if ((e==39) && (arrowMove == 1)){
		if(datecursor < daysInMonth[nowDate.getMonth()]){
		removeCursor();
  datecursor += 1;
		 moveCursor();
		}
  }
    if ((e==40) && (arrowMove == 1)){
		if(datecursor < (daysInMonth[nowDate.getMonth()]-6)){
		removeCursor();
  datecursor += 7;
		 moveCursor();
		}
  }
  if ((e==79) && (arrowMove == 1))
  {
	var xhmonth = nowDate.getMonth()+1
	var xhyear = nowDate.getYear()  
	searchSales(xhmonth,datecursor,xhyear);overlay();
  }
    if ((e==13) && (arrowMove == 1))
  {
	var xhmonth = nowDate.getMonth()+1
	var xhyear = nowDate.getYear()  
	searchSales(xhmonth,datecursor,xhyear);overlay();
  }*/
  
  //addEvent('<%=request("d")%>')
  
 /* if (((e==83) && (ctrlKey == true)) && (arrowMove == 0))
  {
  //alert('to be saved')
  addEvent('<%=request("d")%>');
  }*/
  
  //to catch L to open login box showLoginBox()
 /*     if ((e==76) && (arrowMove == 1))
  {
	showLoginBox();
  }*/
}


