﻿
/***********************************************
* Modified to be able to use multiple marquees - StaffIT/DJO.
*
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var delayb4scroll = 2500;

function scroller (outterContainerId,innerContainerId,scrollAmt,pauseit) {
	this.outterContainerId = outterContainerId;
	this.innerContainerId = innerContainerId;
	this.marqueespeed = scrollAmt;
	this.copyspeed=scrollAmt;
	this.pausespeed=(pauseit==0)? copyspeed: 0;
	this.actualheight='';
	this.cross_marquee = null;
	this.actualHeight = 0;
	this.marqueeheight = 0;
}

function scrollmarquee(o){
    if (o.cross_marquee) {
	    if (parseInt(o.cross_marquee.style.top)>(o.actualheight*(-1)+8))
		    o.cross_marquee.style.top=parseInt(o.cross_marquee.style.top)-o.copyspeed+"px";
	    else
		    o.cross_marquee.style.top=parseInt(o.marqueeheight)+8+"px";
	}
}

function initializemarquee(o){
	o.cross_marquee = document.getElementById(o.innerContainerId);
	if (o.cross_marquee) {
	    o.cross_marquee.style.top=0;
	    o.marqueeheight=document.getElementById(o.outterContainerId).offsetHeight;
	    o.actualheight=o.cross_marquee.offsetHeight;
	    if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
		    o.cross_marquee.style.height=o.marqueeheight+"px";
		    o.cross_marquee.style.overflow="scroll";
	    return;
	    }
	}
}

function scrollmarquees() {
	scrollmarquee(projScroller);
}

var projScroller;
function initializemarquees() {
	projScroller = new scroller("projOutter","projInner",2,1);
	initializemarquee(projScroller);

	setTimeout('lefttime=setInterval("scrollmarquees()",100)', delayb4scroll);
}


if (window.addEventListener)
window.addEventListener("load", initializemarquees, false);
else if (window.attachEvent)
window.attachEvent("onload", initializemarquees);
else if (document.getElementById)
window.onload=initializemarquees;


//
// start scrolling
//
function startScroll(obj) {
	// not all browsers that support Marquee have start/stop methods
	if (obj.start) {
		obj.start();
	}
	else { 
		obj.scrollAmount = 2;
	}
}

//
// stop scrolling
//
function stopScroll(obj) {
	// not all browsers that support Marquee have start/stop methods
	if (obj.stop) {
		obj.stop();
	}
	else {
		obj.scrollAmount = 0;
	}
}

