// default page initializer class
var PageInit = new Class({
	initialize: function(){
	   this.removeThumbLinks();
	   this.addLinkEffects();
	   this.addMenuFX();
	   new SlideBox();
	   //addLogoHover();
	   this.addFooterHover();		
	},
	addMenuFX: function(){
		var menu = $("menuEar");
		menu.addEvent('mouseover',function(){
			var m = $("menu").getStyle('margin-right').toInt() < 0 ? 0 : "-400"
			$("menu").tween('margin-right',m);
			return false;
		});
		if(Cookie.read("visited")==null){
			Cookie.write("visited","true");
			$("menu").tween('margin-right',0);
		}
		
	},
	
	addFooterHover: function(){
		var footer=$('footer');
		footer.setOpacity(0.9);
		footer.addEvent('mouseover',function(){
			this.fade(1);
			return false;
		});
		footer.addEvent('mouseleave',function(){
			this.fade(0.9);
			return false;
		})
	},
	
	addLinkEffects: function(){
		$$('a').each(function(item,index){
				item.addClass("noHover");
				item.set('morph', {duration:600});

				var sColor=item.hasClass("button") ? "#232323" : "#6fc1bc";
				item.setStyle('color',sColor);

				item.addEvent('mouseover',function(){
					this.morph({color:"#f06c3c"});
					return false;
				});
				item.addEvent('mouseleave',function(){
					this.morph({color:sColor});
					return false;
				})
		});
		$$('#menu a').each(function(item,index){
				item.addClass("noHover");
				if(item.hasClass(""))
				item.set('tween', {duration:50,transition:'quad'});
				item.addEvent('mouseover',function(){
					//this.tween("padding-top",9);
					return false;
				});
				item.addEvent('mouseleave',function(){
					//this.tween("padding-top",0);				
					return false;
				})
		});		
	},
	
	removeThumbLinks: function(){
		$$(".thumbnail").each(function(item,index){;
			item.addEvent('mouseenter',function(){
				this.getElement('.overlay').setOpacity(0);
				this.getElement('.overlay').setStyle("display","block");
				this.getElement('.overlay').fade("in");
				return false;
			});
			item.addEvent('mouseleave',function(){
				this.getElement('.overlay').fade("out");
			});

		});		
	},
	
	addLogoHover : function(){
		var logo=$('logo');
		logo.setOpacity(0.8);
		logo.addEvent('mouseover',function(){
			this.fade(1);
			return false;
		});
		logo.addEvent('mouseleave',function(){
			this.fade(0.5);
			return false;
		})
	}
});
var Init = PageInit;

