$(document).ready(function(){

	$(".add_to_favorite").click(function(){
		$this=$(this);
	//	$this.parent().find('.status_preloader').show();			
		$this.parent().find('.add_to_favorite').hide();			
		$('#add_to_favorite_'+this.rel).hide();
		$('#add_to_favorite_star_'+this.rel).hide();
	
		
		id=this.rel;
		$.get("/favorits.rpx?do=add&id="+this.rel+"&t="+Math.random(100),{},function(data){
			//$this.parent().find('.status_preloader').hide();
			$this.parent().find('.delete_from_favorite').show();	
			$('#delete_from_favorit_'+id).show();
			$('#delete_from_favorit_star_'+id).show();			
		
			
		//	$this.parent().parent().find('.favorite_flag').show();
		});
		return false;
	});
	

	$(".delete_from_favorite").click(function(){
		$this=$(this);
	//	$this.parent().find('.status_preloader').show();			
		$this.parent().find('.delete_from_favorite').hide();
		$('#delete_from_favorit_'+this.rel).hide();
		$('#delete_from_favorit_star_'+this.rel).hide();		

		id=this.rel;
		$.get("/favorits.rpx?do=del&id="+this.rel+"&t="+Math.random(100),{},function(data){
			
		//	$this.parent().find('.status_preloader').hide();
			$('#favorite_'+id).hide();
			$this.parent().find('.add_to_favorite').show();	
			$('#add_to_favorite_'+id).show();
			$('#add_to_favorite_star_'+id).show();			
					
			//$this.parent().parent().find('.favorite_flag').hide();
		});
		return false;
	});
});