document.onkeydown = analyseKey;
document.onkeyup = checkIfReset;

function analyseKey(evt) {
    evt = (evt) ? evt : ((event) ? event : null);
    if (evt) {
	if(evt.keyCode == 38){
		movedown_cursor('scrollcontent',10);
	}
	if(evt.keyCode == 40){
		moveup_cursor('scrollcontent',10);
	}
	if(evt.keyCode == 33){
		movedown_cursor('scrollcontent',100);
	}
	if(evt.keyCode == 34){
		moveup_cursor('scrollcontent',100);
	}
    }
}

function checkIfReset(evt) {
    var layer = 'scrollcontent';
    var top = parseInt(document.getElementById(layer).style.top) + document.getElementById(layer).offsetHeight - 200;
    evt = (evt) ? evt : ((event) ? event : null);
    if (evt) {
    	if(parseInt(document.getElementById(layer).style.top) > 0){
		document.getElementById(layer).style.top = "0px";
    	}
    }
}


function moveup_cursor(layer,pixel){
      var top = parseInt(document.getElementById(layer).style.top) + document.getElementById(layer).offsetHeight - 200;
      if(document.getElementById(layer).offsetHeight >= (hoeheFliess+20) && top >=0){
        document.getElementById(layer).style.top = parseInt(document.getElementById(layer).style.top) - pixel + "px";
      }
}
function movedown_cursor(layer,pixel){
      if(document.getElementById(layer).offsetHeight >= hoeheFliess && parseInt(document.getElementById(layer).style.top) < 0){
        document.getElementById(layer).style.top = parseInt(document.getElementById(layer).style.top) + pixel + "px";
      }
}
