// begin absolutely positioned autoscroll area object scripts

/*
Modified by Gavin Butler - Spec-Net Pty Ltd (Copyright (c) 2004)
2004-04-01 12:34
*/

/*
Extension developed by David G. Miles (www.z3roadster.net/dreamweaver)
Original Scrollable Area code developed by Thomas Brattli (www.bratta.com)
To add more shock to your site, visit www.DHTML Shock.com
*/

function verifyCompatibleBrowser() {
	this.ver = navigator.appVersion;
	this.dom = document.getElementById ? 1 : 0;
	this.ie5 = (this.ver.indexOf("MSIE 5") > -1 && this.dom) ? 1 : 0;
	this.ie4 = (document.all && !this.dom) ? 1 : 0;
	this.ns5 = (this.dom && parseInt(this.ver, 10) >= 5) ? 1 : 0;
	this.ns4 = (document.layers && !this.dom) ? 1 : 0;
	this.bw = (this.ie5 || this.ie4 || this.ns4 || this.ns5);
	return this;
}

bw = new verifyCompatibleBrowser();
count = 0;
lstart = 50;
loop = true;
speed = 150;
pr_step = 1;

function ConstructObject(obj,nest) {
	nest = (!nest) ? '' : 'document.' + nest + '.';
	this.el = bw.dom ? document.getElementById(obj) : bw.ie4 ? document.all[obj] : bw.ns4 ? eval(nest + 'document.' + obj) : 0;
  	this.style = bw.dom ? document.getElementById(obj).style : bw.ie4 ? document.all[obj].style : bw.ns4 ? eval(nest + 'document.' + obj) : 0;
	this.scrollHeight = bw.ns4 ? this.style.document.height : this.el.offsetHeight;
	this.newsScroll = newsScroll;
	this.moveIt = b_moveIt;
	this.x;
	this.y;
	this.obj = obj + "Object";
	eval(this.obj + "=this");
	return this;
}

function b_moveIt(x,y) {
	this.x = x;
	this.y = y;
	this.style.left = this.x + 'px';
	this.style.top = this.y + 'px';
}

//Makes the object scroll up
function newsScroll(speed) {
	if (this.y > -this.scrollHeight) {
		if (count == 0) {
			setTimeout(this.obj + ".newsScroll(" + speed + ")", 5000);
		} else {
			this.moveIt(0, this.y-pr_step);
			setTimeout(this.obj + ".newsScroll(" + speed + ")", speed);
		}
		count++;
	} else if(loop) {
		fadeOut('divASContainer');
		this.moveIt(0, lstart);
		fadeIn('divASContainer');
		eval(this.obj + ".newsScroll(" + speed + ")");
		count = 1;
	}
}

//Makes the object
function InitialiseAutoScrollArea() {
	objContainer = new ConstructObject('divASContainer');
	objContent = new ConstructObject('divASContent', 'divASContainer');
	objContent.moveIt(0,0);
	objContainer.style.visibility = 'visible';
	if (bw.ns5) {
		objContent.style.position = 'relative';
	}
	objContent.newsScroll(speed);
}

opac = 0;

//Make the layer fade in
function fadeIn(obj) {
	if(opac <= 100) {
		opac += 5;
		if (document.all) {
			document.all(obj).filters.alpha.opacity = opac;
		} else if (document.getElementById) {
			document.getElementById(obj).style.MozOpacity = (opac/100);
                }
		setTimeout("fadeIn('divASContainer')", 50);
	} else {
                opac = 0;
        }
}

//Make layer opaque
function fadeOut(obj) {
	if(document.all) {
		document.all(obj).filters.alpha.opacity = 0;
	} else if (document.getElementById) {
		document.getElementById(obj).style.MozOpacity = 0;
        }
}

function Pause() {
	pr_step = 0;
}

function Resume() {
	pr_step = 1;
}

function Fast() {
	pr_step = 8;
}

function Up() {
	if (objContent.y < -20) {
		objContent.moveIt(0, objContent.y + 20);
	} else if (objContent.y >= -20 && objContent.y < 20) {
		objContent.moveIt(0, -1);
	} else if(objContent.y >= 20) {
		objContent.moveIt(0, -1);
	}
	count=0;
}

function Down() {
	objContent.moveIt(0, objContent.y - 20);
	count = 0;
}
// end absolutely positioned scrollable area object scripts

