// JavaScript Document

//roll-over images
var upArrowLt = new Image (14,17);
var upArrow = new Image (14,17);
var downArrowLt = new Image (14,17);
var downArrow = new Image (14,17);
upArrowLt.src = "images/up_arrow_lt.gif";
upArrow.src = "images/up_arrow.gif";
downArrowLt.src = "images/down_arrow_lt.gif";
downArrow.src = "images/down_arrow.gif";

// Scrolling functions

// make scroll work with Firefox (requiring px units) and IE (requiring no units)
if(navigator.appName == "Microsoft Internet Explorer") {
	var units=''
} else {
	var units='px';
}

window.onload = function() {
	loadscrollposition();
}

// global variables
var pubHeight = 0;
var toppos = 0;

function loadscrollposition() {
	var pubDivHolder = document.getElementById('pubDivHolder');
	
	var pubDivHolderHeight = pubDivHolder.offsetHeight;
	pubHeight = -1*((pubDivHolderHeight)-500);
	
	if (pubDivHolder.currentStyle) 
		var toppos=pubDivHolder.currentStyle['top'];
	else if (window.getComputedStyle) 
		var toppos=document.defaultView.getComputedStyle(pubDivHolder,null).getPropertyValue('top');
	
	toppos=toppos.replace(/px/, '');
	toppos=parseInt(toppos,10);
	
	pubDivHolder.style.top = toppos+units;
}

Stop=false;

// scroll
function scroll(dir) {
	if(!Stop) {
		toppos=document.getElementById('pubDivHolder').style.top;
		toppos=toppos.replace(/px/, '');
		toppos=parseInt(toppos,10);
		if(dir == 'up') {
			if(toppos < 0) {
				toppos+=10;
			}
		}
		if(dir == 'down') {
			if(toppos > pubHeight) {
				toppos-=10;
			}
		}
		if(window.innerWidth) {
			document.getElementById('pubDivHolder').style.top = toppos + units;
		} else {
			if (document.getElementById) {
				document.getElementById('pubDivHolder').style.pixelTop = toppos + units;
			} else if(document.all) {
				document.all['pubDivHolder'].style.pixelTop = toppos + units;
			}
		}
		if(dir == 'up') { setTimeout("scroll('up')", 40); } else { setTimeout("scroll('down')", 40); }
	}
}