//var _onload;

function checkBrowser(){
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

bw=new checkBrowser();

var speed;
var pause;
var theheight;
var _maxinf = 0;
var _curinf = 0;
var _move = false;
var dloop, uloop, timer;

//Object constructor
function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.';
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt;
    this.obj = obj + "Object";
    eval(this.obj + "=this");
    return this;
}

function moveIt(x,y){
 this.x=x;this.y=y;
 this.css.left=this.x;
 this.css.top=this.y;
}

//Makes the object go up
function goDown(move){
 if(this.y>0){
  this.moveIt(0,this.y-move);
  timer = setTimeout(this.obj+".down("+move+")",speed);
 }
 else{
  if(!_move){
  setTimeout(this.obj+".down("+move+")",pause*1000);
  _move = true;
  }
  else{
   if(this.y>-this.scrollHeight){
    this.moveIt(0,this.y-move);
    timer = setTimeout(this.obj+".down("+move+")",speed);
   }
   else{
    _multiscroll();
    _move = false;
   }
  }
 }
}

//Makes the object go down
function goUp(move){
	if(this.y<0){
		this.moveIt(0,this.y-move)
		if(uloop)
		 timer = setTimeout(this.obj+".up("+move+")",speed);
	else
	 setTimeout("_test()",pause*1000);
	}
}

function _scroll(i){
 cobj = infos[i];
 if(loaded){
  if(speed>0) {cobj.down(speed);}
  else {cobj.up(speed);}
 }
}

//Makes the object
var loaded = false;
var infos = new Array();
var _build = "<div id=Cont align=left>";

function scrollInit(){
 if(_curinf>0){
  infos[0]=new makeObj('Cont');
  if(document.layers)
   locate = locate_1(document.layers["news"]);
  else if(document.all)
   locate = locate_2(document.all["news"]);
  else if(document.getElementById)
   locate = locate_3(document.getElementById("news"));
  infos[0].moveIt(locate[0],locate[1]);
  for(i=1;i<=_maxinf;i++){
   infos[i] = new makeObj('Text'+i,'Cont');
   infos[i].moveIt(0,theheight);
   if(i==1)
    infos[i].moveIt(0,0);
  }
  infos[0].css.visibility='visible';
  loaded=true;
  _multiscroll();
 }
 else
  setTimeout("scrollInit", 100);
}

function _multiscroll(){
 infos[_curinf].css.visibility='hidden';
 infos[_curinf].moveIt(0,theheight);
 _curinf = (_curinf<_maxinf)?(_curinf+1):1;
 infos[_curinf].css.visibility='visible';
 _scroll(_curinf);
}

function _add(_titinf, _inf, _link){
 _maxinf++;
 _build += "<div id=Text"+ _maxinf+" align=left><a href=\""+_link+"\" class=\"scrtxt\"><span class=\"scrtit\">"+_titinf+"</span><br>"+_inf+" <span class=\"scrred\">&raquo;</span></div>";
}

function _writeinfos(){
 _build+="</div>";
 document.write(_build);
 _curinf = _maxinf;
 onload = scrollInit;
}

 function locate_1(_lobj){
  return new Array(_lobj.pageX, _lobj.pageY);
 }

 function place_1(_lobj, x, y){
  _lobj.left = x;
  _lobj.top = y;
 }

 function mplace_1(_sobj, _dobj, l, t){
  loc = locate_1(_sobj);
  place_1(_dobj, loc[0]+l, loc[1]+t);
 }

 function locate_2(_lobj){
 var _lx = _lobj.offsetLeft, _ly = _lobj.offsetTop;
 if(_lobj.offsetParent.tagName!="BODY"){
  while(_lobj.offsetParent){
   _lx += _lobj.offsetParent.offsetLeft;
   _ly += _lobj.offsetParent.offsetTop;
   _lobj = _lobj.offsetParent;
  }
 }
 else{
  while(_lobj.parentElement){
   _lx += _lobj.parentElement.offsetLeft;
   _ly += _lobj.parentElement.offsetTop;
   _lobj = _lobj.parentElement;
  }
 }
 return new Array(_lx, _ly);
 }

 function place_2(_lobj, x, y){
  _lobj.style.left = x;
  _lobj.style.top = y;
 }

 function mplace_2(_sobj, _dobj, l, t){
  loc = locate_2(_sobj);
  place_2(_dobj, loc[0]+l, loc[1]+t);
 }

 function locate_3(_lobj){
  var _lx = _lobj.offsetLeft, _ly = _lobj.offsetTop;
  while(_lobj.offsetParent){
   _lx += _lobj.offsetParent.offsetLeft;
   _ly += _lobj.offsetParent.offsetTop;
   _lobj = _lobj.offsetParent
  }
  return new Array(_lx, _ly);
 }

 function place_3(_lobj, x, y){
  _lobj.style.left = x;
  _lobj.style.top = y;
 }
 
 function mplace_3(_sobj, _dobj, l, t){
  loc = locate_3(_sobj);
  place_3(_dobj, loc[0]+l, loc[1]+t);
 }
 
 function _reload(){
  window.location.reload();
 }