$(document).ready(function(){
	$("#orderForm .zakaz-btn").click(function() {
		var post = {};
		var b = $(this);
		$('#orderForm').find ('input, textarea, select').each (function () {
			var t = $(this), n = t.attr ('name');
			if (n == '') return;
			if (t.attr ('type') != 'checkbox') post [n] = t.val ();
			else if (t.attr ('checked')) post [n] = t.val () || 'on';
		});
		$.post ('/system/php/document421.php', post, function (d) {
			if (d == 'ok')
				b.animate({"left":"130px"}, 'normal', 'linear', function () {
					document.location = document.location;
				});
			else
				alert (d);
		
		})
		return false;
	});
	$(".header .zakaz-btn").click(function(){
		$(this).animate({"left":"130px"});
		$("#zakaz").fadeIn();
		return false;
	});
	$(".images-menu a i").click(function(){
		$(this).parent().find(".popup").toggle();
		if ($(this).parent().find(".popup").is(":visible")) $(this).show(); else $(this).hide();
		return false;
	});
	$(".img-gallery .imgs a").click(function(){
		imgIndex = $(this).parents(".img-gallery").find(".imgs a").index($(this));
		$(this).parents(".img-gallery").find(".big-img img.active").hide().removeClass("active");
		$(this).parents(".img-gallery").find(".big-img img").eq(imgIndex).fadeIn().addClass("active");
		return false;
	});
	if($('table.colored').length)	$('table.colored').tableHover({colClass: 'hover', cellClass: 'hovercell'}); 

})
