var MainSite=new Class({
	initialize: function(){
		window.addEvent('domready',this.domready.bind(this));
	},
	domready: function(){
		this.showpage('welcome');

		if(Browser.Platform.linux){
			$('nav_portfolio').addEvents({
				'mouseenter': this.flashzfix,
				'mouseleave': this.flashzfix
			});
		}
	},
	flashzfix: function(evt){ //for firefox/linux z-index bug
		var iframe=$('flashzfix');
		var target=$('nav_portfolio').getChildren()[1];
		if(evt.type=="mouseout")
			iframe.setStyle("display","none")
		else
			iframe.setStyles({
					display: 'inline',
					left: target.getPosition().x,
					top: target.getPosition().y,
					width: target.getSize().x,
					height: target.getSize().y
			});
	},
	
	showpage: function(id){
		$$('div.content').setStyle('display','none');
		$$('div.gallery').setStyle('display','none');
		$(id).setStyle('display','inline');
	}
});

var site=new MainSite();

//Fix hover menus for IE5/IE6
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
