function M(M,T) {var R="M"+rand(100000,999999);$("body").append("<div id=\""+R+"\" class=\""+T+"\">"+M+"</div>");$("#"+R).slideDown("normal");$("body").click(function() {$("#"+R).slideUp("fast",function() {$("#"+R).remove();});});}
function rand(M,N) {var C=arguments.length;if(C===0){M=0;N=2147483647;}else if(C===1){throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');}return Math.floor(Math.random()*(N-M+1))+M;}
function openPopup(U,T,W,H) {P=window.open(U,T,"width="+W+",height="+H+",toolbar=no,status=yes,scrollbars=yes,resizable=yes");P.focus();}
function ap_stopAll(P) { try{ jQuery.each($("object"),function(i,o){o.SetVariable("closePlayer",o.id.substr(2)==P? 0:1);}); } catch(errorObject) {} }
function hJSON(data) {
        var type = "error";
        if ( data.Status=="OK" ) {
                type = "ok";
                if ( data.Action == "deleteaudio" ) $("#f"+data.UserID).fadeOut("slow");
                else if ( data.Action == "saveaudiodata" ) {
                        var msg=$("#n"+data.UserID).val();
                        if ( msg!="" ) msg="&#132; "+msg+" &#147;";
                        $("#nt"+data.UserID).html(msg);
                }
        }
        M(data.Message,type);
}
this.tooltip = function(){
        /* CONFIG */
                xOffset = 10;
                yOffset = 20;
                // these 2 variable determine popup's distance from the cursor
                // you might want to adjust to get the right result
        /* END CONFIG */
        $(".tooltip").hover(function(e){
                this.t = this.title;
                this.title = "";
                $("body").append("<p id='tooltip'>"+ this.t +"</p>");
                $("#tooltip")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("fast");
    },
        function(){
                this.title = this.t;
                $("#tooltip").remove();
    });
        $(".tooltip").mousemove(function(e){
                $("#tooltip")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};
