var tid = 0;
var speed = 5;

function startScrollUp(){
	 if(tid==0){
		tid=setInterval('scrollUp("locations")',100);
	}

}

function stopScrollUp(){
	if(tid!=0){
		clearInterval(tid);
		tid=0;
		speed=5;
	}
}

function startScrollDown(){
	 if(tid==0){
		tid=setInterval('scrollDown("locations")',100);
	}

}

function stopScrollDown(){
	if(tid!=0){
		clearInterval(tid);
		tid=0;
		speed=5;
	}
}

function scrollUp(aDiv){
	var scrollDiv = document.getElementById(aDiv);
	
	var top = scrollDiv.style.top;
	
	if(scrollDiv.offsetHeight>215){
		if(!top){
			top = "-5";
			scrollDiv.style.top = top + "px";
		} else if((scrollDiv.offsetHeight + parseInt(top.substring(0,top.length-2))) > 215){
			top = parseInt(top.substring(0,top.length-2)) - speed;
			scrollDiv.style.top = top + "px";
		}
		
		
	}
	
	speed = speed + 1;
}

function scrollDown(){
	var scrollDiv = document.getElementById(aDiv);
	
	var top = scrollDiv.style.top;
	
	if(scrollDiv.offsetHeight>215){
		if(parseInt(top.substring(0,top.length-2)) < 0 ){
			top = parseInt(top.substring(0,top.length-2)) + speed;
			scrollDiv.style.top = top + "px";
		}
		
		
	}
	
	speed = speed + 1;
}
