$(function() {


		$("#slider").slider({
			value:5000,
			min: 200,
			max: 12000,
			step: 200,
			slide: function(event, ui) {
			
			function move_slider(){
				$("#n1").stop().animate({"height": Math.round(ui.value / 84)}, 200 ); 
				$("#n2").stop().animate({"height": Math.round(ui.value / 42)}, 200 ); 
				$("#n3").stop().animate({"height": Math.round(ui.value / 4200)}, 200 ); 
				$("#n4").stop().animate({"height": Math.round(ui.value / 4200)}, 200 ); 
				$("#n5").stop().animate({"height": Math.round(ui.value / 42)}, 200 ); 
				$("#n6").stop().animate({"height": Math.round(ui.value / 130)}, 200 ); 
				$("#n7").stop().animate({"height": Math.round(ui.value / 420)}, 200 ); 
				}
			
				$("#amount").text(ui.value);
				$("#n1 span").text(ui.value / 2 + ' человек разочаровались — внесли компанию в чёрный список');
				$("#n2 span").text(ui.value + ' человек зашли на сайт');
				$("#n3 span").text(ui.value / 100 + ' человек купили');
				$("#n4 span").text(ui.value / 100 + ' человек разочаровались');
				$("#n5 span").text(ui.value + ' человек зашли на сайт');
				$("#n6 span").text(ui.value * 0.3 + ' человек запросили дополнительную информацию');
				$("#n7 span").text(ui.value / 10 + ' человек купили');
				
				if((ui.value <= 8800) && (ui.value > 2000)){
					move_slider();
				}
				else if(ui.value <= 2000 ){
				$("#n2 span").animate({"top":"-65px"}, 100);
				$("#n5 span").animate({"top":"-60px"}, 100);
					move_slider();
				}
				else{
				$("#n2 span").animate({"top":"0"}, 100);
				$("#n5 span").animate({"top":"0"}, 100);
					$("#n1").stop().animate({"height": Math.round(10000 / 84)}, 200 ); 
					$("#n2").stop().animate({"height": Math.round(10000 / 42.5)}, 200 ); 
					$("#n3").stop().animate({"height": Math.round(10000 / 4200)}, 200 ); 
					$("#n4").stop().animate({"height": Math.round(10000 / 4200)}, 200 ); 
					$("#n5").stop().animate({"height": Math.round(10000 / 42.5)}, 200 ); 
					$("#n6").stop().animate({"height": Math.round(10000 / 130)}, 200 ); 
					$("#n7").stop().animate({"height": Math.round(10000 / 420)}, 200 ); 
				}
			}
		});
		
			$("#slider1").slider({
			value:10000,
			min: 500,
			max: 50000,
			step: 500,
			slide: function(event, ui) {
				$("#amount1").text(ui.value);

				
			$("#n10").stop().animate({"height": Math.round(ui.value / 1440)}, 200 ); 
			$("#n20").stop().animate({"height": Math.round(ui.value / 710)}, 200 ); 
			$("#n30").stop().animate({"height": Math.round(ui.value / 1440)}, 200 ); 
			$("#n40").stop().animate({"height": Math.round(ui.value / 260)}, 200 ); 
			
		
			}
		});
		
	$("#n1").css({"height": $("#slider").slider("value") / 84 + "px"});
	$("#n2").css({"height": $("#slider").slider("value") / 42 + "px"});
	$("#n3").css({"height": $("#slider").slider("value") / 4200 + "px"});
	$("#n4").css({"height": $("#slider").slider("value") / 4200 + "px"});
	$("#n5").css({"height": $("#slider").slider("value") / 42 + "px"});
	$("#n6").css({"height": $("#slider").slider("value") / 130 + "px"}); 
	$("#n7").css({"height": $("#slider").slider("value") / 420 + "px"});
	
	
				$("#amount").text($("#slider").slider("value"));
				$("#amount").appendTo("#slider .ui-slider-handle");
				$("#amount1").text($("#slider1").slider("value"));
				$("#amount1").appendTo("#slider1 .ui-slider-handle");
				
				$("#n10 span").text('Затраты на продвижение');
				$("#n20 span").text('Количество клиентов');
				$("#n30 span").text('Затраты на продвижение');
				$("#n40 span").text('Количество клиентов');
				
				
				$("#n1 span").text($("#slider").slider("value") / 2 + ' человек разочаровались — внесли компанию в чёрный список');
				$("#n2 span").text($("#slider").slider("value") + ' человек зашли на сайт');
				$("#n3 span").text($("#slider").slider("value") / 100 + ' человек купили');
				$("#n4 span").text($("#slider").slider("value") / 100 + ' человек разочаровались');
				$("#n5 span").text($("#slider").slider("value") + ' человек зашли на сайт');
				$("#n6 span").text($("#slider").slider("value") * 0.3 + ' человек запросили дополнительную информацию');
				$("#n7 span").text($("#slider").slider("value") / 10 + ' человек купили');
	
			$("#n10").stop().animate({"height": Math.round($("#slider1").slider("value") / 1440)}, 200 ); 
			$("#n20").stop().animate({"height": Math.round($("#slider1").slider("value") / 710)}, 200 ); 
			$("#n30").stop().animate({"height": Math.round($("#slider1").slider("value") / 1440)}, 200 ); 
			$("#n40").stop().animate({"height": Math.round($("#slider1").slider("value") / 260)}, 200 ); 
	
		$('.img_galery').lightBox();


	});
	
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
try {
var pageTracker = _gat._getTracker("UA-10077420-1");
pageTracker._trackPageview();
} catch(err) {}
