<!-- Javascript for Message Boards scrolling unit -->
<!-- Original: Eddie Traversa (psych3@primus.com.au) -->
<!-- Edited: Orla Leland - January 2009 -->
<!-- Begin
var topMargin = 0;
var slideTime = 1000;
var ff = (!document.all && document.getElementById);
var ie = (document.all);

function layerObject(id,left) {
    if (ff) {
        this.obj = document.getElementById(id).style;
        this.obj.left = left;
        return this.obj;
    } else if(ie) {
        this.obj = document.all[id].style;
        this.obj.left = left;
        return this.obj;
    }                                                       
}

function layerSetup() {
    floatLyr = new layerObject('floatingDiv', pageWidth * .0);
    window.setInterval("main()", 150)
}

function floatObject() {                                
    if(ie) {
        findHt = document.body.clientHeight;
    }
}

function main() {                                       
    if(ff) {
        this.currentY = parseInt(document.getElementById('floatingDiv').style.top);
		//if (this.currentY > 400) {
		//    this.scrollTop = scrollY - 375;
		//} else {
			this.scrollTop = scrollY;
		//}
        mainTrigger();
    } else if(ie) {
        this.currentY = floatingDiv.style.pixelTop;
		//if (this.currentY > 10) {
		//     this.scrollTop = document.body.scrollTop - 320;
		//} else {
			 this.scrollTop = document.body.scrollTop;
		//}
        mainTrigger();
    }
}

function mainTrigger() {
    if (this.scrollTop >= 0 && this.scrollTop <= 250) {
		var newTargetY = this.scrollTop + this.topMargin;
	} else  {
		var newTargetY = this.scrollTop - 250;
	}

    if ( this.currentY != newTargetY ) {
        if ( newTargetY != this.targetY ) {
            this.targetY = newTargetY;
            floatStart();
        }
    
    animator();
    }   
}

function floatStart() {
    var now = new Date();
    this.A = this.targetY - this.currentY;
    this.B = Math.PI / ( 2 * this.slideTime );
    this.C = now.getTime();
    if (Math.abs(this.A) > this.findHt) {
        this.D = this.A > 0 ? this.targetY - this.findHt : this.targetY + this.findHt;
        this.A = this.A > 0 ? this.findHt : -this.findHt;
    } else {
        this.D = this.currentY;
    }
}

function animator() {
    var now = new Date();
    var newY = this.A * Math.sin( this.B * ( now.getTime() - this.C ) ) + this.D;
    newY = Math.round(newY);
    if (( this.A > 0 && newY > this.currentY ) || ( this.A < 0 && newY < this.currentY )) {
        if ( ie )document.all.floatingDiv.style.pixelTop = newY;
        if ( ff )document.getElementById('floatingDiv').style.top = newY + "px";
    }
}

function start() {
    if(ff) {
        pageWidth = innerWidth;
        pageHeight = innerHeight;
        layerSetup();
        floatObject();
    } else if(ie) {
        pageWidth = document.body.clientWidth;
        pageHeight = document.body.clientHeight;
        layerSetup();
        floatObject();
    }
}
// End -->