// Ticker engine file

var mtc_sitecodes_NEW="MTCSITE100";
var mtc_tickerwidth_NEW="883px";
	
var mtc_content_NEW = new Array();
var mtc_sitecodes_NEW = new Array();
var mtc_urls_NEW = new Array();
var mtc_enddates_NEW = new Array();

//Get msg content from http://ticker.511.org/include/tickerengine.js
if(typeof(mtc_content) != "undefined" && typeof(mtc_content[0]) != "undefined" && mtc_content[0] != '') {
	
	for (var i=0; i < 10; i++) {
		if(typeof(mtc_content[i]) != "undefined" && mtc_content[i] != '') {
			mtc_content_NEW[i] = mtc_content[i];
			mtc_sitecodes_NEW[i] = "MTCSITE100~";
			mtc_urls_NEW[i] = mtc_urls[i];
			//alert(mtc_content_NEW[i]);
		}
	}
	
} else {
	
	//mtc_content_NEW[0] = "<a href='http://511.org/about-511-suggestions.asp'>Welcome to the new 511.org. Please let us know what you think.</a>";
	mtc_content_NEW[0] = "";
	mtc_sitecodes_NEW[0] = "MTCSITE100~";
	mtc_urls_NEW[0] = "";
	
}

if (!mtc_content_NEW)
    var mtc_content_NEW = new Array();
if (!mtc_sitecode_NEW)
    var mtc_sitecode_NEW = "~";
if (!marqueecontent_NEW)
    var marqueecontent_NEW="";
if (!mtc_tickerwidth_NEW)
    var mtc_tickerwidth_NEW="700px";
if (!marqueespeed_NEW)
    var marqueespeed_NEW=2;
if (!marqueebgcolor_NEW)
    var marqueebgcolor_NEW="#FFFFFF";
if (!mtc_tickersep_NEW)
    var mtc_tickersep_NEW = " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";

for (var i = 0; i < mtc_content_NEW.length; i++)
{
    var siteCodeString_NEW = mtc_sitecodes_NEW[i];
    
    if ((siteCodeString_NEW.search( mtc_sitecode_NEW ) != -1))
    {
        marqueecontent_NEW = marqueecontent_NEW + mtc_content_NEW[i];
        if (i != (mtc_content_NEW.length - 1))
        {
			marqueecontent_NEW = marqueecontent_NEW + mtc_tickersep_NEW;
        }
    }
}

//Specify the marquee's height
var marqueeheight_NEW="14px";

//Pause marquee onMousever (0=no. 1=yes)?
var pauseit_NEW=1;

////NO NEED TO EDIT BELOW THIS LINE////////////
marqueespeed_NEW=(document.all)? marqueespeed_NEW : Math.max(1, marqueespeed_NEW-1) //slow speed down by 1 for NS
var copyspeed_NEW=marqueespeed_NEW
var slowspeed_NEW=0;
//var pausespeed_NEW=(pauseit_NEW==0)? copyspeed_NEW: 0
var pausespeed_NEW=(pauseit_NEW==0)? copyspeed_NEW: slowspeed_NEW;
var iedom_NEW=document.all||document.getElementById
if (iedom_NEW)
document.write('<span id="temp_NEW" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+marqueecontent_NEW+'</span>')
var actualwidth_NEW=''
var cross_marquee_NEW, ns_marquee_NEW

function populate_NEW(){
    if (iedom_NEW){
        cross_marquee_NEW=document.getElementById? document.getElementById("iemarquee_NEW") : document.all.iemarquee_NEW
        cross_marquee_NEW.style.left=0; //parseInt(mtc_tickerwidth_NEW)+8+"px"
        cross_marquee_NEW.innerHTML=marqueecontent_NEW
        actualwidth_NEW=document.all? temp.offsetWidth : document.getElementById("temp_NEW").offsetWidth
        // mc: test 
        //alert(actualwidth_NEW);
    }
    else if (document.layers_NEW){
        ns_marquee_NEW=document.ns_marquee_NEW.document.ns_marquee2_NEW
        ns_marquee_NEW.left=parseInt(mtc_tickerwidth_NEW)+8
        ns_marquee_NEW.document.write(marqueecontent_NEW)
        ns_marquee_NEW.document.close()
        actualwidth_NEW=ns_marquee_NEW.document.width
    }
    lefttime_NEW=setInterval("scrollmarquee_NEW()",20)
    
    // Hide the DIV that contains the ticker if maruqeecontent is blank
    if (marqueecontent_NEW != "")
    {
        var tickerDiv_NEW = document.getElementById('tickerDisplay_NEW');
		tickerDiv_NEW.style.display = "block";
    }
}

// window.onload=populate_NEW

function addLoadEvent_NEW(func)
{    
    var oldonload = window.onload;
    if (typeof window.onload != 'function')
    {
        window.onload = func;
    } 
    else 
    {
        window.onload = function()
        {
            oldonload();
            func();
        }
    }
}

addLoadEvent_NEW(populate_NEW);

function scrollmarquee_NEW(){
    if (iedom_NEW){
        if (parseInt(cross_marquee_NEW.style.left)>(actualwidth_NEW*(-1)+8))
            cross_marquee_NEW.style.left=parseInt(cross_marquee_NEW.style.left)-copyspeed_NEW+"px"
        else
            cross_marquee_NEW.style.left=parseInt(mtc_tickerwidth_NEW)+8+"px"
    }
    else if (document.layers_NEW){
        if (ns_marquee_NEW.left>(actualwidth_NEW*(-1)+8))
            ns_marquee_NEW.left-=copyspeed_NEW
        else
            ns_marquee_NEW.left=parseInt(mtc_tickerwidth_NEW)+8
    }
}

if (iedom_NEW||document.layers_NEW) {
	
    with (document) {
		
		//If no ticker message is entered above, show the static Welcome message box.
		/*if (!mtc_content_NEW[0] || mtc_content_NEW[0].length == 0) {
			
			//display nothing
		
		//Else if a ticker message is entered above, show the scrolling ticker.
		} else {
		*/
			
			document.write('<div id="tickerDisplay_NEW" style="display:none">');
			document.write('<div style="font-size: 10px; font-weight: bold; line-height: 13px;font-family: Tahoma, Arial, Helvetica, Sans-Serif;font-weight: bold;float: left;margin: 0px 0px 2px 0px;padding: 3px 0px 3px 5px;background: Red;color: White;border-top: solid 1px #CCCCCC;border-right: none;border-bottom: solid 1px #CCCCCC;border-left: solid 1px #CCCCCC;">BREAKING NEWS:&nbsp;&nbsp;</div>');
			document.write('<div style="overflow: hidden; z-index: 0; margin-right: 0px; float: left;font: 12px/14px Arial, Helvetica, sans-serif;margin: 0px 0px 0px 0px;padding-top: 5px;background: #FFFFFF;border: solid 1px #CCCCCC;">');
			document.write('<table border="0" cellspacing="0" cellpadding="0" style="padding: 0 0 0 0;"><tr><td>');
			if (iedom_NEW)
			{
				write('<div style="position:relative;width:'+mtc_tickerwidth_NEW+';height:'+marqueeheight_NEW+';overflow:hidden">');
				write('<div style="position:absolute;width:'+mtc_tickerwidth_NEW+';height:'+marqueeheight_NEW+';background-color:'+marqueebgcolor_NEW+'" onMouseover="copyspeed_NEW=pausespeed_NEW" onMouseout="copyspeed_NEW=marqueespeed_NEW">');
				write('<div id="iemarquee_NEW" style="position:absolute;left:0px;top:-1.5px;"></div>');
				write('</div></div>');
			}
			else if (document.layers_NEW)
			{
				write('<ilayer width='+mtc_tickerwidth_NEW+' height='+marqueeheight_NEW+' name="ns_marquee_NEW" bgColor='+marqueebgcolor_NEW+'>');
				write('<layer name="ns_marquee2_NEW" left=0 top=0 onMouseover="copyspeed_NEW=pausespeed_NEW" onMouseout="copyspeed_NEW=marqueespeed_NEW"></layer>');
				write('</ilayer>');
			}
			document.write('</td></tr></table>');
			document.write('</div>');
			document.write('</div>');
			
		//}
    }
}