//Specify the marquee's marquee speed (larger is faster 1-10)
var marqueespeed=2
var marqueewidth;
var marqueeheight;
var marqueecontent;
var actualwidth='';

function scrollme( text, width, height)
{
	marqueewidth=width;
	marqueeheight=height;
	marqueecontent='<nobr>'+text+'</nobr>';

	//slow speed down by 1 for NS
	marqueespeed=(document.all)? marqueespeed : Math.max(1, marqueespeed-1);
	iedom=document.all||document.getElementById;
	if (iedom)		document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent+'</span>');

	if (iedom||document.layers)
	{
		with (document)
		{
			document.write('<table class="scroll"><td>')
			if (iedom)
			{
				write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
				write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+'"')
				write('<div id="iemarquee" style="position:absolute;left:0px;top:0px"></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=0></layer>')
				write('</ilayer>')
			}
			document.write('</td></table>')
		}
	}
}
function populate()
{
	if (iedom)
	{
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
		cross_marquee.innerHTML=marqueecontent
		actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
	}
	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
	}
	lefttime=setInterval("scrollmarquee()",30)
}

function scrollmarquee()
{
	if (iedom)
	{
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
			cross_marquee.style.left=parseInt(cross_marquee.style.left)-marqueespeed+"px"
		else
			cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
	}
	else if (document.layers)
	{
		ns_marquee=document.ns_marquee.document.ns_marquee2
		if (ns_marquee.left>(actualwidth*(-1)+8))
			ns_marquee.left-=marqueespeed
		else
			ns_marquee.left=parseInt(marqueewidth)+8
	}
}


function MM_swapImgRestore()
{ //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d)
{ //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage()
{ //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Fading(array, container, delay)
{
	var me = this;
	this.transparency = 100;
	this.divArray = array;
	this.canSpin = true;
	this.suspended = false;
	this.delay = delay;
	var ran_unrounded=Math.random()*this.divArray.length;
	this.currentIndex = Math.floor(ran_unrounded);
	cont = document.getElementById(container);
	
	var element;
	var i;
	for(i=0 ;i<array.length; i++)
	{
		element = document.getElementById(array[i]);
		element.style.width = (cont.parentNode.parentNode.width-10+'px');
	}
	
	this.DivFading = function ()
	{
		if(this.canSpin == false && (this.transparency == 0))
		{
			this.suspended = true;
			return;
		}
	
		if(this.transparency <= 100)
		{
			t = 100 - this.transparency;
			//for IE
			this.todiv.style.filter="alpha(opacity="+this.transparency+")";
			this.fromdiv.style.filter="alpha(opacity="+t+")";
			//for FireFox
			this.todiv.style.opacity = +this.transparency/100;
			this.fromdiv.style.opacity=t/100;
			this.fromdiv.style.display = 'block';
			this.todiv.style.display = 'block';
			this.transparency += 5;
			setTimeout(function(){me.DivFading();}, 50);
		}
		else 
		{
			this.fromdiv.style.display = 'none';
			this.GetNextObjects();
			this.transparency = 0;
			setTimeout(function(){me.DivFading();}, 10000+this.delay);
			this.delay = 0;
		}
		return;
	}
	this.GetNextObjects = function()
	{
		this.fromdiv = document.getElementById(array[this.currentIndex]);
		nextIndex = this.currentIndex + 1;
		if(nextIndex == this.divArray.length)
			nextIndex = 0;
		this.todiv = document.getElementById(array[nextIndex]);

		this.currentIndex = this.currentIndex+1;
		if(this.currentIndex == this.divArray.length)
			this.currentIndex = 0;
	}
	this.StopSpinning = function()
	{
		this.canSpin = false;
	}
	this.StartSpinning = function()
	{
		if(this.canSpin == true)
			return;
		this.canSpin = true;
		if(this.suspended == true)
		{
			this.suspended = false;
			me.DivFading();
		}
	}
	this.GetNextObjects();
	this.DivFading();
	cont.onmouseleave = function(){me.StartSpinning();};
	cont.onmouseenter = function(){me.StopSpinning();};
}
