//The web is free and so is my code - Use it for what you wish!
// $~D  Joe B.
var clipTop = 0;
var clipWidth = 600;
var clipBottom = 320;
var topper = 235;
var lyrheight = 0;
var time,amount,theTime,theHeight,DHTML;

function init()
{
	DHTML = (document.getElementById || document.all || document.layers);
	if (!DHTML) return;
	var x = new getObj('divMain');
	setDivs();
	if (document.layers)
	{		
		lyrheight = x.style.clip.bottom;
		lyrheight += 20;
		x.style.clip.top = clipTop;
		x.style.clip.left = 0;
		x.style.clip.right = clipWidth;
		x.style.clip.bottom = clipBottom;
	}
	else if (document.getElementById || document.all)
	{
		lyrheight = x.obj.offsetHeight;
		var clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)';
		x.style.clip = clipstring;
	}
	else {
		alert('Your browser is outdated. Please upgrade your version in order to view this site.');
	}
}

function scrollayer(layername,amt,tim)
{
	if (!DHTML) return;
	thelayer = new getObj(layername);
	if (!thelayer) return;
	amount = amt;
	theTime = tim;
	realscroll();
}

function stopScroll()
{
	if (time) clearTimeout(time);
}

function realscroll()
{
	if (!DHTML) return;
	clipTop += amount;
	clipBottom += amount;
	topper -= amount;
	if (clipTop < 0 || clipBottom > lyrheight)
	{
		clipTop -= amount;
		clipBottom -= amount;
		topper += amount;
		return;
	}
	if (document.getElementById || document.all)
	{
		clipstring = 'rect('+clipTop+'px,'+clipWidth+'px,'+clipBottom+'px,0)'
		thelayer.style.clip = clipstring;
		thelayer.style.top = topper + 'px';
	}
	else if (document.layers)
	{
		thelayer.style.clip.top = clipTop;
		thelayer.style.clip.bottom = clipBottom;
		thelayer.style.top = topper;
	}
	time = setTimeout('realscroll()',theTime);
}

function vis(val)
{
	if (!DHTML) return;
	var f = new getObj('divMain');
	f.style.visibility = val;
}

function getObj(name)
{
  if (document.getElementById)
  {
    this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
    this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function setDivs() {
	if (document.all) {
		document.getElementById('divMain').style.posLeft = ((screen.width/2) - 365);
		document.getElementById('divMain').style.posTop = 245;
		document.getElementById('divNav').style.posRight = (screen.width/2) - 390;
		document.getElementById('divNav').style.posBottom = 600;
		document.getElementById('divMain').style.display = '';
		document.getElementById('divNav').style.display = '';
	}
	else {
		document.getElementById('divMain').style.left = ((window.innerWidth/2) - 305);
		document.getElementById('divMain').style.top = 215;
		document.getElementById('divNav').style.right = ((window.innerWidth/2) - 345);
		document.getElementById('divNav').style.bottom = 600;
		document.getElementById('divMain').style.display = '';
		document.getElementById('divNav').style.display = '';
	}
}
function swapArrow(strName) {
	if(strName.indexOf('up') > -1) {
		document.getElementById('up').src = 'images/' + strName + '.gif';
	}
	else {
		document.getElementById('down').src =  'images/' + strName + '.gif';
	}
}

