window.addEvent('domready',function () { init(); });

var fx;
function init() {
	//fx = new Fx.Styles( $('search-box'), {duration:400, wait:false});
	var fx = new Fx.Morph( $('search-box'), { duration: 400, wait:false });

	$('search-box').style.display = 'block';
	$('search-box').setOpacity(0);
	$('search').addEvent("click", function (event) {
		fx.start({opacity: 1});	
	});
	$('search-close-img').addEvent("click", function (event) {
		fx.start({opacity: 0});	
	})
	$('search-close-txt').addEvent("click", function (event) {
		fx.start({opacity: 0});	
	})
	/*
	$('search-box').addEvent("mouseleave", function (event) {
		fx.start({width: 0, height: 0, opacity: 0});	
	})
	*/
}
function nil() {  }

var Dialog = new Class({
	Implements: Options,
	options: {
		duration: 1000,
		onComplete: Class.empty,
		onStart: Class.empty,
		top: 0,
		left: 0
	},
	initialize: function(container,options) {
		this.setOptions(options);
		this.container = $(container);
		this.container.setStyles({
			'position':'absolute',
			'top':this.options.top,
			'left':this.options.left,
			'opacity':0,
			'display': 'block'
		});
		this.fx = new Fx.Morph(this.container, { duration: this.options.duration });
	},
	show: function() {
    this.fx.start({ opacity:1 });
	},
	hide: function() {
    this.fx.start({ opacity:0 });
	}
});

