$(document).ready(function() {

	$("a[rel=img_group]").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'none',
		'titleShow':false,
		'speedIn': 600,
		'speedOut': 200,
		'overlayShow': true,
		'cyclic' : true
	});

	/*425" height="349
	w=680 h=495
	638x506
	*/
	$("#video2010").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'title'			: this.title,
			'width'			: 578,
			'height'		: 460,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});

	/*578-490 с рамкой*/
	$("#videoreklama").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'title'			: this.title,
			'width'			: 578,
			'height'		: 460,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

		return false;
	});


	$("#message").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false,
		'onClosed'		: function() {
		    $("#msg_error").hide();
		}
	});
	$("#msg_form").bind("submit", function() {

		if ($("#FIO").val().length < 1 || $("#CONTACT").val().length < 1 || $("#MSG").val().length < 5) {
		    $("#msg_error").show();
		    $.fancybox.resize();
		    return false;
		}

		$.fancybox.showActivity();

		$.ajax({
			type		: "POST",
			cache	: false,
			url		: "/",
			data		: $(this).serializeArray(),
			success: function(data) {
				$.fancybox(data);
			}
		});

		return false;
	});


	$("#otziv").fancybox({
		'scrolling'		: 'no',
		'titleShow'		: false,
		'onClosed'		: function() {
		    $("#otziv_error").hide();
		}
	});
	$("#otziv_form").bind("submit", function() {

		if ($("#FIO1").val().length < 1 || $("#TEMA").val().length < 1 || $("#MSG1").val().length < 5) {
		    $("#otziv_error").show();
		    $.fancybox.resize();
		    return false;
		}

		$.fancybox.showActivity();

		$.ajax({
			type		: "POST",
			cache	: false,
			url		: "/",
			data		: $(this).serializeArray(),
			success: function(data) {
				$.fancybox(data);
			}
		});

		return false;
	});

});

