//JavaScript Document
//<![CDATA[
$(document).ready(function () {
							
	var moving = false;
	var dontmove = false;
	//$("#move_up").css("display", "none");
	$("#move_up").fadeTo(0 , 1);
		
	if ($('#scrolltext').innerHeight() < $("#hometextcontainer").height()) {
		$("#move_down").fadeTo(0 , 1);
		dontmove = true;	
	}
	
	$("#move_down").mousehold(function(){							   
		if (dontmove == false) {
			var top = $("#scrolltext").css("top");		
			//var display = $("#move_up").css("display");
			var display = $("#move_up").fadeTo(0 , 1);
			var height = $('#scrolltext').innerHeight();	
			var containerHeight = $("#hometextcontainer").css("height");			
			top = top.replace("px","")
			containerHeight = containerHeight.replace("px","")
				
			top = parseInt(top)
			containerHeight = parseInt(containerHeight)
			
			var maxTop = height - containerHeight;
				
			maxTop = maxTop - (maxTop*2);
				
			var nextTop = top - 80;
		
			if (nextTop < maxTop) {			
				nextTop = maxTop;
			}
			
			if (display == "none") {		
				//$("#move_up").css("display","inline");
				$("#move_up").fadeTo(0 , 1);
			}
	
			
			if (moving == false) {	
				moving = true;
				$("#scrolltext").animate({"top": nextTop}, 300, "linear", function(){
					 moving = false;
					 if (nextTop == maxTop) {
						$("#move_down").css("display","none");
					 }
				});
			}
		}
	});	
	
	$("#move_up").mousehold(function(){
		if (dontmove == false) {							 
			var top = $("#scrolltext").css("top");	
			var display = $("#move_down").css("display");	
			top = top.replace("px","")	
			top = parseInt(top)
				
			maxTop = 0;
			
			var nextTop = top + 80;
			
			if (nextTop > maxTop) {		
				nextTop = maxTop;	
			}
			
			if (display == "none") {		
				$("#move_down").css("display","inline");
			}
	
			
			if ((top < 0) && (moving == false)) {
				moving = true;
				$("#scrolltext").animate({"top": nextTop}, 300, "linear", function(){
					 moving = false;	
					if (nextTop == maxTop) {
						//$("#move_up").css("display","none");
						$("#move_up").fadeTo(0 , 1);
					}
				});
			}
		}
	});	
});
//]]>

