
// *** Ticker (BEGIN) ****************************************************

var tickerActive = false;
var max = 0;

function textlist() {
  max = textlist.arguments.length;
  for (i=0; i<max; i++) {
      this[i] = textlist.arguments[i];
  };
}

<?php if ($usedFramework == "2") : ?>

// Prototype.Request
function ticker_request(url, data) {
    var myAjax = new Ajax.Request(
        url,
        {method: 'post', parameters: data, onSuccess: ticker_response}
    );
}

// Prototype.Response
function ticker_response(originalRequest) {
  eval(originalRequest.responseText);
}

<?php else : ?>

// JQuery.Request
function ticker_request(url, data) {
  $.ajax({
     type: "POST",
     url: url,
     data: data,
     success: function(msg){ticker_response(msg);}
  });
}

// JQuery.Response
function ticker_response(msg) {
  eval(msg);
}

<?php endif; ?>



<?php   
  include_once ("../include/ajaxReqTickerMsgs.php");
?>


var x = 0; pos = 0;
var msgLen = tl[0].length;
var initInterval = 0;

function ticker(elem_id) {
	if (tickerActive) {
     content = '&nbsp;&nbsp;&nbsp;' + tl[x].substring(0,pos);
     if (elem_id == '' || elem_id == undefined) {elem_id = 'tickerOut';};
     vSetElementContent(elem_id, content);
     if (pos++ == msgLen) {
        pos = 0;
        // setTimeout("ticker()",5000);
        setTimeout("ticker('"+elem_id+"')",5000);
        x++;
        if (x == max) {
           x = 0;
           initInterval++;
           if (initInterval == 5) {
              ticker_request('../include/ajaxReqTickerMsgs.php', 'tickerHeader=1');
              initInterval = 0;
           };
        };
        msgLen = tl[x].length;
     } else {
        // setTimeout("ticker()",50);
        setTimeout("ticker('"+elem_id+"')",50);
     };
  };
}

function switchTicker(mode) {
	if (mode == 'on') {tickerActive = false;};
  if (mode == 'off') {tickerActive = true;};
  if (tickerActive) {
  	 tickerActive = false;
     myhide('tickerOut');
  } else {
  	 tickerActive = true;
     myshow('tickerOut');
  	 ticker('tickerOut');
  };
}


// *** Ticker (END) ****************************************************
