function KeyDownEvent(event)
{	
    var event = new Event(event);
    
    if(event.control)
    {	
	    var archiveid = $('archive_cb2').getValue();
    	var currentid = $('hiddenCurrent').getValue();
       
	    if(event.key == "right")
	    {
		    var lastid = $('hiddenLast').getValue();
		    var nextpos = $('hiddenNext').getValue();

		    if(currentid != lastid)
		    	GoToPage(archiveid, nextpos);
		    	
		    return;
	    }
	    else if(event.key == "left")
	    {
		    var prevpos = $('hiddenPrev').getValue();
		    
		    if(prevpos != currentid)
		   		GoToPage(archiveid, prevpos);
		   		
		   	return;
	    }
	    else if(event.key == "down")
	    {
		    $('grid').scrollTop = $('grid').scrollTop + 10;
	    }
	    else if(event.key == "up")
	    {
		    if( ($('grid').scrollTop - 10) < 0)
		    	$('grid').scrollTop = 0;
		    else
		    	$('grid').scrollTop =  $('grid').scrollTop - 10;
	    }		    
	}
}

document.onkeydown = KeyDownEvent;
window.onkeydown = KeyDownEvent;