
var oCollapse  = null ;


	function collapseInit()
	{
		oSlider = new slider() ; 		
	}


	function slider()
	{
		this.heads               = document.getElementsByTagName( 'h3' ) ;
		this.aCollapsables       = Array() ;
		this.t					 = 0 ;
		
		for ( var q=0; q <  this.heads.length ; q++ ) 
			if ( this.heads[q].className == 'toggle' )
			{
				this.aCollapsables[this.t] = this.heads[q]  ;
				this.aCollapsables[this.t].onclick = this.toggle ;
				this.aCollapsables[this.t].animation = new AnimationExtend( document.getElementById( this.aCollapsables[this.t].id + 'block' ), this.heads[q] ) ;
				this.aCollapsables[this.t].animation.collapse() ;
				this.t++ ;
			}
	}
	
	
	
	slider.prototype.toggle = function( e )
	{
		if ( !e ) 
      		var caller = window.event.srcElement  ;
   		else 
      		var caller = e.target ;
   		
		if ( document.getElementById( caller.id + 'block' ).style.height == '0px' )
		{
			oSlider.collapseAll() ;
			caller.animation.open()  ;
		}
		else
			oSlider.collapseAll() ;
	}
	
	
	slider.prototype.collapseAll = function()
	{
		for ( var q=0; q < this.aCollapsables.length ; q++ ) 
			this.aCollapsables[q].animation.close() ;
	}
	
	
	
/* Klib3 extend */

	function AnimationExtend( mElement, mController )
	{
	
	    if ( typeof mElement != "undefined" )
	        this.init( mElement );
	    this._control        = mElement;
	    this._controller     = mController ;
	    this._offsetHeight   = this._height
	    this._collapseHeight = 0 ;
	    this.collapse();
	};
	
	AnimationExtend.prototype = new klib3.animation; 
	
	AnimationExtend.prototype.collapse = function() 
	{	
		this.setHeight( this._collapseHeight ); 
	}; 
		
	AnimationExtend.prototype.open = function() 
	{
		this._controller.style.background = 'url( ../media/image/layout/sliderback_on.png ) no-repeat  ' ;
		this.grow( this._width, this._offsetHeight, klib3.movement.smooth, 10 );  		
	}; 
	
	AnimationExtend.prototype.close = function() 
	{
		this._controller.style.background = 'url( ../media/image/layout/sliderback_off.png ) no-repeat  ' ;
	 	this.grow( this._width, this._collapseHeight, klib3.movement.smooth, 10 ); 
	};

	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	