$(document).ready( function () {
	
	$('#countries-toggle').toggle( function () {
		$('#countries').stop().animate({'height': $('#countries .outside').height() }, 700, 'easeOutExpo');
		return false;
	}, function () {
		$('#countries').stop().animate({'height': 0 }, 700, 'easeOutExpo');
		return false;
	}).disableTextSelect();
	
	$('#countries-close').click( function () {
		$('#countries-toggle').trigger('click');
		return false;
	});
	
	$('#promo .img img,#promo .img').css('opacity',0.7);
	
	$('#promo a').hover(
		function () {
			$(this).parents('li').find('.anime-bg').stop().animate({'height': 87}, 800);
			if ($(this).parents('li').hasClass('current')) return;
			$('#fillblock').css('display','block');
			$('#promo .block').css('z-index',1);					
			$('#'+$(this).attr('name')).css('z-index',2);
			$('#fillblock').stop().css({'opacity':1}).animate({'opacity':0}, 500, 'easeOutExpo',function () {
				$('#fillblock').css({'display':'none', 'opacity':1});
			});						
		},
		function () {
			$(this).parents('li').find('.anime-bg').stop().animate({'height': 58}, 300);
		}
	);
	
	$('#promo a').mouseover( function () {			
		if ($(this).parents('li').hasClass('current')) return;
		$('#promo li').removeClass('current');
		$(this).parents('li').addClass('current');
		
		$('#promo .img img,#promo .img').css('opacity',0.7);
		
		$('#promo .anime-img').css('color', '#c6dbd7');
		$(this).parents('li').find('.anime-img').css('color', 'white');
		
		$('#promo li .anime-img').stop().css('height','103px');
		$('#promo li .img').stop().css('border-width','2px');
		
		$(this).parents('.anime-img').animate({'height':'206px'}, 50, 'linear', function () {
			$(this).animate({'height':'103px'}, 600, 'easeInQuint');
		});			
		
		$(this).parents('li').find('.img').css({'border-color': 'white', 'background': 'white'}).animate({'border-width':'15px'}, 100, 'linear', function () {
			$(this).animate({'border-width':'2px'}, 100, 'linear', function () {
				$(this).css('opacity',1);
				$(this).find('img').css('opacity',1);
			});
		});						
	});
	
});
