$(document).ready(function () {
	// Fade in e out
	$('dt a').hover(
		function() {
			$(this).children('span').fadeIn('100');
		},
		function() {
			$(this).children('span').fadeOut('100');
		});
	// Go to contact
	$('a#contact').click(function(){
		$.scrollTo( '#footer-wrap', 500);
		return false;
	});
	// Back to top
	$('a#top').click(function(){
		$('html, body').animate({scrollTop: '0px'}, 800);
		return false;
	});
	//slides
	$('#slider').slides({
				preload: true,
				generateNextPrev: false,
				effect: 'fade',
				play: 5000,
				fadeSpeed: 500
	});
	//Work filter
	$('ul#filter a').click(function() {
		$(this).css('outline','none');
		$('ul#filter .current').removeClass('current');
		$(this).parent().addClass('current');
		
		var filterVal = $(this).text().toLowerCase().replace(' ','-');
				
		if(filterVal == 'all') {
			$('div#portfolio dl.hidden').fadeIn('slow').removeClass('hidden');
		} else {
			
			$('div#portfolio dl').each(function() {
				if(!$(this).hasClass(filterVal)) {
					$(this).fadeOut('normal').addClass('hidden');
				} else {
					$(this).fadeIn('slow').removeClass('hidden');
				}
			});
		}
		
		return false;
	});
});

