/**
 * News for Günter & Kuster, Zürich
 *
 * (c) silverfish ag, zürich, 2010 
 */
debugArr = [];

var news = {
	
	visible: false,
	
	init: function() {
		Ext.get('news-box').setY(-10);
	},
	
	/* move and show/hide boxes (homepage only) */
  	show: function() {
  		
  		var newsBox = Ext.get('news-box');
 		var naviBox = Ext.get('navigation');
		
		if (!this.visible) {
			
			window.scrollTo('top', 0);
			
	  		newsBox.stopFx().syncFx().shift({y: 130, easing: 'easeOut', duration: .5}).fadeIn({endOpacity: 1, duration: 0.5}).sequenceFx();
	  		naviBox.shift({y: 10, easing: 'easeOut', duration: .5}).replaceClass('navigation-light', 'navigation-dark');
	  		
	  		// change color of "contact"-links
	  		Ext.select('a.contact').replaceClass('contact-dark', 'contact-light');
	  		
	  		this.visible = true; 
  		}		
	},
	
	hide: function() {
  		
  		var newsBox = Ext.get('news-box');
  		var naviBox = Ext.get('navigation');
  		
  		newsBox.stopFx().syncFx().shift({y: 0, easing: 'easeOut', duration: .5}).fadeOut({endOpacity: 0, duration: 0.5}).sequenceFx();
  		naviBox.shift({y: 130, easing: 'easeOut', duration: .5}).replaceClass('navigation-dark', 'navigation-light');
  		
 	  	// change color of "contact"-links
	  	Ext.select('a.contact').replaceClass('contact-light', 'contact-dark');
	  		 		
  		this.visible = false;
	},
	
	
	/* just fade newsbox in or out (all pages) */
	fadeIn: function() {
		var newsBox = Ext.get('news-box');
		
		if (!this.visible) {
	  		newsBox.fadeIn({endOpacity: 1, duration: 0.5});
	  		this.visible = true; 
  		}			
	},
	
	fadeOut: function() {
		var newsBox = Ext.get('news-box');
		newsBox.fadeOut({endOpacity: 0, duration: 0.35});
		this.visible = false;
	}
}

