/*
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100's more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Credit MUST stay intact

Modified by Gered King (flingmaster5000@hotmail.com) - February 2005
  - cleaned up code
  - prefixed functions with "news_"
  - added news_setWidth(), news_setHeight(), news_addContent()
  - news_populate() now requires a DIV id passed which will be the scrolling target
  - Modified to use a scrollbar
  - added news_stopScroll() and news_resumeScroll()

*/

// Specify the marquee's width (in pixels)
var marqueewidth = "180px";
// Specify the marquee's height
var marqueeheight = "190px";
// Specify the marquee's marquee speed (this is the speed in milliseconds... i.e. larger = slower)
var marqueespeed = 100;
// Pause marquee onMousever (0=no. 1=yes)?
var pauseit = 1;

// Specify the marquee's content
// Keep all content on ONE line, and backslash any single quotations (ie: that\'s great):

var marqueecontent = '';


////NO NEED TO EDIT BELOW THIS LINE////////////

var fromclick = false;
var constantcopyspeed = 1;      // Since copyspeed will get changed when paused, we need to define the speed to reset
                                // it back to when scrolling gets resumed...
var copyspeed = constantcopyspeed;  		        // Amount of pixels to move news by per move
var pausespeed = (pauseit == 0) ? copyspeed : 0;
var iedom = document.all || document.getElementById;
var actualheight = '';
var cross_marquee, ns_marquee;
var cross_body, ns_body;

// Set width of the area being scrolled
function news_setWidth(width)
{
	marqueewidth = width;
}

// Set height of the area being scrolled
function news_setHeight(height)
{
	marqueeheight = height;
}

// Add content to be scrolled (can contain HTML)
function news_addContent(content)
{
	marqueecontent += content + '<br/><br/>';
}

// divID = DIV element that will have it's contents scrolled
// divBodyID = the DIV containing divID... this is actually the one that has the scrollbars
function news_populate(divID, divBodyID)
{
	if (iedom)
	{
		cross_marquee = document.getElementById ? document.getElementById(divID) : document.all.news;
		cross_body = document.getElementById ? document.getElementById(divBodyID) : document.all.newsBody;
		//cross_marquee.style.top = parseInt(marqueeheight) + 8 + "px";
		cross_marquee.style.top = 0 + "px";
		cross_marquee.innerHTML = marqueecontent;
		actualheight = cross_marquee.offsetHeight;
	}
	else if (document.layers)
	{
		ns_marquee = document.ns_marquee.document.ns_marquee2;
		//ns_marquee.top = parseInt(marqueeheight) + 8;
		ns_marquee.top = 0;
		ns_marquee.document.write(marqueecontent);
		ns_marquee.document.close();
		actualheight = ns_marquee.document.height;
	}
	lefttime = setInterval("news_scroll()", marqueespeed);
}

function news_scroll()
{
	if (iedom)
	{
		cross_body.scrollTop += copyspeed;
		if (cross_body.scrollTop + parseInt(cross_body.offsetHeight) == cross_body.scrollHeight)
		    copyspeed = copyspeed * -1;
		else if (cross_body.scrollTop == 0)
		    copyspeed = copyspeed * -1;
	}
	else if (document.layers)
	{
		if (ns_marquee.top > (actualheight * (-1) + 8))
			ns_marquee.top -= copyspeed;
		else
			ns_marquee.top = parseInt(marqueeheight) + 8;
		//ns_marquee.scrollTop = ns_marquee.top;
	}
}

// Stops the content from scrolling
function news_stopScroll(bFromClick)
{
    if (!bFromClick && !fromclick)
        fromclick = false;
    if (bFromClick)
        fromclick = true;
    if (copyspeed != pausespeed)
        constantcopyspeed = copyspeed;
    copyspeed = pausespeed;
}

// Starts the content scrolling
function news_resumeScroll(bFromClick)
{
    if (bFromClick)
    {
        copyspeed = constantcopyspeed;
        fromclick = false;
    }
    else if (!bFromClick && !fromclick)
        copyspeed = constantcopyspeed;
}

