function mycarousel_initCallback(carousel)
{
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function str_replace(search, replace, subject) {
return subject.split(search).join(replace);
}

jQuery(document).ready(function() {
/*подключение каруселей*/
    jQuery('#mycarousel').jcarousel({
        visible: 3,
        auto: 5,
        wrap: 'circular',
      /*  easing: 'linear',
        animation:5000,*/
        initCallback: mycarousel_initCallback

    });
	
	/*Заказ анимация формы*/
	$('.next1, .next2, .next3, .next4').css({'display':'block'});
	$('div.quiz').css({'height' :'205'+'px', 'overflow': 'hidden'});
	$('.first_answer').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-210'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.second_answer').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-410'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.third_answer').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-1190'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.next1').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-610'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.next2').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-805'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.next3').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-1005'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});
	$('.next4').click(function() {
			$('.order_form').animate({opacity:'toggle'}, 500, function() {$('.order_form').css({'margin-top':'-610'+'px'}).animate({opacity:'toggle'}, 400 )} );
	});	
	
	/*калькулятор сайта*/
	var str = "";
	$(".calc_inner select").change(function () {

			$("select#site_type option:selected").each(function () {
				str = $(this).val();
			});
			$("select#cms_type option:selected").each(function () {
				str = str*$(this).val();
            });
			$("select#content_type option:selected").each(function () {
				str = str*$(this).val();
            });	
			$("select#creation_time option:selected").each(function () {
				str = str*$(this).val();
            });					
			 /*alert (str);*/
			$.ajax({
				type: "GET",
				url: '/js/calc.php',
				beforeSend: function() {$('.sum_output').html('<img src="/images/blur_price.png" />')},
				dataType : "html",
				data: "t="+str,
				success: function(response){
					/*alert(response);
					return true;*/
					$('.sum_output').html(response)
				},
				error: function(){
					alert();
				}
			})
	})

});



