var scrolling = 0;	// Controls whether the layer is scrollin or not
var yT = 20;// Pixel position the top of the scrolling layer should be set to
var lT = 20;// Initial position for the top of the layer
var yI = 5;	// Increment that the scrolling layer should move at
var yH = 0;
var domStyle;	// Stores the generic DOM for the scrolling layer to access style properties
var dom;	// Stores the generic DOM for the scrolling layer
var isDHTML = 0;
var isLayers = 0;
var isAll = 0;
var isID = 0;

if (document.images){ 
imag = new Array();
imag[0] = "../img/arrowUp_off.gif";
imag[1] = "../img/arrowUp_on.gif";
imag[2] = "../img/arrowDown_off.gif";
imag[3] = "../img/arrowDown_on.gif";
imag[4] = "../img/arrowTop_off.gif";
imag[5] = "../img/arrowTop_on.gif";
imag[6] = "../img/arrowBottom_off.gif";
imag[7] = "../img/arrowBottom_on.gif";

im = new Array();
for (var i = 0; i < imag.length; i++)
	{
		im[i] = new Image();
		im[i].src = imag[i];
		}
}
if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID1,objectID2,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID2).style) ; }
		else { 
			if (isAll) { return (document.all[objectID2].style); }
		else {
			if (isLayers) { 
				if (objectID1) { return (document.layers[objectID1].layers[objectID2]); }
				else { return (document.layers[objectID2]); }
			}
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID2)) ; }
		else { 
			if (isAll) { return (document.all[objectID2]); }
		else {
			if (isLayers) { 
				if (objectID1) { return (document.layers[objectID1].layers[objectID2]); }
				else { return (document.layers[objectID2]); }
			}
		};}
	}
}

function startScroll(objectID1,objectID2,direction) {
	domStyle = findDOM(objectID1,objectID2,1);
	dom = findDOM(objectID1,objectID2,0);
	scrolling = 1;
	yT = domStyle.top;
	if (document.getElementById) {
		pxLoc = yT.indexOf('px');
		if (pxLoc >= 1) yT = yT.substring(0,pxLoc); 
	}
	if (window.innerHeight != null) 
		yH = window.innerHeight - 25;
	else 
		yH = document.body.clientHeight - 25;
	if (dom.offsetHeight != null) 
		yH = yH - dom.offsetHeight;
	else
		yH = yH - dom.clip.height;
	scroll(direction);
}	

function scroll(direction) {
	

	if (scrolling == 1) {
		if ((direction == 1) && (yT <= lT)) {
			yT = (yT/1) + yI;
			if (yT > lT) yT = lT; 
			domStyle.top = yT; 
		}
		else { 
			if ((direction == 0) && (yT >= yH)) {
				yT -= yI;
				if (yT < yH) yT = yH; 
				domStyle.top = yT; }
		}
		if (document.getElementById) {
			yT = domStyle.top;
			pxLoc = yT.indexOf('px');
			if (pxLoc >= 1) yT = yT.substring(0,pxLoc); 
		}
		code2run = 'scroll('+ direction + ')';
		setTimeout(code2run,0);
	}
	return false;
}

function stopScroll() { 
	scrolling = 0;
	dom = null;
	domStyle = null;
	return false;
}

function URB(objectID1,objectID2) {
	domStyle = findDOM(objectID1,objectID2,1);
	dom = findDOM(objectID1,objectID2,0);
	if (window.innerHeight != null) 
		yH = window.innerHeight - 25;
	else 
		yH = document.body.clientHeight - 25;
	if (dom.offsetHeight != null) 
		yH = yH - dom.offsetHeight;
	else
		yH = yH - dom.clip.height;
	domStyle.top = yH;
	dom = null;
	domStyle = null;
}

function URT(objectID1,objectID2) {
		domStyle = findDOM(objectID1,objectID2,1);
		domStyle.top = lT;
		dom = null;
		domStyle = null;
}
	
function toggle(imgName,num){	
	if (document.images && imgName){
		imgName.src = im[num].src;
	}
	return false;
}

