
/*
<!--StartFragment -->
<pre id="line70">var theCharacterTimeout = 70;
var theStoryTimeout = 6000;
var theWidgetOne = "_";
var theWidgetTwo = "-";
var theWidgetNone = "";
var theLeadString = "";
var theSummaries = new Array();
var theSiteLinks = new Array();
var theItemCount = 5;
theSummaries[0] = "Промоцианален пакет за вашите плавателни съдове";
theSiteLinks[0] = "/bg/WhatIsNew/Promotions/Vessel.htm";
theSummaries[1] = "Промоция - Материални загуби";
theSiteLinks[1] = "/bg/WhatIsNew/Promotions/losses.htm";
theSummaries[2] = "ЗПАД „Булстрад” отпразнува 43–та годишнина";
theSiteLinks[2] = "/bg/WhatIsNew/News/43Anniversary.htm";
theSummaries[3] = "На гости в Булстрад";
theSiteLinks[3] = "/bg/WhatIsNew/News/BulstradGuests.htm";
theSummaries[4] = "43–то годишно акционерно събрание на ЗПАД „Булстрад”";
theSiteLinks[4] = "/bg/WhatIsNew/News/43ShareholdersMeeting.htm";
startTicker();</pre>
*/


// Ticker startup
function startTicker() {
	// Define run time values
	theCurrentStory = -1;
	theCurrentLength = 0;
	// Locate base objects
	if (document.getElementById) {
		// alert('ok');
		theAnchorObject = document.getElementById("tickerAnchor");
		runTheTicker();   	
	} else {
		// alert('???');
		document.write("<style>.ticki{display:none;}</style>");
		return true;
	}
}
// Ticker main run loop
function runTheTicker() {
	var myTimeout;  
	// alert('0');
	// Go for the next story data block
	if(theCurrentLength == 0) {
		// alert('1');
		theCurrentStory++;
		theCurrentStory = theCurrentStory % theItemCount;
		theStorySummary = theSummaries[theCurrentStory].replace(/&quot;/g,'"');		
		theTargetLink = theSiteLinks[theCurrentStory];
		theAnchorObject.href = theTargetLink;
		// thePrefix = "<span class=\"tickls\">" + theLeadString + "</span>";
		// thePrefix = ''; //theLeadString;
	}
	// alert('2');
	// Stuff the current ticker text into the anchor
	//theAnchorObject.innerHTML = thePrefix + 
	theAnchorObject.innerHTML = theStorySummary.substring(0,theCurrentLength); // + whatWidget();
	// Modify the length for the substring and define the timer
	if(theCurrentLength != theStorySummary.length) {
		// alert('3');
		theCurrentLength++;
		myTimeout = theCharacterTimeout;
	} else {
		// alert('4');
		theCurrentLength = 0;
		myTimeout = theStoryTimeout;
	}
	// alert('5');
	// 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;
	}
}
