
var intTimeUp, intTimeDown
var blnIsUp, blnIsDown
var intTop, intClip
var intClipTop, intClipBottom
var intHeight, intScrollJump
var intWidth, intScrolltime, intBoxHeight
var isMac = (navigator.userAgent.indexOf("Mac")  > -1);
var is_ie     = ((navigator.userAgent.indexOf("msie") != -1) && (navigator.userAgent.indexOf("opera") == -1));
var is_ie4    = (is_ie && (is_major == 4) && (navigator.userAgent.indexOf("msie 5")==-1) );
    	
	
intTop = 0
intHeight = 0
intClipTop = 0

//Edit this values to set proportions and scroll speed

intWidth = 470

intBoxHeight = 210
intScrollJump = 2

if (! isMac) {
	intScrolltime = 25
} else if (is_ie4) {
	intScrolltime = 1
} else {
	intScrolltime = 1
}

//End vars

//intClipBottom = intBoxHeight

function getScrollerHeight() {
	var objLayer

	objLayer = getLayer('theLayer')

	intHeight = getHeight(objLayer)

	//intHeight -= intBoxHeight

	intClipBottom = intHeight
	
	intHeight -= intBoxHeight
	
	//alert("H1: " + intHeight)
	
	
}


function scrollUp() {
	blnIsDown = false
	blnIsUp = true

	if (document.layers)
		document.theLayerContext.document.theLayer.top = intTop
	if (document.all) {
		document.all.theLayer.style.top = intTop
		document.all.theLayer.style.clip = 'rect(' + intClipTop + 'px ' + intWidth + 'px ' + (intBoxHeight + intClipTop) + 'px auto)'
		//alert('rect(' + intClipTop + 'px ' + intWidth + 'px ' + intClipBottom + 'px auto)');
		
	
	}

	if (blnIsUp && intTop > -intHeight) {
		intTop -= intScrollJump
		intClipTop += intScrollJump
		intClipBottom += intScrollJump
		intTimeUp = setTimeout("scrollUp()", intScrolltime)
	}
	else {
		blnIsUp = false
		clearTimeout(intTimeUp)
	}
}

function scrollDown() {
	blnIsUp = false
	blnIsDown = true

	if (document.layers)
		document.theLayerContext.document.theLayer.top = intTop
	if (document.all) {
		document.all.theLayer.style.top = intTop
		document.all.theLayer.style.clip = 'rect(' + intClipTop + 'px ' + intWidth + 'px ' + (intBoxHeight + intClipTop) + 'px auto)'
}

	if (blnIsDown && intTop <= 0) {
		intTop += intScrollJump
		intClipTop -= intScrollJump
		intClipBottom -= intScrollJump
		intTimeDown = setTimeout("scrollDown()", intScrolltime)
	}
	else {
		blnIsDown = false
		clearTimeout(intTimeDown)
	}
}


