// Hovers
$(function() {
	$("#footer a span").css("opacity","0");
	$("#footer a span").hover(function () {
		$(this).stop().animate({
			opacity: 1
		}, 300);
	},
	function () {
		$(this).stop().animate({
			opacity: 0
		}, 500);
	});
	$(".image a span").css("opacity","0");
	$(".image a span").hover(function () {
		$(this).stop().animate({
			opacity: 1
		}, 500);
	},
	function () {
		$(this).stop().animate({
			opacity: 0
		}, 500);
	});
});

// Main Navigation
function menu(){
	$("#navigation li ul").css({display: "none"});
	$("#navigation li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).fadeToggle(300);
		},
		function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
	}
	$(document).ready(function(){					
		menu();
});

// Pretty Photo
$(document).ready(function(){
	$("#portfolio:first a[rel^='prettyPhoto']").prettyPhoto({animation_speed:'normal',slideshow:3000});
	$("#portfoliosingleposts a[rel^='prettyPhoto']").prettyPhoto();
	$("#content a[rel^='prettyPhoto']").prettyPhoto();
});

// Portfolio Filter
$(document).ready(function(){

	var $container = $('#portfolio');

	$('#filters a').click(function(){
		var selector = $(this).attr('data-filter');
		$container.isotope({ 
		animationOptions: {
			duration: 500,
			easing: 'easeInOutSine',
			queue: false
		},
		filter: selector 
		});
		return false;
	});

	$('#options').find('.option-set a').click(function(){
	var $this = $(this);
		if ( !$this.hasClass('selected') ) {
			$this.parents('.option-set').find('.selected').removeClass('selected');
			$this.addClass('selected');
		}
	});			 
	$(function(){ $container.isotope({ itemSelector : '.portfolio-item', animationEngine : 'jquery' });	});

});

// Z-Index Improving for IE
$(function() {
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});
});
