$(document).ready(function() {
	$('.project-item a').hover(function(){
		var o = $(this).find('.project-item-bottom');
		var h = o.outerHeight();
		if(h)
		{
			var t = 140 - h;
			o.animate({top: t},100);
		}
	},function(){
		$(this).find('.project-item-bottom').animate({top: 140},100);
	});
	
	$('#moreprojects').click(function(){
		var a = $(this);
		var o = $('#topprojects');
		var h = o.height();
		
		if(h == 154)
		{
			var newh = 462;
			o.animate({height: newh},200,function(){
				a.text('Меньше проектов').addClass('moreprojects');
			});
		}
		else
		{
			newh = 154;
			o.animate({height: newh},200,function(){
				a.text('Больше проектов').removeClass('moreprojects');;
			});
		}
		a.blur();
		return false;
	})

	$('#online').click(function(){
		var id = 48;
		file = MODULE_DIR + '/Form/Form_modal.php?lang=' + lang + '&id=' + id;
		$.drawLoading();
		var d = $('<div></div>');
		d.load(file,function(){
			$.removeLoading();
			$(this).dialog({
				width: '70%',
				open: function(){
					if(window.init) init(d);
					$(this).find(':input:visible:first').focus();
				}
			});
		});
		return false;
	})

	$('.project-item-bottom').click(function(){
		var u = $(this).parents('a').attr('href');
		self.location.href = u;
		return false;
	})
});
