var slideIntervalL;
var slideIntervalR;
var times=30;
function resetcounter(){
	times=30;
	}
function moveUp(){
  var gallery = document.getElementById("innercontent");
  if(stripped(gallery.style.top)*1<0){
	slideIntervalL = setInterval("stepup()",40);
	}
	resetcounter();
  return false;
	}
	
function stepup(){
	var gallery = document.getElementById("innercontent");
	if(times>=1 && stripped(gallery.style.top)*1<0){
		gallery.style.top=stripped(gallery.style.top)*1+5+"px";
		times--;
		}
	else{
		clearInterval(slideIntervalL);
		//alert(gallery.style.left);
		}
	}

function makepos(value){
	//turns negative values into integers (needed for moveRight)
	if(value.indexOf("-")!=-1){
		return value.substr(1,value.length);
		}
	else{
		return value;
		}
	}

function moveDown(count){
  var gallery = document.getElementById("innercontent");
  //hoogte vd div berekenen
  divheight = gallery.scrollHeight;
  if(makepos(stripped(gallery.style.top)) <= (divheight-200)){
	 slideIntervalR = setInterval("stepdown()",40);
	 } 
	resetcounter();
  return false;
	}
	
function stepdown(){
	var content = document.getElementById("innercontent");
	  //hoogte vd div berekenen
 	 divheight = content.scrollHeight;

	if(times>=1 && (stripped(content.style.top) <= (divheight-200))){
		content.style.top=stripped(content.style.top)*1-5+"px";
		times--;
		}
	else{
		clearInterval(slideIntervalR);
		//alert(gallery.style.left);
		}
	}
	
function stripped(value){
	//strips off trailing px of a value
	if(value.indexOf("px")!=-1){
		return value.substr(0,value.length-2);
		}
	else{
		return value;
		}
	}
	
function pausecomp(millis)
{
date = new Date();
var curDate = null;

do { var curDate = new Date(); }
while(curDate-date < millis);
}