/* Manual Scroller 
*  $Id$
* 
* Created : 10.06.2006
* Autor : Manfred Ursprung, Dynamic Drive
* ** slightly changed, inspired by http://www.dynamicdrive.com/dynamicindex2/manualscroll.htm
* 
*/
/* specify speed of scroll (greater=faster) */
var speed=4;
var crossobj;
var contentheight;
var node4Scroll = "newsContent"	;		//id of tag which will be scrolled

var iens6=document.all||document.getElementById;
// we don't support Netscape 4  ns4=document.layers

var initManualScroller = function(_node4Scroll){
	node4Scroll = _node4Scroll;	
	if (iens6){
		crossobj=$(_node4Scroll);
		contentheight = 0;
		try{
			var childs = crossobj.descendants();		//alle Kindelemente
			childs.pluck('offsetHeight').each(function(height){		//die Höhe aller Kindelemente addiern
				contentheight += height;
			});
			movetop();
		}catch(e){
			//alert("Exception : Scroller konnte nicht initialisiert werden");
		}
	}else{
	 	alert("We are sorry, but your browser dont't support this feature ");
	}
	//alert("Contentheight: " + contentheight);
}


var movedown = function (){
	if (window.moveupvar) clearTimeout(moveupvar);
	if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100)){
		crossobj.style.top=parseInt(crossobj.style.top)-speed+"px";
	}
	movedownvar=setTimeout("movedown()",20);
}
	
var moveup = function (){
	if (window.movedownvar) clearTimeout(movedownvar);
	if (iens6&&parseInt(crossobj.style.top)<=0){
		crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"
	}
	moveupvar=setTimeout("moveup()",20);
}
	
var stopscroll = function (){
	if (window.moveupvar) clearTimeout(moveupvar);
	if (window.movedownvar) clearTimeout(movedownvar);
}
	
var movetop = function (){
	stopscroll();
	if (iens6){
		crossobj.style.top=0+"px";
	}
}
	
function getcontent_height(){
	if (iens6){
		contentheight=crossobj.offsetHeight;
	}
}
