var SIMPLEMODAL_OPTIONS = {
	onOpen: function (dialog) {
		dialog.overlay.fadeIn('fast', function () {
			dialog.container.fadeIn('fast', function () {
				dialog.data.show();
				$(window).trigger("resize.simplemodal");
			});
		});
	}, 
	onClose: function (dialog) {
		dialog.data.fadeOut('fast', function () {
			dialog.container.hide('fast', function () {
				dialog.overlay.fadeOut('fast', function () {
					$.modal.close();
				});
			});
		});
	},
	onShow: function (dialog) {
	  dialog.container.css({
	  	// autowidth & autoheight
	    //height: dialog.data.css('height')
	    /* width: dialog.data.css('width') */
	  });
	}
}

$(document).ready(function(){
	$("#simplemodal-overlay").live("click", function() {
		$("a.simplemodal-close").trigger("click");
	});
	
	
	$("#thumbs li a").each(function(){
		$(this).attr("href", $(this).attr("href") + location.hash);
	});
	
	$("#form_product_1_1").unbind("submit"); // чтобы форма не отправлялась дважды
});
function show_product(id) {
	cmsAjax(
		"/templates/includes/ajax_product.php",
		{
			"id": id			
		}, 
		function(res) {
			$("#product_modal").html(res.html);
			$("#product_modal").modal(SIMPLEMODAL_OPTIONS);
		}
	);
	return false;
	
}
