var Blinds = Class.create();

Blinds.prototype = {

	_container: '',
	_width: '58%',
	_open: true,
	_onopen: false,
	_onopened: false,
	_onclose: false,
	_onclosed: false,

	initialize: function(_cont){
		this._container = _cont;
	},

	isOpen: function(){
		return this._open;
	},

	open: function(){

		var c = this._container;
		var w = this._width;

		this.callback( this._onopen );

		new Effect.Morph( c,{
			style: { width: w },
			duration: 1.0,
			afterFinish: function(){
			    blinds.callback( blinds._onopened );
		    }

		});

		this._open = true;

	},

	close: function(){

		//sIFR.rollback();
		//replace_menu_text();

		var c = this._container;
		var w = this._width;

		this.callback( this._onclose );

		new Effect.Opacity( $(c).down('.infront'), {
			from: 1.0,
			to: 0.0,
			duration: 0.5,
			afterFinish: function(){
				new Effect.Morph( c,{
					style: { width: '0%' },
					duration: 1.0,
					afterFinish: function(){
					    blinds.callback( blinds._onclosed );
				    }
				});
		} });

		this._open = false;

	},

	toggle: function(){
		if( this._open )
			this.close();
		else
			this.open();
	},
	
	callback: function( _f ){
	    if( _f ){
	    	//console.log( 'callback: ' + _f );
	        eval( _f );
	    }
	}

}
