/*#########################################*\
#											#
#	This script is developed by:			#
#	 Ken Joergensen							#
#	 http://machiawelli.com					#
#	 kj@machiawelli.com						#
#											#
#	License									#
#	 As long as you retain this notice		#
#	 you can do whatever you want with		#
#	 this Script.							#
#	 If you think this script is useful,	#
#	 I'll happily accept beer in return.	#
#	 Maybe even a couple of beers.			#
#											#
#	By the way								#
#	 If you use my script i would be happy	#
#	 to see it in function, e-mail a link	#
#	 to kj@machiawelli.com					#
#	 Thanks and enjoy						#
#											#
\*#########################################*/

var mac_end_target = 0;
var mac_run;
var mac_xtra = 0;
function mac_run_scroll(){
	if(document.getElementById("mac_scrollarea").scrollTop < mac_end_target){
		mac_ryk = Math.round((mac_end_target-document.getElementById("mac_scrollarea").scrollTop)/6);
		if(mac_ryk == 0){
			document.getElementById("mac_scrollarea").scrollTop = mac_end_target;
			window.clearInterval(mac_run);
		}else{
			document.getElementById("mac_scrollarea").scrollTop = document.getElementById("mac_scrollarea").scrollTop+mac_ryk;
		}
	}else{
		mac_ryk = Math.round((document.getElementById("mac_scrollarea").scrollTop-mac_end_target)/6);
		if(mac_ryk == 0){
			document.getElementById("mac_scrollarea").scrollTop = mac_end_target;
			window.clearInterval(mac_run);
		}else{
			document.getElementById("mac_scrollarea").scrollTop = document.getElementById("mac_scrollarea").scrollTop-mac_ryk;
		}
	}
}
function mac_scroll_up(){
	if(document.getElementById("mac_scrollarea").scrollTop == mac_end_target && document.getElementById("mac_scrollarea").scrollTop > 0){
		mac_end_target = document.getElementById("mac_scrollarea").scrollTop-(parseInt(document.getElementById("mac_scrollarea").style.height)+mac_xtra);
		mac_run = window.setInterval("mac_run_scroll()", 10);
	}
}
function mac_scroll_down(){
	if(document.getElementById("mac_scrollarea").scrollTop == mac_end_target && document.getElementById("mac_scrollarea").scrollHeight > Math.round((document.getElementById("mac_scrollarea").scrollTop+mac_xtra)+parseInt(document.getElementById("mac_scrollarea").style.height))){
		mac_end_target = document.getElementById("mac_scrollarea").scrollTop+(parseInt(document.getElementById("mac_scrollarea").style.height)+mac_xtra);
		mac_run = window.setInterval("mac_run_scroll()", 10);
	}
}
function mac_scroll_to(mac_end_target){
	if(document.getElementById("mac_scrollarea").scrollTop == mac_end_target && document.getElementById("mac_scrollarea").scrollTop > 0){
		mac_run = window.setInterval("mac_run_scroll()", 10);
	}
}
function mac_load_scroll(){
	mac_end_target = document.getElementById("mac_scrollarea").scrollTop;
}
document.onload = mac_load_scroll();
