$(function () {

       $('.show_popup').each(function () {
            var distance = 10;
            var time = 150;
            var hideDelay = 100;

            var hideDelayTimer = null;

            var beingShown = false;
            var shown = false;
            
												$(this).prepend('<div class="popup"></div>');

												var trigger = $('.trigger', this);

            var info = $('.popup',this);
												
												var uid = $(this).attr("mid");

            $([trigger.get(0), info.get(0)]).mouseover(function () {

                if (hideDelayTimer) clearTimeout(hideDelayTimer);
                if (beingShown || shown) {
                    return;
                } else {
                    beingShown = true;
                    info.empty();
																												$.ajax( {
                             type: "POST",
                             dataType: 'JSON',
																													async: false,
                             url: "ajax/user_panel_popup.php",
                             data: "id="+uid,
                             success: function(answer)
                             {  
                                  data = eval('('+ answer +')');
                      												if (data.status==true)
                      												{ 
               																						info.prepend(data.body);															
                      												}
                             }
                });
                    info.css({
                        top: 0,
                        left: 15,
                        display: 'block'
                    });
                        beingShown = false;
                        shown = true;
                }

                return false;
            }).mouseout(function () {
													
																if (hideDelayTimer) clearTimeout(hideDelayTimer);
                hideDelayTimer = setTimeout(function () {
                    
                    hideDelayTimer = null;
                    shown = false;
                    info.css('display', 'none');
                 }, hideDelay);
            
                return false;
            });
        });
    });
