bgPicNo = Math.floor((Math.random()*8)) + 1;
bgPics = new Array();
bgPics[1] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_1.jpg) no-repeat;">';
bgPics[2] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_2.jpg) no-repeat;">';
bgPics[3] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_3.jpg) no-repeat;">';
bgPics[4] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_4.jpg) no-repeat;">';
bgPics[5] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_5.jpg) no-repeat;">';
bgPics[6] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_6.jpg) no-repeat;">';
bgPics[7] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_7.jpg) no-repeat;">';
bgPics[8] = '<td colspan="2" width="1540" height="405" style="background: #B2000A url(images/home_bg_8.jpg) no-repeat;">';

var theCharacterTimeout = 50;
var theStoryTimeout     = 3000;
var theWidgetOne        = "_";
var theWidgetTwo        = "-";
var theWidgetNone       = "";
var theLeadString       = "a5 news&nbsp;&nbsp;&nbsp;&nbsp;";

var theSummaries = [];
var theSiteLinks = [];

// Ticker items
// Restructured to avoid having to manually index arrays every time and set the item count variable. 8/10 mk

theSummaries.push("a5 launches FaceEater, a card game where death is your friend, mercy a weakness and shafting your friends is fun. Order here.");
theSiteLinks.push("http://www.faceeater.com/");

theSummaries.push("a5 helps Illinois Bone and Joint Institute launch OrthoAccess immediate care clinic");
theSiteLinks.push("");

theSummaries.push("a5 launches new e-commerce web site for Music Charts product that helps musicians play better");
theSiteLinks.push("");

theSummaries.push("Fletcher Martin to judge the 2010 Illinois Park and Recreation Association show");
theSiteLinks.push("");

theSummaries.push("Fletcher Martin joins board of AIGA Chicago (the professional organization for design)");
theSiteLinks.push("");
             
theSummaries.push("John Harris to speak on Greening Your Business at College of Lake County November 13");
theSiteLinks.push("");
             
theSummaries.push("a5 designs, writes member magazine for Garfield Park Conservatory Alliance");
theSiteLinks.push("");
             
theSummaries.push("a5 launches web site for private equity firm Hispania Capital Partners");
theSiteLinks.push("http://hispaniapartners.com/");
             
theSummaries.push("a5 to develop web site for American Medical Association Insurance Agency");
theSiteLinks.push("");
             
theSummaries.push("a5 produces videos for Regent Surgical Health, Technical Concepts and American Society of Landscape Architects (Illinois chapter)");
theSiteLinks.push("");
             
theSummaries.push("a5 delivers branding presentation at Interior Design Magazine conference");
theSiteLinks.push("");
             
theSummaries.push(" a5 renames DevCorp North and rebrands organization as Rogers Park Business Alliance");
theSiteLinks.push("");
             
theSummaries.push("a5 produces two videos for Technical Concepts, one for City of Grand Rapids");
theSiteLinks.push("");
             
// end ticker items

var theItemCount = theSummaries.length;


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];}}
}

// Ticker startup
function startTicker()
{
	// Define run time values
	theCurrentStory     = -1;
	theCurrentLength    = 0;
	// Locate base objects
	if (document.getElementById) {
		    theAnchorObject     = document.getElementById("tickerAnchor");
			runTheTicker();
		 }
	else {
            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}
// Ticker main run loop
function runTheTicker()
{
	var myTimeout;
	// Go for the next story data block
	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = theSummaries[theCurrentStory].replace(/&quot;/g,'"');
		theTargetLink        = theSiteLinks[theCurrentStory];
		theAnchorObject.href = theTargetLink;
		thePrefix 	     = "<span class=\"tickls\">" + theLeadString + "</span>";
	}
	// Stuff the current ticker text into the anchor
	theAnchorObject.innerHTML = thePrefix +
	theStorySummary.substring(0,theCurrentLength) + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	}
	else
	{
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// Call up the next cycle of the ticker
	setTimeout("runTheTicker()", myTimeout);
}
// Widget generator
function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}
