var like_block_open = false;
var like_block_mouse_in = false;
var like_button_mouse_in = false;
var like_content_id_tmp = 0;
function like_click(_block,_content_id,_type)
{

		jQuery.post(
		"/people/ajax/ajaxLikeButton.php",
		{
			action: 'like',
			type: _type,
			content_id: _content_id 
		}, 
	    
	   	function(response){ 
		 
			//if(_type==1)
				//	{
					if(response=='noauth')
					{
						document.location = '/people/'
					}
					 else {
					jQuery('#like_count_status'+_content_id).html(response);
					jQuery('.like_count_status'+_content_id).html(response);
				 
					like_block_open=false;				
					like_Over(_block,_content_id,_type,1);
					 }
			
		});





}

function hide_like_container()
{
like_block_open=false;
jQuery('#user_list_like_container').fadeOut(500, function(){ skipSwitch = false; });

}

offset_top = 23;
offset_left = 85;
function show_like_container(_obj)
{
like_block_open=true;
	_obj = jQuery(_obj);
	var _offset = _obj.offset();
	var _top = parseInt(_offset.top)+offset_top;
	var _left = parseInt(_offset.left-offset_left);
	var _width = _obj[0].offsetWidth;
	var _height = _obj[0].offsetHeight;
	
	//_top = 260
	 
	
	
	jQuery('#user_list_like_container').css('position','absolute').css('top',_top+'px').css('left',_left+'px');
	//j('#user_list_like_container').show();
	jQuery('#user_list_like_container').fadeIn(500, function() { jQuery(this).css({'display' : 'block'}) });

}

function like_Over(_block,_content_id,_type,_page)
{

like_button_mouse_in = true;
if(!like_block_open || like_content_id_tmp!=_content_id)
	{
	jQuery('#user_list_like_container').hide();
	
	jQuery.post(
		"/people/ajax/ajaxLikeButton.php",
		{
			action: 'list_like_users',
				type: _type,
				content_id: _content_id,
				p: _page 
		}, 
	    
	   	function(response){ 
			ilike_content_id_tmp = _content_id;
				if(response=='no_users')
					{
					
					hide_like_container();
					}
					else
					{
					
					jQuery('#users_list_like').html(response);
					show_like_container(_block);
					}			
			
		});
	
		
	}


}


function like_list_pages(_content_id,_type,_page)
{

jQuery.post(
		"/people/ajax/ajaxLikeButton.php",
		{
			action: 'list_like_users',
				type: _type,
				content_id: _content_id,
				p: _page  
		}, 
	    
	   	function(response){ 
			
				if(response=='no_users')
					{
						jQuery('#users_list_like').html(0);
					}
					else
					{
					
					jQuery('#users_list_like').html(response);
					}		
			
		});
		

}


function like_Out()
{

interval = setInterval(function()
			{ 	
			clearInterval(interval);
			if(!like_block_mouse_in && !like_button_mouse_in)
				{
				hide_like_container();
				}
			},
			500);

}
