// JavaScript Document
$(document).ready(function(){
	$(".our_best .one").hover(function(){
		$(this).find("p").show();
		$(this).find("a.name").addClass("name_active");
		},
		function(){
			$(this).find("p").hide();
			$(this).find("a.name").removeClass("name_active");
			})
	$(".neperf").click(function(){
		$(".perf").removeClass("active_p");
		$(this).addClass("active_p");
		$(".inative").addClass("z");})
	
	$(".perf").click(function(){
		$(".neperf").removeClass("active_p");
		$(this).addClass("active_p");
		$(".inative").removeClass("z");})
		
	$(".text_desc .more").click(function(){
		ww=$(this).parents(".text_desc ").find(".description").height()+10;
		$(this).parents(".text_desc ").find(".overflow").animate({height:ww+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".less").show();
		})
		
		$(".text_desc .less").click(function(){
		//ww=$(".description").height();
		$(this).parents(".text_desc ").find(".overflow").animate({height:105+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".more").show();
		})	
			
			
		
	$(".text_desc .more").click(function(){
		ww=$(this).parents(".text_desc ").find(".description").height()+10;
		$(this).parents(".text_desc ").find(".overflow1").animate({height:ww+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".less").show();
		})
		
		$(".text_desc .less").click(function(){
		//ww=$(".description").height();
		$(this).parents(".text_desc ").find(".overflow1").animate({height:170+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".more").show();
		})			
		
		
		
		$(".text_desc .more").click(function(){
		ww=$(this).parents(".text_desc ").find(".description").height()+10;
		$(this).parents(".text_desc ").find(".overflow2").animate({height:ww+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".less").show();
		})
		
		$(".text_desc .less").click(function(){
		//ww=$(".description").height();
		$(this).parents(".text_desc ").find(".overflow2").animate({height:40+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".more").show();
		})			
		
		
		$(".text_desc .more").click(function(){
		ww=$(this).parents(".text_desc ").find(".description").height()+10;
		$(this).parents(".text_desc ").find(".overflow3").animate({height:ww+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".less").show();
		})
		
		$(".text_desc .less").click(function(){
		//ww=$(".description").height();
		$(this).parents(".text_desc ").find(".overflow3").animate({height:360+'px'},"slow");
		$(this).hide();
		$(this).parents(".text_desc ").find(".more").show();
		})			
		
		
		
		
			
	})
	
	
	
	
	
	$(document).ready(function () {


		var obj = $("#scroll-block");

		$(window).scroll(function () {

			var allhe = $(this).scrollTop() + $(this).height();
			var bodyHeight = $("body").height();
			var prc = allhe/bodyHeight * 100;

			if (prc > 90) {
				
				if ($(obj).css("display") == "block") {
					$(obj).fadeOut();
				}
			} else {
				
				if ($(obj).css("display") == "none") {
					$(obj).fadeIn();
				}
				
			}
			
		});


		$("#close-block-button").click(function () {
			$("#scroll-block").toggle();
			return false;
		});


});

