$(document).ready(function(){
	$('.heart, .pop2_but').hover(
		function()
		{
			need_hide = false;
			pop = $(this).attr('pop_name');
			if(pop)
			{
				if(pop != now_pop_opened)
				{
					if(now_pop_opened!="") $('#'+now_pop_opened).hide();
					now_pop_opened = pop;
				}
				if($('#'+pop))
				{
					if($(this).hasClass('heart')){
						var popup_width=255;// px
						var ofst=$(this).offset();
						var cwidth=$('.content').width()?$('.content').width():($('.ccol').width()+$('.ccol').offset().left);
						//alert((ofst.left+popup_width+110)+"  "+$('.content').width());
						if((ofst.left+popup_width+150)>cwidth) $('#'+pop).css('left',"-"+(popup_width+5)+'px');
						else $('#'+pop).css('left', popup_width+'px');
					}
					$('#'+pop).show();
				}
			}
		},
		function()
		{
			need_hide = true;
			setTimeout(function(){
				if(need_hide)
				{
					$('.pop_heart').hide();
					$('.pop2').hide();		
				}
			}, 700);
		}
	);
	$('.pop_heart, .pop2').hover(
		function()
		{
			need_hide = false;
		},
		function()
		{
			need_hide = true;
			setTimeout(function(){
				if(need_hide)
				{
					$('.pop_heart').hide();
					$('.pop2').hide();		
				}
			}, 700);
		}
	);
	
});	
