    /* Функция динамического переключения вкладок */
	function tabs() {
	  $("ul.jtabs").each(function() {
		$(this).find("li").each(function(i) {
		  $(this).click(function(){
			$(this).addClass("active").siblings().removeClass("active").parents("div.section").find("div.box").hide().end().find("div.box:eq("+i+")").fadeIn(150);
			return false;
		  });
		});
	  });
	};

    /* Функция динамической смены картинок */
	function slide_img() {
		$(".img_posit a").click(function(){
			var path = $(this).attr("href");
			var path_small = $(this).find("img").attr("src");
			var theImage = new Image();
			theImage.src = path;
			$pr = $(this).parents("div.imgs");
			$(this).addClass("active").siblings().removeClass("active").parents("div.imgs").find("img").animate({opacity: 0}, 200, function(){
				$(this).remove();
				$pr.find("a:first").append(theImage, function(){ 
					alert("!");
					$(this).hide();
				});
			});			
			
			/*.animate({opacity: 1}, 200,function(){
				$(this).attr("src", path);
	   			$(this).animate({opacity: 1}, 200);
		      });
			  */
		    return false;
		});
	};

    /* Функция вызова окна colorbox */
	function checkMenuFL(elemid){	
		$.fn.colorbox({width:"966px", inline:true, href:"#menufl_" + elemid, open:true});
	}
	
	function showFlat(){
		$(".table tr").hover(function() {
//			alert("@");
			$(this).find("td").addClass("hover");
			$(this).find("div.descr_block").stop(true,true).show();
		}, function() {
			$(this).find("td").removeClass("hover");
			$(this).find("div.descr_block").stop(true,true).hide();
		});
	}

	function clickTableCell(){
//	 	$(".table tr").each(function() {
			$(".table tr").click(function(event) {
				linkLocation = $(this).find("a").attr("href");
				$.fn.colorbox({width:"980px", height:"800px", href: linkLocation, iframe:true});
	//			alert(linkLocation); width: "980px", height:"930px", iframe:true open:true "http://dalpiterstroy.welcomemedia.ru/"
				return false;
	//		});
		});
		return false;
	}

	/*функция добавления квартиры в избранное*/

	function addFavFlat(flatid)
	{
		$.ajax( {
			type : "POST",
			url : "/ajax/flat_add/" + flatid + "/",
			data : "",
			success : function(msg) {
				//document.getElementById('basket_id').innerHTML = msg;
				window.parent.document.getElementById('favorite_block').innerHTML = msg;
			}
		});
	}
	
	function crop_image(){
		$(document).mousemove(function(e) {
			  var x = e.pageX;
			  var y = e.pageY;
			  alert(x);
		 });
		alert(x);
//		var extra = 800;
//		var divWidth = 670;		
//		$('#crop_image IMG').scrollLeft(0);
		$('#crop_image').unbind('mousemove').bind('mousemove',function(e){
			alert(e.pageX);
//			var containerWidth = lastElem[0].offsetLeft + lastElem.outerWidth() + 2*extra;
	//		var left = (e.pageX - $('#crop_image').offset().left) * (containerWidth-divWidth) / divWidth - extra;
		//	$('#crop_image').scrollLeft(left);
		});
	} 
	
