﻿<!-- //
var g_bNewsTickPaused = false;
var g_nNewsTickSpeed = 0;
var g_imgNewsTickPause = null;
var g_pNewsTick = null;
var g_nNewsTickTimeout = 0;
var g_astrNewsTicks = new Array();
var g_nNewsTickIndex = -1;

function AddNewsTick(strText)
    {
    g_astrNewsTicks[g_astrNewsTicks.length] = strText;
    g_nNewsTickIndex = 0;
    }
					
function InitNewsTicks()
    {
    g_bNewsTickPaused = false;
    g_nNewsTickSpeed = 4000;
    g_imgNewsTickPause = document.getElementById("imgNewsTickPause");
    g_pNewsTick = document.getElementById("pNewsTick");
    DisplayNewsTick();
    }

function PauseNewsTick(strImgURL)
    {
    if(g_bNewsTickPaused)
        {
		g_bNewsTickPaused = false;
		StartNewsTick(strImgURL);
		}
	else
		{
		g_bNewsTickPaused = true;
		g_nNewsTickIndex--;
		StopNewsTick(strImgURL);
		}
	}
	
function StartNewsTick(strImgURL)
    {
    if(g_nNewsTickIndex != -1)
        {
        if(!g_bNewsTickPaused)
            {
            if(g_imgNewsTickPause) g_imgNewsTickPause.src = strImgURL + "ticks/pause.gif";
            if(g_nNewsTickTimeout == 0)
                g_nNewsTickTimeout = window.setTimeout("DisplayNewsTick()", g_nNewsTickSpeed);
            else
                StopNewsTick(strImgURL);
            }
        }
    }
	
function StopNewsTick(strImgURL)
    {
    if(g_imgNewsTickPause) g_imgNewsTickPause.src = strImgURL + "ticks/start.gif";
    if(g_nNewsTickTimeout != 0)
        {
        if(g_nNewsTickIndex >= g_astrNewsTicks.length || g_nNewsTickIndex < 0)
            g_nNewsTickIndex = 0;
            
        g_pNewsTick.innerHTML = g_astrNewsTicks[g_nNewsTickIndex];
        window.clearTimeout(g_nNewsTickTimeout);
        g_nNewsTickTimeout = 0;
        }
    }
					
function DisplayNewsTick()
    {
    if(g_nNewsTickIndex >= g_astrNewsTicks.length || g_nNewsTickIndex < 0)
        g_nNewsTickIndex = 0;
        
    if(g_pNewsTick) g_pNewsTick.innerHTML = g_astrNewsTicks[g_nNewsTickIndex];
    g_nNewsTickIndex++;
    g_nNewsTickTimeout = window.setTimeout("DisplayNewsTick()", g_nNewsTickSpeed);
    }
// -->