var news_splash = {
	init: function() {
		this.splash = $('news_splash');
		
		if(this.splash) {
			this.splash.set('tween', {duration: 1000});
			this.original_height = this.splash.getStyle('height');
			this.splash.setStyle('height', 0);
	
			$('news_splash_close').addEvent('click', function(el) {
				new Event(el).stop();
				this.close();
			}.bind(this));
	
			if(!Cookie.read('hide_splash')) {
				news_splash.fade();
			}
		}
	},

	fade: function() {
		if(this.splash) {

			var new_height = 0;

			if(this.splash.getStyle('height') == '0px')
				new_height = this.original_height;

			this.splash.tween('height', new_height);
		}
	},

	close: function() {
		Cookie.write('hide_splash', true, { duration: 5 });
		this.fade();
	}
}

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