/*
All Intellectual Property Rights belong to theCitySecret,
unauthorised reproduction, or distribution are not permitted.

And that includes copying the code and changing a couple of variables !!!

c. theCitySecret Ltd. September 2001 
*/


var tInterval;
var i=0;
var ii=0;
var cC=0;
var max = 0;
var openTag = "<span class=ticker>"
var closeTag = "</span>"
var cursor = "<em>&sdot;</em>"
var bTxt= new Array();
var displayTxt;
var delay=100;
var tickplant;
var loaded;
var url = "sectors.txt";
	

   function init_ticker(tick_div_id){
     tickplant = document.getElementById(tick_div_id);
	 parse_text_file();
   }
   
   function parse_text_file(){
   			httpRequest("GET", url, true, handleResponse, "dummy");
   }
   	function handleResponse(){
		if (request.readyState == 4){
			 if (request.status == 200 || 1){
				var doc = request.responseText;
				bTxt = doc.split("^");
			 }
			 ticker();
		}
	}
	function ticker(){
	 /* Begin scroll logic */
     if (max==0){
	 	max = bTxt[ii].length;
	 }
     /* Cursor control */
	 cC++
	 if (cC==0){
	 	cursor = "<em><\em>"
	 } else {
	    cursor = "<em><\em>"
		cC = -1;
	 }
	 
	 /* Teletyper code */
     i++
 	 	if (i<=max){
 	       delay=150
  	 	   displayTxt = bTxt[ii].substring(0,i)
	 	   tickplant.innerHTML =  openTag + displayTxt + cursor + closeTag;
 	 	} else {
 	       displayTxt = bTxt[ii]
 	       tickplant.innerHTML =  openTag + displayTxt + closeTag;
 	       delay=800
 		   i=0
		   if (ii==bTxt.length-1){
		       ii=0
		   } else {
		       ii++
		   }
		   max = bTxt[ii].length;
 	 	}
	 tInterval=setTimeout(ticker,delay);
	}
	