$(function(){
	
	var site = function() {
		this.galleryItem = $('a.gallery-item');	
		this.mainLi = $('#menu-main > li');
		this.galsLi = $('#menu-gals > li');

		this.init();
	};

	site.prototype = {
			
		init : function(){
			this.setMenu(this.mainLi);
			this.setMenu(this.galsLi);
			this.setFade(this.galleryItem);
			this.setFancy();
		},
		
		setFancy: function(){
			this.galleryItem.fancybox({
				'titlePosition': 'inside',
				'transitionIn' : 'fade',
				'transitionOut': 'fade'
			});
		},
		
		//endables the slidedown meu. and adds support for IE6
		setMenu : function(menu){
			var speedIn = 250;
			var speedOut = 200;
			
			menu.find('span.slider').css('display', 'none');
			
			menu.hover(function(){
				//mouseover
				$(this).find('span.slider').stop(true, true).slideDown(speedIn);
			}, function(){
				//mouseout
				$(this).find('span.slider').stop(true, true).slideUp(speedOut);		
			});
		},
		
		setFade : function(object){
			var speedIn = 350;
			var speedOut = 350;
			var hoverOp = '0.8';
			
			object.find('img').css({'-moz-opacity':'1', 'opacity':'1' });
			
			object.hover(function(){
				$(this).find('img').stop(true, true).animate({'-moz-opacity':hoverOp, 'opacity':hoverOp }, speedIn);
			}, function(){
				$(this).find('img').stop(true, true).animate({'-moz-opacity':'1', 'opacity':'1' }, speedOut);
			});
		}
	};
	
	//run
	new site();
});
