$(document).ready(

function(){
$('div#banner').innerfade({
speed: 1000,
timeout: 6500,
type: 'sequence',
containerheight: '300px'
});
});

$(document).ready(function(){
	$("#region").change(function(){
	$("#sub_region").load("/aj/regions.php", { id: $("#region option:selected").val() });
         }); });

$(document).ready(function(){
	$(".img_list a").lightbox();
	});

function note_info(action, t)
	{
    $("#note").load("/aj/note/" );
	$("#main_bg").css('display',action);
	if(action=='block') $('#main_bg').animate({opacity: "0.8"}, 300);
	else $('#main_bg').animate({opacity: "0.1"}, 300);
	var text = '<div><br /><br />Объект добавлен в блокнот.<br /><br /><br /><br /><a href="#" onclick="note_info(\'none\'); return false;">закрыть сообщение</a> | <a href="/note/">открыть блокнот</a></div>';
	$("#note_info").css('display',action).html(text);
	}

$(document).ready( 
function(){
		 $("a.add_note").click(function(){
             $("#t_note").load("/aj"+$(this).attr('href') );
			 note_info('block',this.title);
			
			return false;
		 });  });

$(document).ready(function(){
	
	price_min = (typeof(price_min)!='undefined')? price_min : 0;
	price_max = (typeof(price_max)!='undefined')? price_max : 100000;
	price_min_value = (typeof(price_min_value)!='undefined')? price_min_value : price_min;
	price_max_value = (typeof(price_max_value)!='undefined')? price_max_value : price_max;
	
	$('#price_trackbar').trackbar({
		onMove : function() {
			$('#price_min').val(this.leftValue);
			$('#price_max').val(this.rightValue);
		},
		width : 140, // px
		leftLimit : price_min, // unit of value
		leftValue : price_min_value, // unit of value
		rightLimit : price_max, // unit of value
		rightValue : price_max_value, // unit of value		
		clearLimits : true,
		clearValues : true
	});

	area_min = (typeof(area_min)!='undefined')? area_min : 0;
	area_max = (typeof(area_max)!='undefined')? area_max : 10000;
	area_min_value = (typeof(area_min_value)!='undefined')? area_min_value : area_min;
	area_max_value = (typeof(area_max_value)!='undefined')? area_max_value : area_max;
	
	$('#area_trackbar').trackbar({
		onMove : function() {
			$('#area_min').val(this.leftValue);
			$('#area_max').val(this.rightValue);
		},
		width : 140, // px
		leftLimit : area_min, // unit of value
		leftValue : area_min_value, // unit of value
		rightLimit : area_max, // unit of value
		rightValue : area_max_value, // unit of value		
		clearLimits : true,
		clearValues : true
	});
});

