


function NewsTicker3( Skin, DisplayCell, ArgvName, Elapse, MoveSpeed, ShowLength, MoveLength, MoveSize ){
 NewsTicker3.Bases[NewsTicker3.Bases.length] = this;
 this.BasesIndex = NewsTicker3.Bases.length-1;
 this.Skin = Skin;
 this.DisplayCell = DisplayCell;
 this.DisplayCell.Ticker3 = this;
 this.ArgvName = ArgvName;

 this.DisplayCell.onmouseover = new Function( "this.Ticker3.Stop();" );
 this.DisplayCell.onmouseout = new Function( "this.Ticker3.MoveFlag = true; if( this.Ticker3.ElapseTimer == null ){ this.Ticker3.Move(); }" );

 if( Elapse ) this.Elapse = Elapse;
 if( MoveSpeed ) this.MoveSpeed = MoveSpeed;
 if( ShowLength ) this.ShowLength = ShowLength;
 if( MoveLength ) this.MoveLength = MoveLength;
 if( MoveSize ) this.MoveSize = MoveSize;
}

NewsTicker3.prototype.Skin = null;
NewsTicker3.prototype.DisplayCell = null;
NewsTicker3.prototype.ArgvName = null;
NewsTicker3.prototype.Elapse = 1000;   // ´ë±â½Ã°£
NewsTicker3.prototype.MoveSpeed = 1;   // ½ºÅ©·Ñ µô·¹ÀÌ
NewsTicker3.prototype.Skins = null;
NewsTicker3.prototype.CurrentSkins = null;
NewsTicker3.prototype.Current = 0;
NewsTicker3.prototype.ShowLength = 5;  // ¹Ì¸® ÁØºñµÅ¾î ÀÖ¾î¾ßÇÒ ´ÙÀ½ ÇÁ·¹ÀÓ°¹¼ö
NewsTicker3.prototype.MoveLength = 1;   // ÀÌµ¿ÇÒ ÇÁ·¹ÀÓ ¼ö
NewsTicker3.prototype.MoveSize= 0;   // ÀÌµ¿ÇÒ ÇÈ¼¿ ¼ö
NewsTicker3.Bases = [];
NewsTicker3.prototype.BasesIndex = null;
NewsTicker3.prototype.Timer = null;
NewsTicker3.prototype.MoveFlag = true;

NewsTicker3.prototype.Add = function(){
 var argv3 = arguments;
 var argc = arguments.length;
 if( argc == 0 ) return;
 if( this.Skins == null ) this.Skins = new Array();

 var newSkin = this.Skin.cloneNode( true );
 newSkin.style.display = "";
 this.Skins[this.Skins.length] = newSkin;

 for( var i=0; i<argc; i++ ){
  newSkin.all[this.ArgvName+"["+i+"]"].innerHTML = argv3[i];
 }
}

NewsTicker3.prototype.InitSkin = function(){
 if( this.CurrentSkins == null ) this.CurrentSkins = new Array();
 if( !this.Current ) this.Current = 0;

 if( this.ShowLength < this.MoveLength ) 
  this.MoveLength = this.ShowLength;
 
 if( this.CurrentSkins.length > 0 ){
  for( var i=0; i < this.MoveLength; i++ ){
   this.CurrentSkins[0].removeNode( true );
   this.CurrentSkins.shift();
  }
 }else{
  this.CurrentSkins = new Array();
 }

 for( var i=0; i<this.CurrentSkins.length; i++ ){
  this.CurrentSkins[i].style.pixelTop=0; 
 }
 
 var Latest = null;
 while( true ){
  if( this.Current > this.Skins.length-1 ) this.Current = 0;
  if( Latest == this.Current ) return;
  Latest = this.Current;
  this.CurrentSkins[this.CurrentSkins.length] = this.Skins[this.Current].cloneNode(true);
  this.DisplayCell.appendChild( this.CurrentSkins[this.CurrentSkins.length-1] ).style.pixelTop=0;
  this.Current++;
  if( this.CurrentSkins.length >= this.ShowLength*2 ) break;
 }
}

NewsTicker3.prototype.Start = function(){
 
 if( this.Skins.length < this.ShowLength )
  return;
 
 this.InitSkin();

 this.ElapseTimer = setTimeout( "NewsTicker3.Bases["+this.BasesIndex+"].Move();", this.Elapse );
}

NewsTicker3.prototype.Stop = function(){
 clearTimeout( this.Timer );
 this.MoveFlag = false;
}

NewsTicker3.prototype.Move = function(){
 this.ElapseTimer = null;

 if( !this.MoveFlag  ) return;

 if( this.CurrentSkins[this.MoveLength].offsetTop <= 0  ){
  this.Start();
  return;
 }
 
 var Pixel = 0;
 if( this.MoveSize == 0 )
  Pixel = this.CurrentSkins[this.MoveLength].offsetTop;
 else{
  if( (Pixel = this.CurrentSkins[this.MoveLength].offsetTop/this.MoveSize/2) < 1 ){
   Pixel = 1;
  }
 }

 for( var i=0; i<this.CurrentSkins.length; i++ ){
  this.CurrentSkins[i].style.pixelTop -= Pixel;
 }
 
 if( this.ElapseTimer == null )
  this.Timer = setTimeout( "NewsTicker3.Bases["+this.BasesIndex+"].Move();", this.MoveSpeed );
}
    


