﻿function getUrl(html) {
    var pos = html.indexOf("<");
    if (pos > -1) {
        html = html.substring(0, pos);
    }
    return '/_media.asp?src=' + window.location.pathname + '&trm=' + html + '&t=' + Math.random() * 1000;
        
//'/_media.asp?src=' + window.location.pathname + '&trm=' +  $(this).html() + '&t=' + Math.random() * 1000
}

$(document).ready(function() {

    $(".mpopup").each(function() {

        $(this).qtip({
            position: {
                adjust: {
                    screen: true
                }

            },

            content: {
                text: 'Loading data...', // The text to use whilst the AJAX request is loading
                ajax: {
                    url: getUrl($(this).html()), //'/_media.asp?src=' + window.location.pathname + '&trm=' +  $(this).html() + '&t=' + Math.random() * 1000 ,
                    type: 'GET', // POST or GET
                    data: {} // Data to pass along with your request
                }
            },
            style: { classes: 'ui-tooltip-plain' },

            show: { event: 'mouseenter',
                solo: true // Only show one tooltip at a time
            },
            hide: 'unfocus'
        });

    })


})
function closePopup() {
   $(".mpopup").qtip('hide')
}
function closeDetails(id) {
    if (document.getElementById(id) != null) {
        document.getElementById(id).innerHTML = '';
    }
}

