new Namespace("at.thermenland.contentslider.quicksearch");
at.thermenland.contentslider.quicksearch = Class.create({

	initialize : function (element) {
		this.slider = element;
		this.gs_top = this.slider.getElementsBySelector('.qs_top')[0];
		this.gs_bottom = this.slider.getElementsBySelector('.qs_bottom')[0];
		
		this.gs_top_button = this.slider.getElementsBySelector('.qs_top .headline')[0];
		this.gs_top_button.observe('click', this.openSearch.bind(this));
		
		this.gs_bottom_button = this.slider.getElementsBySelector('.qs_bottom .headline')[0];
		this.gs_bottom_button.observe('click', this.openRequest.bind(this));
	},
	
	openSearch : function () {
		if (parseInt(this.gs_bottom.getStyle('top')) < 100) {
			ex2 = new Animator({ 
				transition: Animator.makeEaseOut(4),
				duration: 1000
			});
			ex2.addSubject(new NumericalStyleSubject(this.gs_bottom, 'top', 34, 282));
			ex2.play();
			this.gs_top.addClassName('open');
			this.gs_bottom.removeClassName('open');
		}	
		else {
			this.openRequest();
		}
	},
	
	openRequest : function () {
		if (parseInt(this.gs_bottom.getStyle('top')) > 100) {
			ex3 = new Animator({ 
				transition: Animator.makeEaseOut(4),
				duration: 1000
			});
			ex3.addSubject(new NumericalStyleSubject(this.gs_bottom, 'top', 282, 34));
			ex3.play();
			this.gs_top.removeClassName('open');
			this.gs_bottom.addClassName('open');
		} else {
			this.openSearch();
		}
	}

});



