function getWidth()
{
/*
	if (document.layers){
		return window.outerWidth;
	}

	if (document.all){
		return document.body.clientWidth;
	}

	return document.body.clientWidth;
*/
//	alert(tickerW.offsetWidth);
	if (document.all){
//		return tickerW.offsetWidth;
		return tickerW.offsetWidth + 243;
	}
    return parseInt(document.getElementById("tickerW").width);
}

function Ticker(name, id, contID, shiftBy, interval)
{
  this.name     = name;
  this.id       = id;
  this.contID   = contID;
  this.shiftBy  = shiftBy ? shiftBy : 1;
  this.interval = interval ? interval : 100;
  this.runId	= null;

  this.div = document.getElementById(id);
  this.cont_div = document.getElementById(contID);

  // remove extra textnodes that may separate the child nodes
  // of the ticker div

  var node = this.div.firstChild;
  var next;

  while (node)
  {
    next = node.nextSibling;
    if (node.nodeType == 3)
      this.div.removeChild(node);
    node = next;
  }

  //end of extra textnodes removal
 
  this.left = getWidth() - 243;
//  this.left = getWidth() - 253;
  this.shiftLeftAt = this.div.firstChild.offsetWidth;
  this.div.style.height	= this.div.firstChild.offsetHeight;
  
  this.div.style.width = 2 * (getWidth() - 243);
//  this.div.style.width = 2 * screen.availWidth;
  this.div.style.visibility = 'visible';
  this.cont_div.style.width = getWidth() - 243 + 'px';
}

var i = 0;

function startTicker()
{
  this.stop();

  if(i==50) {
	  this.cont_div.style.width = getWidth() - 244 + 'px';
	  i = 0;
  }  else { i++; }
  
  
  this.left -= this.shiftBy;
  
  if( this.shiftLeftAt == 0) 
  {
	this.shiftLeftAt = this.div.firstChild.offsetWidth;
  }

  if (this.left <= -this.shiftLeftAt && this.shiftLeftAt != 0)
  {

    this.left = getWidth() - 243;
//    this.left = screen.width - 274;
    this.div.appendChild(this.div.firstChild);
//    this.shiftLeftAt = this.div.firstChild.offsetWidth;
  }

  this.div.style.left = (this.left + 'px');

  this.runId = setTimeout(this.name + '.start()', this.interval);
}

function stopTicker()
{
  if (this.runId)
    clearTimeout(this.runId);
    
  this.runId = null;
}

function changeTickerInterval(newinterval)
{

  if (typeof(newinterval) == 'string')
    newinterval =  parseInt('0' + newinterval, 10); 
	
  if (typeof(newinterval) == 'number' && newinterval > 0)
    this.interval = newinterval;
    
    this.stop();
    this.start();
}

/* Prototypes for Ticker */
Ticker.prototype.start = startTicker;
Ticker.prototype.stop = stopTicker;
Ticker.prototype.changeInterval = changeTickerInterval;




