
window.onload = function() {
if(document.getElementById) {
				loadXMLDoc("http://www.arkansas.com/calendar/rss.asp");
	}
}

// global flag
var isIE = false;

// global request and XML document objects
var doc;

//MAIN TICKER FUNCTION
//SET PREFERENCE VARIABLES
var myTimer;
var theCharacterTimeout = 25;
var theStoryTimeout = 5000;
// Ticker startup function
function startTicker() {
	//clear the ticker timer
	window.clearTimeout(myTimer);
	// Define run time values
	//Get the Items array
	items = doc.getElementsByTagName("item");
	theItemCount = items.length;
	theCurrentStory = -1;
	theCurrentLength = 0;
	// Locate base objects
	if (document.getElementById) {
			//Write the anchor text for the ticker
			/*
			*/
			runTheTicker();
		} else {
			return true;
	}
}

// Ticker main run loop function
function runTheTicker() {
	var myTimeout;
	
	var objDetails = document.getElementById("details")
	// Go for the next story data block
	if(theCurrentLength == 0) {
		theCurrentStory++;
		theCurrentStory = theCurrentStory % theItemCount;
		objDetails.innerHTML += '<a class="tickerAnchor" name="tickerAnchor" href="#"><\/a><br><span id="tickerStory" name="tickerStory" ><\/span><br><br>';
		theAnchorObject = document.getElementsByName("tickerAnchor")[theCurrentStory];
		theStoryObject = document.getElementsByName("tickerStory")[theCurrentStory];
			
		
		theStoryHeader = getElementTextNS("", "title", items[theCurrentStory], 0);
		theStorySummary = getElementTextNS("", "description", items[theCurrentStory], 0);
		theTargetLink = getElementTextNS("", "link", items[theCurrentStory], 0);

		theAnchorObject.innerHTML = theStoryHeader;
		theAnchorObject.href = theTargetLink;

	}
	// Stuff the current ticker text into the anchor
	theStoryObject.innerHTML = theStorySummary.substring(0,theCurrentLength);
	// Modify the length for the substring and define the timer
	if(theCurrentLength < theStorySummary.length) {
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	} else {
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
		
	}
	if(objDetails.scrollHeight > objDetails.clientHeight)
	{
		objDetails.scrollTop = objDetails.scrollHeight - objDetails.clientHeight;
	}

	// Call up the next cycle of the ticker
	myTimer = window.setTimeout("runTheTicker()", myTimeout);
}

function loadXMLDoc(url) {

	var strXML = "<rss version=\"2.0\"> \
<channel> \
<title>Arkansas Events</title>\
<description>Upcoming Arkansas events</description>\
<link>http://www.arkansas.com</link><item>\
<title>Suzanne's Fruit Farm</title>\
<description>October 1, 2009 - March 1, 2010&lt;br /&gt;Hampton, Tinsman/Fordyce Hwy. 274 NE of Hampton</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44240</link>\
</item><item>\
<title>World of the Pharaohs--Treasures of Egypt Revealed</title>\
<description>October 1, 2009 - July 5, 2010&lt;br /&gt;Little Rock, Arkansas Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44157</link>\
</item><item>\
<title>Nevada County Trade Days</title>\
<description>January 9 - February 13, 2010&lt;br /&gt;Prescott, Downtown</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43668</link>\
</item><item>\
<title>Oaklawn's Live Racing -- 2010 Season</title>\
<description>January 15 - April 10, 2010&lt;br /&gt;Hot Springs, Oaklawn Jockey Club</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=47939</link>\
</item><item>\
<title>Lee &amp; Grant</title>\
<description>January 26 - March 13, 2010&lt;br /&gt;Texarkana, Historic Regional Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49087</link>\
</item><item>\
<title>&quot;The Women&quot;</title>\
<description>January 28 - February 14, 2010&lt;br /&gt;Searcy, Performing Arts Center on the Square</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44313</link>\
</item><item>\
<title>52nd Annual Delta Exhibition</title>\
<description>January 29 - March 14, 2010&lt;br /&gt;Little Rock, Arkansas Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44163</link>\
</item><item>\
<title>Dripstone Trail Tour</title>\
<description>January 30 - March 31, 2010&lt;br /&gt;Fifty Six, Blanchard Springs Caverns Visitor Information Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43114</link>\
</item><item>\
<title>Wild Cave Tour</title>\
<description>January 30 - March 31, 2010&lt;br /&gt;Fifty Six, Blanchard Springs Caverns Visitor Information Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43115</link>\
</item><item>\
<title>Life on the Home Front: The Modern Family's Responce to World Conflicts</title>\
<description>January 30 - March 31, 2010&lt;br /&gt;Marked Tree, Marked Tree Delta Area Museum</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=47474</link>\
</item><item>\
<title>&quot;Disaster!&quot;</title>\
<description>January 30 - April 10, 2010&lt;br /&gt;Springdale, Shiloh Museum of Ozark History</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44006</link>\
</item><item>\
<title>Eagles Over Harbor</title>\
<description>February 1 - 28, 2010&lt;br /&gt;Mount Ida, Mountain Harbor Resort and Spa</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49077</link>\
</item><item>\
<title>Heart and Soul</title>\
<description>February 1 - 28, 2010&lt;br /&gt;Mountain View, Arkansas Craft Gallery 104 East Main</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44025</link>\
</item><item>\
<title>Eureka Springs Gallery Association Has A Heart</title>\
<description>February 1 - 28, 2010&lt;br /&gt;Eureka Springs, Downtown</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44207</link>\
</item><item>\
<title>Black History Month</title>\
<description>February 1 - 28, 2010&lt;br /&gt;Pocahontas, Eddie Mae Herron Center/Museum</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43997</link>\
</item><item>\
<title>All Dressed Up</title>\
<description>February 1, 2010 - January 22, 2011&lt;br /&gt;Springdale, Shiloh Museum of Ozark History</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44009</link>\
</item><item>\
<title>Eureka Gras Mardi Gras Extravaganza</title>\
<description>February 4 - 16, 2010&lt;br /&gt;Eureka Springs, United States</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=42769</link>\
</item><item>\
<title>February 2010 Art Exhibit</title>\
<description>February 4 - 24, 2010&lt;br /&gt;Fort Smith, Fort Smith Art Center  423 North 6th St</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43848</link>\
</item><item>\
<title>&quot;Laura&quot;</title>\
<description>February 5 - 13, 2010&lt;br /&gt;Springdale, Arts Center of the Ozarks</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44146</link>\
</item><item>\
<title>Cat on a Hot Tin Roof</title>\
<description>February 5 - 21, 2010&lt;br /&gt;Little Rock, Arkansas Repertory Theatre</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43315</link>\
</item><item>\
<title>Art Show</title>\
<description>February 5 - 26, 2010&lt;br /&gt;Springdale, Arts Center of the Ozarks</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44773</link>\
</item><item>\
<title>Synergy Brass Quintet</title>\
<description>February 11, 2010&lt;br /&gt;Jonesboro, Fowler Center -- Arkansas State University</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48308</link>\
</item><item>\
<title>A Valentine Affaire</title>\
<description>February 11, 2010&lt;br /&gt;Little Rock, Arkansas Governor's Mansion, 1800 Center St </description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49463</link>\
</item><item>\
<title>&quot;Arsenic and Old Lace&quot;</title>\
<description>February 11 - 21, 2010&lt;br /&gt;Hot Springs, The Pocket Community Theatre, 170 Ravine Street</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=50116</link>\
</item><item>\
<title>Tyson Invitation</title>\
<description>February 12, 2010&lt;br /&gt;Fayetteville, Randal Tyson Track Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44029</link>\
</item><item>\
<title>Valentine's Dinner</title>\
<description>February 12, 2010&lt;br /&gt;Washington, Williams' Tavern Restaurant</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=35030</link>\
</item><item>\
<title>Band of the Irish Guards with the Pipes and Drums of The Royal Regiment of Scotland</title>\
<description>February 12, 2010&lt;br /&gt;Fayetteville, Walton Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44062</link>\
</item><item>\
<title>Valentine Hee Haw Show</title>\
<description>February 12 - 13, 2010&lt;br /&gt;Ozark, Foothills Little Theatre</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48276</link>\
</item><item>\
<title>25th Annual Arkansas Sportshow</title>\
<description>February 12 - 14, 2010&lt;br /&gt;Jonesboro, Arkansas State Unviersity Convocation Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=51913</link>\
</item><item>\
<title>Big River, The Adventures of Huckleberry Finn</title>\
<description>February 12 - 28, 2010&lt;br /&gt;Rogers, The Victory Theater, 116 South 2nd Street</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48069</link>\
</item><item>\
<title>Eureka Springs 6th Annual Chocolate Lovers Festival</title>\
<description>February 13, 2010&lt;br /&gt;Eureka Springs, Best Western Inn of the Ozark's Convention Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=53211</link>\
</item><item>\
<title>22nd Annual Home and Garden Seminar &amp; Show</title>\
<description>February 13, 2010&lt;br /&gt;Pine Bluff, Pine Bluff Convention Center  500 East 8th Avenue</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43172</link>\
</item><item>\
<title>Murder Mystery Dinner Theater--Valentine&#8217;s Day Special!</title>\
<description>February 13, 2010&lt;br /&gt;Little Rock, MACARTHUR MUSEUM OF ARKANSAS MILITARY HISTORY</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=52678</link>\
</item><item>\
<title>7th Annual Chocolate Fantasy Ball Benefitting Ronald McDonald House Charities of Arkansas</title>\
<description>February 13, 2010&lt;br /&gt;Little Rock, The Peabody Hotel</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=52893</link>\
</item><item>\
<title>Fat Saturday Parade of Fools</title>\
<description>February 13, 2010&lt;br /&gt;Fayetteville, The Fayetteville Square, East Ave. and Dickson Street</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=52895</link>\
</item><item>\
<title>Chinese New Year Celebration Dinner</title>\
<description>February 13, 2010&lt;br /&gt;Maumelle, New China Restaurant, 11701 Maumelle Blvd.</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=53327</link>\
</item><item>\
<title>Valentine Dinner and Show</title>\
<description>February 13, 2010&lt;br /&gt;Mountain View, </description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=36489</link>\
</item><item>\
<title>Valentine Show</title>\
<description>February 13 - 14, 2010&lt;br /&gt;Ozark, Foothills Little Theatre</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=42979</link>\
</item><item>\
<title>Delbert McClinton</title>\
<description>February 14, 2010&lt;br /&gt;Fayetteville, 495 W. Dickson St.</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=51922</link>\
</item><item>\
<title>Annual Concerto &amp; Aria Competition</title>\
<description>February 14, 2010&lt;br /&gt;Conway, Hendrix College, Reves Recital Hall, 1600 Washington Avenue</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48607</link>\
</item><item>\
<title>Valentine Ball</title>\
<description>February 14, 2010&lt;br /&gt;Eureka Springs, Best Western Inn of the Ozarks</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44452</link>\
</item><item>\
<title>Valentine's Evening At Harbor</title>\
<description>February 14, 2010&lt;br /&gt;Mount Ida, Mountain Harbor Resort and Spa</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49082</link>\
</item><item>\
<title>Oaklawn Live Racing -- Presidents Day!</title>\
<description>February 15, 2010&lt;br /&gt;Hot Springs, 2705 Central Ave</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=52619</link>\
</item><item>\
<title>Chamber Orchestra Waltz Night</title>\
<description>February 15, 2010&lt;br /&gt;Conway, Hendrix College, Hulen Ballroom, 1600 Washington Avenue</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48608</link>\
</item><item>\
<title>8th Annual Daffodil Days</title>\
<description>February 15 - March 7, 2010&lt;br /&gt;Hot Springs, Garvan Woodland Gardens</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=35596</link>\
</item><item>\
<title>International Food Fest at Ouachita Baptist University</title>\
<description>February 16, 2010&lt;br /&gt;Arkadelphia, Walker Conference Center, OBU Campus</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44727</link>\
</item><item>\
<title>Eureka Gras 2nd Line Krazo Krawl</title>\
<description>February 16, 2010&lt;br /&gt;Eureka Springs, Downtown on Main and Spring streets</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=42767</link>\
</item><item>\
<title>Arkansas Welcomes Sarah Palin</title>\
<description>February 16, 2010&lt;br /&gt;North Little Rock, Verizon Arena</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=53492</link>\
</item><item>\
<title>6th Annual Go Red For Women</title>\
<description>February 16, 2010&lt;br /&gt;Rogers, The John Q. Hammons Convention Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=51439</link>\
</item><item>\
<title>Mardi Gras on Dickson</title>\
<description>February 16, 2010&lt;br /&gt;Fayetteville, 300 &amp; 400 block of Dickson St.</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=52896</link>\
</item><item>\
<title>Precious Threads</title>\
<description>February 17, 2010&lt;br /&gt;Springdale, Shiloh Museum of Ozark History</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44010</link>\
</item><item>\
<title>One Night of Queen</title>\
<description>February 18 - 19, 2010&lt;br /&gt;Fayetteville, Baum Walker Hall</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=47252</link>\
</item><item>\
<title>Friends of the Library Used Book Sale</title>\
<description>February 18 - 20, 2010&lt;br /&gt;Mountain Home, Baxter County Library</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49342</link>\
</item><item>\
<title>Quilter's Retreat</title>\
<description>February 18 - 20, 2010&lt;br /&gt;Mountain View, </description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=36461</link>\
</item><item>\
<title>Zomo the Rabbit -- A Hip-Hop Creation Myth</title>\
<description>February 18 - 21, 2010&lt;br /&gt;Pine Bluff, Hathaway-Howard Fine Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44194</link>\
</item><item>\
<title>Theatre Production at Ouachita Baptist University</title>\
<description>February 18 - 22, 2010&lt;br /&gt;Arkadelphia, Verser Theatre, OBU Campus</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44728</link>\
</item><item>\
<title>Antique/Boutique Walk</title>\
<description>February 19, 2010&lt;br /&gt;Hot Springs, Historic Downtown</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43749</link>\
</item><item>\
<title>Frontier Days at the Five Trails Rendezvous</title>\
<description>February 19 - 21, 2010&lt;br /&gt;Washington, </description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=35031</link>\
</item><item>\
<title>Ladysmith Black Mambazo </title>\
<description>February 20, 2010&lt;br /&gt;Fayetteville, Walton Arts Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44063</link>\
</item><item>\
<title>43rd Annual Beach Ball and Auction</title>\
<description>February 20, 2010&lt;br /&gt;Springdale, Arts Center of the Ozarks</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44148</link>\
</item><item>\
<title>Saturday Science--&quot;Icky Science&quot;</title>\
<description>February 20, 2010&lt;br /&gt;Hot Springs, AT&amp;T Innovation Station Classroom at the Museum</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=49481</link>\
</item><item>\
<title>Winter Bluegrass Show</title>\
<description>February 20, 2010&lt;br /&gt;Hope, Fair Park Community Center</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43212</link>\
</item><item>\
<title>Live On Stage in NWA! Presents Red Hot Hollywood</title>\
<description>February 21, 2010&lt;br /&gt;Bentonville, Arend Arts Center - 1901 SE  J Street</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=43142</link>\
</item><item>\
<title>Live On Stage Presents Red Hot Hollywood</title>\
<description>February 21, 2010&lt;br /&gt;Bentonville, Arend Arts Center on the Bentonville High School Campus</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=48808</link>\
</item><item>\
<title>Arkansas Hospitality Association Stars of the Industry</title>\
<description>February 23, 2010&lt;br /&gt;Little Rock, Holiday Inn, Airport</description>\
<link>http://www.arkansas.com/calendar/calendar.aspx?id=44195</link>\
</item>\
\
</channel>\
</rss>";

	if (window.ActiveXObject) {
   doc=new ActiveXObject("Microsoft.XMLDOM")
    doc.loadXML(strXML);   
   }
   else if (document.implementation && document.implementation.createDocument)
  {
   var objDOMParser = new DOMParser();
    doc = objDOMParser.parseFromString(strXML, "text/xml");
 }
   startTicker() ;
}

// DISPLAY LOADING ANIMATION
function startLoadFlag() {
	document.getElementById('details').innerHTML = '<p id="LoadMsg"><\/p>';
}

// HIDE LOADING ANIMATION
function stopLoadFlag() {
	document.getElementById('details').innerHTML = "";
}

// retrieve text of an XML document element, including
// elements using namespaces
function getElementTextNS(prefix, local, parentElem, index) {
	var result = "";
	if (prefix && isIE) {
		// IE/Windows way of handling namespaces
		result = parentElem.getElementsByTagName(prefix + ":" + local)[index];
	} else {
		// the namespace versions of this method
		// (getElementsByTagNameNS()) operate
		// differently in Safari and Mozilla, but both
		// return value with just local name, provided
		// there aren't conflicts with non-namespace element names
		result = parentElem.getElementsByTagName(local)[index];
	}
	if (result) {
		// get text, accounting for possible
		// whitespace (carriage return) text nodes
		if (result.childNodes.length > 1) {
			return result.childNodes[1].nodeValue;
		} else {
			return result.firstChild.nodeValue;
		}
	} else {
		return "n/a";
	}
}