$(document).ready(function(){
	$('.footer .contacts a').click(function(){ fContacts(this); return false; })
	$('.team a').click(function(){ return false; });
	/*$('.portfolio a').hover(function(){
		a = $(this);
		b = a.find('b');
		t = a.find('.text');
		b.animate({top:0},200);
		t.animate({top:0},200)
	},function(){
		a = $(this);
		b = a.find('b');
		t = a.find('.text');
		b.animate({top:-200},200,function(){ $(this).dequeue() });
		t.animate({top:-200},200,function(){ $(this).dequeue() });
	})*/
	/*$('.portfolio a').hover(function(){
		a = $(this);
		a.find('.text').stop().animate({top:0},300,'easeOutCubic');
	},function(){
		a = $(this);
		a.find('.text').stop().animate({top:157},200,'easeOutCubic');
	});*/
	$('.portfolioDesign').parent().addClass('portfolioWrapperDesign');
	$('.wedo a').hover(function(){
		at = $(this).find('.text');
		at.stop().animate({top:250},300,'easeInCubic',function(){
			$(this).css({top:-300}).animate({top:0},300,'easeOutCubic');
		});
	},function(){
		at = $(this).find('.text');
		at.stop();
		if (parseInt(at.css('top')) >= 240) {
			at.animate({top:240},300,'easeOutCubic');
		} else {
			at.animate({top:-250},300,'easeInCubic',function(){
				$(this).css({top:250}).animate({top:240},300,'easeOutCubic');
			});
		}
	});
    $('.caseSlides h3 a').click(function(){ changeSlide(this);return false; });
})
function fContacts(a) {
	a = $(a);
	if (!a.hasClass('active')) {
		$('.footer .contacts a.active').removeClass('active');
		a.addClass('active');
		class_ = a.attr('rel');
		s = $('.footer .contacts span');
		s.filter(':visible').addClass('hidden');
		s.filter('.'+class_).removeClass('hidden');
	}
}
function changeSlide(a) {
    a = $(a);
    if (!a.hasClass('active')) {
        class_ = a.parent().attr('class');
        $('.caseSlide:visible').hide();
        $('.caseSlides div.'+class_).show();
        $('.caseSlides a.active').removeClass('active');
        $('h3.'+class_+' a').addClass('active');
    }
}