
$(document).ready(function(){

$('.block_title').click(function(){
	if($('#'+this.id+'_block').css('display')=='none'){
		$('#'+this.id+'_block').show(300);
	}else{
		$('#'+this.id+'_block').hide(300);
	}
});





});

function setObjV(f,t,id){	if(f!='NOT'){
trackbar.getObject(id).updateLeftValue(f);
}
	if(t!='NOT'){
trackbar.getObject(id).updateRightValue(t);
}
}


function priceReset(f,t,pref){

	if(f==0  ){
 		$("#price_from").val(0);
 	}

           if(f==0){
	$("#price_from2").val('');
	}else{		$("#price_from2").val(f);	}

	$('#price_to2').val(t);

}

  function setWord(f, t, a,u,n) {
    if(n!=0){
		$("#price_from").val(f);
		$('#price_to').val(t);
	}

    if(a=='auto' && t==0 || t==trackbar.getObject('by_ob').Lim){
    	t='';
    }
        if(f==0){
    	f='';
    }
    priceReset(f,t,_tic_);
}


function frk(event,id,val){   var chCode = ('charCode' in event) ? event.charCode : event.keyCode;
            if(event.keyCode==13)
            {

             	if(id=='price_from2' && $('#price_from2').val()!=$('#price_from').val()){                       from(val);
             	}else if(id=='price_to2' && $('#price_to2').val()!=$('#price_to').val()){                       to(val);             	}else if(id=='area_max' && $('#area_max').val()!=$('#armax').val()){                         ato(val);             	}else if(id=='area_min' && $('#area_min').val()!=$('#armin').val()){                          afrom(val);             	}
            }}


  function setWord2(f, t, a) {
	$("#price_from").val(f);
	$('#price_to').val(t);
    if((a=='auto' && t==0) || t==trackbar.getObject('by_1m').Lim){
    	t='';
    }

  priceReset(f,t,'');

}



function from(n){
if($('#price_from2').val()!=$('#price_from').val()){

    $("#price_from").val(n); t=n;
      if(t==0){
    	t='';
    }
    $("#price_from2").val(t);
	trackbar.getObject(_pricef).updateLeftValue(n);
	setD();
	     	stop();  }
}
function to(n){
if($('#price_to2').val()!=$('#price_to').val()){
           $("#price_to").val(n);  t=n;
            if(t==trackbar.getObject(_pricef).Lim){
    	t='';
    }
    $("#price_to2").val(t);
     	trackbar.getObject(_pricef).updateRightValue(n);
     		setD();
     	stop();   }
}

