var
	toggleDivs = new Array();
//=================================================================================================
TToggleDiv = function( name, display, onClick )
{
	this.className = "TToggleDiv";
	this.name      = name;
	this.display   = false;
	this.onClick   = onClick;
	
	this.outer     = MM_findObj('div'    + upperFirst( this.name ) );
	this.header    = MM_findObj('header' + upperFirst( this.name ) );
	this.body      = MM_findObj('body'   + upperFirst( this.name ) );
	this.img1      = MM_findObj('img1'   + upperFirst( this.name ) ); 
	this.img2      = MM_findObj('img2'   + upperFirst( this.name ) );
	
	toggleDivs[toggleDivs.length] = this;
}
//-------------------------------------------------------------------------------------------------
TToggleDiv.prototype.toggle = function()
{
	if ( this.display )
	{
		this.img1.style.display = 'none';
		this.img2.style.display = '';
		
		this.body.style.display = 'none';
		this.opened = false;
	}
	else
	{
		this.img2.style.display = 'none';
		this.img1.style.display = '';
		
		this.body.style.display = '';
		this.opened = true;
	}
	
	this.display = ! this.display;
		
	if ( this.onClick ) 
		this.onClick( this );
		
	if ( this.display ) 
		setCookie( this.name, "inline");
	else
		setCookie( this.name, "none");
}
//-------------------------------------------------------------------------------------------------
TToggleDiv.prototype.open = function()
{
	if ( ! this.opened ) 
		this.toggle()
}
//-------------------------------------------------------------------------------------------------
TToggleDiv.prototype.close = function()
{
	if ( this.opened ) 
		this.toggle()
}
//-------------------------------------------------------------------------------------------------
TToggleDiv.prototype.initialize = function()
{
	if ( getCookie( this.name ) != "none")
		this.toggle();
}
//=================================================================================================

