


var WebSiteMain = new Class({

	templateId: null,
	currentSection: null,
	
	allContainerElement: null,
	
	contentElement: null,
	containerElement: null,
	containerInitHeight: null,

	initialize: function() {
		window.addEvent('domready', this.onDOMReady.bind(this));
		if(!window.console || !window.console.log) {
			window.console = {};
			window.console.log = function(str) { window.webSiteMain.writeToConsole(str); }
			window.console.debug = function(str) { window.webSiteMain.writeToConsole(str); }
		}
	},
	writeToConsole: function(str) { /*$('consol').set('html', $('consol').get('html') + "<br />\n" + str); */},
	
	
	onDOMReady: function() { 
		this.templateId = parseInt($('allContainer').get('class').split('-')[1]);
		
		this.allContainerElement = $('allContainer');
		this.containerElement = $('contentContainer');
		this.contentElement = $('content');
		
		this.menu = new WebSiteMenu();
	}
	
	
	
});

var webSiteMain = new WebSiteMain();




  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////////    WEB SITE MENU      ////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

var WebSiteMenu = new Class({

	t13IsVisible: false,
	t13Display: null,
	t13Link: null,
	
	initialize: function() {
		this.t13Display = $('t13_display');
		if(this.t13Display) {
			this.t13IsVisible = Cookie.read('contacts_visible') > 0;
			this.t13Display.set('tween', { duration: 'short' });
			this.t13Display.fade(this.t13IsVisible ? 'show' : 'hide');
		}
		
		
		this.t13Link = $('menu').getElement('a.t13');
		if(this.t13Link) {
			this.t13Link.addEvent('click', this.onT13LinkClick.bindWithEvent(this));
		}
	},
	
	onT13LinkClick: function(event) {
		event.stop();
		this.toggleT13Display();
	},
	
	toggleT13Display: function() {
		if(this.t13Display) {
			this.t13IsVisible = !this.t13IsVisible;
			this.t13Display.fade('toggle');
			Cookie.write('contacts_visible', this.t13IsVisible ? 1 : 0, {
				'path': '/'
			});
		}
	}
	
	
});



