/** scroller for IE5+, FF1+
 * Written by Yotam Sar-Shalom
 * (C)Copyright 2005 Opal website and softwares developments
 */
var ver = navigator.appVersion;
var dom = document.getElementById ? 1: 0;
var nIE5 = ( ver.indexOf('MSIE 5') > -1 && dom ) ? 1 : 0;
var nIE6 = ( ver.indexOf('MSIE 6') > -1 && dom ) ? 1 : 0;
var nNS5 = ( dom && parseInt(ver) >= 5 ) ? 1 : 0;
var nNS4 = ( document.layers && !dom ) ? 1 : 0;

var roll = 0;
var scrollerDiv = 0;
function initScroller(wrapperId, scrollerDivId) {
	if(!wrapperId) wrapperId = "scrollDiv";
	if(!scrollerDivId) scrollerDivId = "scrollContent";
	wrapper = document.getElementById(wrapperId);
	scrollerDiv = document.getElementById(scrollerDivId); 
	
	startScroller();

	// IE
	if(window.attachEvent) {
		offsetTop = wrapper.offsetHeight;
		scrollerDiv.style.top = offsetTop;
		wrapper.attachEvent('onmouseover', stopScroller);
		wrapper.attachEvent('onmouseout', startScroller);
	}
	// Firefox
	else {
		offsetTop = wrapper.offsetHeight+'px';
		scrollerDiv.style.top = offsetTop;
		wrapper.addEventListener('mouseover', stopScroller, false);
		wrapper.addEventListener('mouseout', startScroller, false);		
	}
}
function scroll() {	
	scrollerDiv.style.top = getHeight();
	if(parseInt(scrollerDiv.style.top) < -parseInt(scrollerDiv.offsetHeight)) 
		scrollerDiv.style.top = offsetTop;
}
function getHeight() {
	var height=0;
	if(nNS4 || nNS5) {
		height = parseInt(scrollerDiv.style.top)-1 + "px";
	}
	else {
		height = parseInt(scrollerDiv.style.top)-1;
	}
	return height;
}
function startScroller() {
	roll = setInterval("scroll()", 50);
}		
function stopScroller(e) {
	clearInterval(roll);
}
