// unique scrolling viewport for at least IE,NS >= 4, th 2001-05-11

var tempN = navigator.appName
var tempV = parseInt(navigator.appVersion)

var ns6 = (tempN == "Netscape" && tempV > 4)? true:false
var ns4 = (tempN == "Netscape" && tempV <= 4)? true:false
var ie4 = (tempN == "Microsoft Internet Explorer" && tempV >= 4)? true:false

var containerHeight = 200
var contentHeight = 0
var time = 0
var pxsuffix = ""

function init() {

		if (ns4) { //document.layers
    		    content = document.containerDiv.document.contentDiv
                content.xpos = content.left
				content.ypos = content.top
				contentHeight = content.document.height
				if (contentHeight > containerHeight) {
					document.layers['navup'].visibility = "show"
					document.layers['navdown'].visibility = "show"
				}
        }
        if (ie4 == true) { //document.all
                content = contentDiv.style
                content.xpos = parseInt(content.left)
                content.ypos = parseInt(content.top)
				contentHeight = document.all.stopper.offsetTop
				//parseInt, weil (lt. DOM2) in IE5pc und NS6 px angefuehrt wird
				if (contentHeight > containerHeight) {
					navup.style.visibility = "visible"
					navdown.style.visibility = "visible"
				}
        }
        if (ns6) { //document.getElementById
                content = document.getElementById('contentDiv').style
                content.xpos = parseInt(content.left)
                content.ypos = parseInt(content.top)
				pxsuffix="px"
				contentHeight = parseInt(getStyle('contentDiv','height'))
				if (contentHeight > containerHeight) {
					document.getElementById('navup').style.visibility = "visible"
					document.getElementById('navdown').style.visibility = "visible"
				}
		}
// 		document.onkeydown = checkKeyDown
// 		document.onkeyup = checkKeyUp
		self.focus()
}

function getStyle(el,styleProp){	
	var x = document.getElementById(el);	
	if (document.defaultView)		
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	else if (x.currentStyle)
		var y = eval('x.currentStyle.' + styleProp);
	return y;
}


// function checkKeyDown(event) {
// 	if (event.which == 30) up()
// 	if (event.which == 31) down()
// }

// function checkKeyUp(event) {
// 	stop()
// }

function move(obj,x,y) {
        obj.xpos = parseInt(obj.xpos) + parseInt(x)
        obj.ypos = parseInt(obj.ypos) + parseInt(y)
        obj.left = obj.xpos + pxsuffix
        obj.top = obj.ypos + pxsuffix
}

function up() {
	if (content.ypos < 0)	{
		move(content,0,3)
		time = setTimeout('up()',10)
	}
}

function down() {
	if ((contentHeight-containerHeight+content.ypos) > 0)	{
		move(content,0,-3)
		time = setTimeout('down()',10)
	}
}

function stop() {
	if (time) clearTimeout(time)
}

function reload() {
	if (ns4) window.location.href = window.location.href
}