function onAjaxSuccess(data)
{
	$('.f-content').html(' ');
	$('.mess').html('Спасибо, Ваше сообщение отправлено, мы скоро с Вами свяжемся.');	
	$('.header .header-form').delay(2000).fadeOut();
}
$(document).ready(function ()
{
	$('.header .header-form .submit a').click(function()
	{
		var name=$('#name').val();
		var phone=$('#phone').val();
		var msg=$('#msg').val();
		if(!name || !phone || !msg)
		{
			$('.mess').html('Заполните все поля');
		}
		else
		{
			$('.mess').html('Спасибо, Ваше сообщение отправлено, мы скоро с Вами свяжемся.');
			$.post('/message.php', { name:name, phone:phone, msg:msg }, onAjaxSuccess);
		}
		return false;
	});
	$('.header-nav  a').click(function()
	{
		$('.header .header-form').fadeIn();
		return false;
	});
	$('.header .header-form  .x').click(function()
	{
		$('.header .header-form').fadeOut();
		return false;
	});
	$('.header .header-form').corner('round 10px');
	$("a[rel=lightbox]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Фото ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});
});
