var popup_cur='';
var popup_timer=0;
var popup_delay=500;


jQuery(function(){
		jQuery("DIV.popup").bind("mouseleave",function(){
			PopupStartTimeout(popup_cur);
		});
		jQuery("div.popup").bind("mouseenter",function(){
			PopupKillTimeout(popup_cur);
		});	
});

function PopupStartTimeout(id)
{
	popup_timer=setTimeout(function(){PopupShow(popup_cur,false)},popup_delay);
}

function PopupKillTimeout(id)
{
	if(id==popup_cur)  
		clearTimeout(popup_timer);
}

function PopupShow(id,vis)
{
	if(vis)
	{
	  	if(popup_cur==id)
	  	{
	  		PopupKillTimeout(id);	
	  		return;
	  	}
	  	//close existing before open new
	  	if(popup_cur)
	  		PopupShow(popup_cur,false);

	  	//open new	
		popup_cur=id;
		jQuery('#'+id).fadeIn(800,function(){});		
	}
	else
	{
	  	if(popup_cur!=id)
	  		return;

	  	//close existng
		jQuery('#'+popup_cur).fadeOut(400,function(){});

		//no existing
		popup_cur='';
	}
}
