var slideWin = new Class({
	Implements: [Options, Events],

	options: {
		'id': 'slider_div',
		'id_content': 'slider_div_content',
		'transition': 'expo:out'
	},

	initialize: function(options) {
		this.setOptions(options);
		this.sliderDiv = new Element('div', {
			'id': this.options.id,
			'styles': {
				'position': 'absolute',
				'left': '0px',
				'top': '0px',
				'display': 'none',
				'overflow': 'auto',
				'z-index': 1000,
				'width': window.getSize().x,
				'height': window.getSize().y
			}
		}).inject(document.body);
		this.contentDiv = new Element('div', {
			'id': this.options.id_content
		}).inject(this.sliderDiv);
		this.slideFx = new Fx.Tween(this.sliderDiv, {
			'transition': this.options.transition,
			'link': 'cancel',
			'onComplete': this.slideComplete.bind(this)
		});
		this.slideStatus = 'out';
		window.addEvent('resize', function(){
			if (this.sliderStatus != 'out') {
				this.sliderDiv.setStyles({
					'width': window.getSize().x,
					'height': window.getSize().y
				});
			}
		}.bindWithEvent(this));
	},

	slideComplete: function() {
		switch (this.slideStatus) {
			case 'moving_in':
        this.slideStatus = 'in';
				this.fireEvent("slideInComplete");
				break;
			case 'moving_out':
        this.slideStatus = 'out';
				this.sliderDiv.setStyle('display', 'none');
				$(document.body).setStyle('overflow', '');
				$(document.html).setStyle('overflow', '');
				this.fireEvent("slideOutComplete");
				break;
		}
	},

	slideIn: function() {
		if (this.slideStatus == 'in') {
			return;
		}
		this.slideStatus = 'moving_in';
		$(document.body).setStyle('overflow', 'hidden');
		$(document.html).setStyle('overflow', 'hidden');
		this.sliderDiv.setStyle('display', 'block');
		this.sliderDiv.setStyle('top', window.getSize().y + window.getScroll().y);
		this.slideFx.start('top', window.getScroll().y);
	},

	slideOut: function() {
		if (this.slideStatus == 'out') {
			return;
		}
		this.slideStatus = 'moving_out';
		this.slideFx.start('top', window.getSize().y + window.getScroll().y);
	},

	slideToggle: function() {
		if (this.slideStatus == 'out' || this.slideStatus == 'moving_out') {
			this.slideIn();
		} else if (this.slideStatus == 'in' || this.slideStatus == 'moving_in') {
			this.slideOut();
		}
	},

	setContent: function(content) {
		this.contentDiv.set('html', content);
	},

	setContentFromElement: function(element) {
		if (element) {
			this.setContent(element.get('html'));
		}
	}

});