var Main = new Class({
	
	initialize : function(){
		if($$('.continent > ul').length > 0) this.loadAccordion();
		
		this.createLangMenu();
		
		//Explorer 6 fixes
		if (Browser.Engine.trident && Browser.Engine.version == 4){
			$$('.continent > ul li:first-child').setStyle('padding-top',4);
		}
		
		if($$('.office .body').length) this.loadPHPContacts();
		
	},
	
	loadAccordion : function(){
		var toggler = $$('.continent .title');
		var content = $$('.continent > ul');	
		
		content.setStyle('display', 'block');
		
		new Accordion(toggler, content, {
			alwaysHide : true,
			show : -1,
			opacity : false
		});
	},
	
	createLangMenu : function() {
		var height = $('langbox').setStyle('display','block').getHeight();
		$('langbox').setStyle('height','0');
		
		$('langbox').position({
		    relativeTo: $('langmenu'),
		    position: 'centerBottom',
		    edge: 'centerTop',
		    offset: { x: 0, y: 5 }
		})
		$('langmenu').addEvent('click',function(e){
			this.toggleClass('s');
			new Event(e).stop();
			var to = ($('langbox').getHeight() == 0) ? height : 0;
			$('langbox').tween('height',to);
		});
	},
	
	loadPHPContacts : function(){
		var content = $$('.office .body');
		content.setStyle('display', 'block');
		new Accordion($$('.office h3'), content, {
			alwaysHide : true,
			show : -1,
			opacity : false
		});
	}
	
}); 

window.addEvent('load', function(){ new Main(); });

