//The following class will provide a wrapper mecanism for a scrolling
//maqruee. The fucntionality of cross rowser has not been fully expanded
//to include all div components.


/*
The following section represents the "instance" variables used by the TickerWrapper object
*/

//Specify the marquee's width (in pixels)
var marqueewidth="300px";
//Specify the marquee's height
var marqueeheight="35px";
//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2;
//Specify initial pause before scrolling in milliseconds
var initPause=0;
//Specify start with Full(1)or Empty(0) Marquee
var full=0;
//configure background color:
var marqueebgcolor="";
//Pause marquee onMousever (0=no. 1=yes)?
var pauseit=1;

var marqueecontent = ' ';
var marqueecontent2 = ' ';
var actualwidth=' ';
var actualwidth2=' ';
var copyspeed = ' ';
var pausespeed = ' ';
var cross_marquee = ' ';
var cross_marquee2 = ' ';
var cross_marquee3 = ' ';
var cross_marquee4 = ' ';
var ns_marquee = ' ';
var initFill = ' ';
var iedom = ' ';
var mContent2Top = ' ';

/*
Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and Terms Of Use, visit http://www.dynamicdrive.com
Modified by jscheuer1 for continuous content. Credit MUST stay intact
*/

/*
Constructor for TickerWrapper object
*/

function TickerWrapper(mWidth, mHeight, mSpeed, hasInitialPause, isFull, mBGColor, shouldPause, content2Top,mContent, mContent2){
	marqueewidth=mWidth;
	marqueeheight=mHeight;
	marqueespeed=mSpeed;
	initPause=hasInitialPause;
	full=isFull;
	marqueebgcolor=mBGColor;
	pauseit=shouldPause;
	marqueecontent = mContent;
        if(mContent2 == null)
        marqueecontent2 = "";
        else
	marqueecontent2 = mContent2;
        mContent2Top = content2Top;
}

function initiateScroll(){
	copyspeed=marqueespeed;
	pausespeed=(pauseit==0)? copyspeed: 0;
	iedom=document.all||document.getElementById;
	if (iedom){
	document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>');

        if(marqueecontent2 != null || marqueecontent2 != "")
	document.write('<span id="temp2" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent2+'</span>');
	}


if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>');
if (iedom){
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">');
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">');
write('<div id="iemarquee" style="position:absolute;left:0px;top:0px;display:inline;"></div>');
write('<div id="iemarquee2" style="position:absolute;left:0px;top:0px;display:inline;"></div>');

if(marqueecontent2 != null || marqueecontent2 != ""){
write('<div id="iemarquee3" style="position:absolute;left:0px;top:'+mContent2Top+'px;display:inline;"></div>');
write('<div id="iemarquee4" style="position:absolute;left:0px;top:'+mContent2Top+'px;display:inline;"></div>');
}

write('</div></div>');
}
else if (document.layers){
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" >');
write('<layer name="ns_marquee2" left=0 top=3 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>');
write('</ilayer>');
}
document.write('</td></table>');
}
}
window.onload=populate;
}



function populate(){
	if (iedom){
	initFill=(full==1)? '8px' : parseInt(marqueewidth)+8+"px";
	actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth;
	actualwidth2=document.all? temp2.offsetWidth : document.getElementById("temp2").offsetWidth;

	cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee;
	cross_marquee.style.left=initFill;
	cross_marquee2=document.getElementById? document.getElementById("iemarquee2") : document.all.iemarquee2;
	cross_marquee2.innerHTML=marqueecontent;
        cross_marquee.innerHTML=marqueecontent;
	cross_marquee2.style.left=(parseInt(cross_marquee.style.left)+actualwidth+8)+"px";//indicates following #1

        if(marqueecontent2 != null || marqueecontent2 != ""){
	cross_marquee3=document.getElementById? document.getElementById("iemarquee3") : document.all.iemarquee3;
	cross_marquee3.style.left=initFill;
	cross_marquee4=document.getElementById? document.getElementById("iemarquee4") : document.all.iemarquee4;
	cross_marquee4.innerHTML=marqueecontent2;
        cross_marquee3.innerHTML=marqueecontent2;
	cross_marquee4.style.left=(parseInt(cross_marquee3.style.left)+actualwidth2+8)+"px"; //indicates following #1
        }

	} else if (document.layers){
        ns_marquee=document.ns_marquee.document.ns_marquee2;
        ns_marquee.left=parseInt(marqueewidth)+8;
	ns_marquee.document.write(marqueecontent);
        ns_marquee.document.close();
        actualwidth=ns_marquee.document.width;
	}
	setTimeout('lefttime=setInterval("scrollmarquee()",30)',initPause);
}

function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.left)<(actualwidth*(-1)+8))
cross_marquee.style.left=(parseInt(cross_marquee2.style.left)+actualwidth+8)+"px";
else
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px";
if (parseInt(cross_marquee2.style.left)<(actualwidth*(-1)+8))
cross_marquee2.style.left=(parseInt(cross_marquee.style.left)+actualwidth+8)+"px";
else
cross_marquee2.style.left=parseInt(cross_marquee2.style.left)-copyspeed+"px";

if(marqueecontent2 != null || marqueecontent2 != ""){
if (parseInt(cross_marquee3.style.left)<(actualwidth2*(-1)+8))
cross_marquee3.style.left=(parseInt(cross_marquee4.style.left)+actualwidth2+8)+"px";
else
cross_marquee3.style.left=parseInt(cross_marquee3.style.left)-copyspeed+"px";
if (parseInt(cross_marquee4.style.left)<(actualwidth2*(-1)+8))
cross_marquee4.style.left=(parseInt(cross_marquee3.style.left)+actualwidth2+8)+"px";
else
cross_marquee4.style.left=parseInt(cross_marquee4.style.left)-copyspeed+"px";
}

}
else if (document.layers){
if (ns_marquee.left>(actualwidth*(-1)+8))
ns_marquee.left-=copyspeed;
else
ns_marquee.left=parseInt(marqueewidth)+8;
}
}


/* Prototype(s) for TickerWrapper */
TickerWrapper.prototype.initiateScroll = initiateScroll;

