var isIE4
var isNav4
var isNav6

function autoScroll() {
	if (scrollDirection == "down") {
		scrollJump = Math.abs(scrollJump)
	} else if (scrollDirection == "up" && scrollJump > 0) {
		scrollJump = -scrollJump
	}
	document.getElementById( 'scroll_clipper' ).scrollTop += scrollJump;
}
function scrollIt( argID ) {
	thing = document.getElementById( argID )
	x = document.getElementById( 'output' )
	tOff = thing.offsetTop
	tHeight = thing.offsetHeight

	minScroll = -tHeight+171
	if (scrollDirection == "down") {
		scrollJump = Math.abs(scrollJump)
		next = tOff+scrollJump
		if (next<home) {
			x.innerHTML = tHeight
			setIdProperty( argID, 'top', next )
		}
	}  else {
		scrollJump = Math.abs(scrollJump)
		next = tOff-scrollJump
		if (next>minScroll) {
			x.innerHTML = tHeight
			setIdProperty( argID, 'top', next )
		}
	}
}
function setBrowser()
{
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0)
        {
            isIE4 = true;
        }
        else
        {
            isNav4 = true;
        }
    }
    else if (navigator.appVersion.charAt(0) > "4")
    {
        isNav6 = true;
    }
}

function getStyleBySelector( selector )
   {
       var sheetList = document.styleSheets;
       var ruleList;
       var i, j;
   
       /* look through stylesheets in reverse order that
          they appear in the document */

       for (i=sheetList.length-1; i >= 0; i--)
       {
           ruleList = sheetList[i].cssRules;
           for (j=0; j<ruleList.length; j++)
           {
               if (ruleList[j].type == CSSRule.STYLE_RULE && 
                   ruleList[j].selectorText == selector)
               {
                   return ruleList[j].style;
               }   
           }
       }
       return null;
   }

function setIdProperty( id, property, value )
{
    if (isNav6)
    {
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[ property ] = value;
        }
    }
    else if (isNav4)
    {
        document[id][property] = value;
    }
    else if (isIE4)
    {
         document.all[id].style[property] = value;
    }
}

function getIdProperty( id, property )
{
        var styleObject = document.getElementById( id );
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
}

function reduceInterval() {
	stopScroll()
	scrollSpeed -= 50
	startScroll()
}
function increaseInterval() {
	stopScroll()
	scrollSpeed += 50
	startScroll()
}
function swapDirection() {
	scrollDirection = (scrollDirection == "down") ? "up" : "down"
}
function startScroll() {
	if (intervalID) {
		clearInterval(intervalID)
	}
	intervalID = setInterval("autoScroll()",scrollSpeed)
}
function stopScroll() {
	clearInterval(intervalID)
}

