var timeoutChar = 20;
var tickrtTime     = 4000;
var theWidgetOne        = "_";
var theWidgetTwo        = "-";
var theWidgetNone       = "";
var theLeadString       = "&nbsp;";

var msgTexts   = new Array();
var msgTimes   = new Array();
var msgAgencys = new Array();

var theItemCount = 0;

function setTiArrays(id, tText, tTime, tAgency)
{
	msgTexts[id] = tText;
	msgTimes[id] = tTime;
    theItemCount = id;
}

function initTicker()
{
	theCurrentStory     = -1;
	theCurrentLength    = 0;

	if (document.getElementById) {
		    theAnchorObject     = document.getElementById("tickerAnchor");
			runTic();
		 }
	else {
            document.write("<style>.tickerDiv{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
	}
}

function runTic()
{
	var timeSet;

	if(theCurrentLength == 0)
	{
		theCurrentStory++;
		theCurrentStory      = theCurrentStory % theItemCount;
		theStorySummary      = msgTexts[theCurrentStory].replace(/&quot;/g,'"');
		theTargetLink        = 'http://www.zeleznak.cZ';
//		theAnchorObject.href = theTargetLink;
	}


	theAnchorObject.innerHTML = "<span class=t11RedNotB>" + msgTimes[theCurrentStory] + "</span>&nbsp;<span class=t13B>" + 	theStorySummary.substring(0,theCurrentLength) + whatWidget() + "</span>";

	if(theCurrentLength != theStorySummary.length)
	{
		theCurrentLength++;
		timeSet = timeoutChar;
	}
	else
	{
		theCurrentLength = 0;
		timeSet = tickrtTime;
	}

	setTimeout("runTic()", timeSet);
}


function whatWidget()
{
	if(theCurrentLength == theStorySummary.length)
	{
		return theWidgetNone;
	}

	if((theCurrentLength % 2) == 1)
	{
		return theWidgetOne;
	}
	else
	{
		return theWidgetTwo;
	}
}
$(document).ready(function(){
    $('.country-other').click(function(){
        $('.hidden-state').fadeIn();
        $('.hidden-state').val('Write your country, (GER,AUT,RUS and etc...)');
    });
    $('.state').click(function(){
        $('.hidden-state').fadeOut();
    });
    
});



