//Version: 1.2

Object.prototype.attachEvent = function(method,func)
{if(!this[method]){this[method]=func;}else{this[method]=this[method].attach(func);}}
Function.prototype.attach=function(func){var f=this;return function(){f();func();}} 
function LabelShows(sName)
{    
  this.name = sName;
  this.node  = []; 
  this.cnode=[];
  this.style = ""; 
  this.ActStyle = ""; 
  this.action ="";
  this.switcher=0;
  this.counter=0;
  
  this.init = function(clientaction,style1,style2)
  {
  	this.style = style1; 
  	this.ActStyle = style2; 
  	this.action =clientaction;  	
  }
  
  this.E = function(Name)
  {
		return document.getElementById(Name);
  };
  
  this.addLabel=function(label,clabel)
  {
		this.node.push(1);
		this.cnode.push(1);
		
		this.node[this.node.length-1]=label;
		this.cnode[this.cnode.length-1]=clabel;
		this.SetDefault();
  };
  this.SetDefault = function()
  {
  		for(var i=0;i<this.node.length;i++)
		{ 
			this.E( this.node[i] ).attachEvent( this.action, new Function(     this.name+".S('"+this.node[i]+"','"+this.cnode[i]+"')"     )  ); 
		}
		this.S( this.node[0],this.cnode[0] );
  };
  
  this.S = function(snode,scnode)
  {
		for(var i=0;i<this.node.length;i++)
		{ 
			this.E( this.node[i] ).className=this.style; 
			this.E( this.cnode[i] ).style.display="none";
		}
		this.E( snode ).className = this.ActStyle;
		this.E( scnode ).style.display="";	 
		this.switcher++;
  }; 
  this.Show=function()
  { 
  		//c have move
		this.switcher--;
		if(this.switcher>2) return;
		if(this.switcher<=2)
		{			
			if( this.counter >= this.node.length ) 	this.counter = 0 ;
			eval( (this.name+".S('"+this.node[this.counter]+"','"+this.cnode[this.counter]+"')") );
			setTimeout( (this.name+".Show()") ,3000)	
			this.counter++;			
		}
		
   }
}
 
