$(document).ready(function(){  
	$("#form_send").click(function(event) {
		event.preventDefault();
		var rez = ''; var form = 'div.contact';
		var i = 0;
		var t_c = $(form+" input").length + $(form+" select").length;
		$(form+" input").each(function(){
			if($(this).val()){
				if($(this).attr("type") == "checkbox")
					if($(this).attr("checked")) { rez += $(this).attr("name")+"="+encodeURIComponent($(this).val()); rez += '&'; } else {}
				else { rez += $(this).attr("name")+"="+encodeURIComponent($(this).val()); rez += '&'; }
			}
			i++;
		})
		$(form+" textarea").each(function(){
			if($(this).val()){
			rez += $(this).attr("name")+"="+encodeURIComponent($(this).val());
			rez += '&';
			}
			i++;
		})
		$(form+" select").each(function(){
			if($(this).val()){
			rez += $(this).attr("name")+"="+encodeURIComponent($(this).val());
			rez += '&';
			}
			i++;
		})
		$("#informer").css('z-index', 90);
		$("#informer").css('height', $(document).height());
		var height = $(window).height();
		$("#informer img").css('margin-top', (height / 2) - 50);
		$("#informer").show();
		$("#informer").animate({ opacity: 0.5 }, 500);
		$("#informer").load("/send_form.php", { data : rez } ,function(){ 				
				$("#informer").animate({ opacity: 0 }, 500, function(){$("#informer").css('z-index', -90);});
				$("#informer").hide();
				$("input[name='fio']").attr('value','');
				$("input[name='cont']").attr('value','');
				$("textarea[name='text']").html('Письмо отправлено!');
			});
	});
});  