
// written by Alen Grakalic (http://cssglobe.com)
// http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
// http://www.webmasterpro.de/coding/article/javascript-tooltip-mi-jquery.html
// http://jendryschik.de/weblog/2010/08/17/funktionsweise-meiner-glossareinbindung/

/* ____________________________________  screen_Tooltip(); */

this.screen_Tooltip = function(){

                xOffset = 10;
                yOffset = 40;

        $("a.screen_Tip").hover(function(e){
                this.t = this.title;
                this.title = "";
                var c = (this.t != "") ? "<br/>" + this.t : "";
                $("body").append("<div class='corner shadow text-shadow' id='img_Tooltip'><div><img class='corner' src='"+ this.rev +"' alt='url preview'>"+ c +"&nbsp;&nbsp;<div></div>");
                $("#img_Tooltip")
                        .css("top", (e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("slow"); // fast slow
        },
        function(){
                this.title = this.t;
                $("#img_Tooltip").remove();

        }).mousemove(function(e){
                $("#img_Tooltip")
                        .css("top", (e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");

        }).click(function() {
                $("#img_Tooltip").remove();
                });
};

/* ____________________________________  dfn_Tooltip(); */

this.dfn_Tooltip = function(){

                xOffset = 10;
                yOffset = 40;

        $("dfn[title]").hover(function(e){
                this.t = this.title;
                this.title = "";
                $("body").append("<div class='corner shadow' id='text_Tooltip'>"+ this.t +"</div>");
                $("#text_Tooltip")
                        .css("top", (e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("slow"); // fast slow
        },
        function(){
                this.title = this.t;
                $("#text_Tooltip").remove();

        }).mousemove(function(e){
                $("#text_Tooltip")
                        .css("top", (e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};

/* ____________________________________  pop_Image(); */

this.pop_Image = function(){

        $("a.popImg").click(function(event) {
           $(this).parent().prepend('<img src="' +
           $(this).attr('href') + '" class="shadow popped_Img" />');
                   event.preventDefault();
        $('img.popped_Img').click(function() {
           $(this).remove();
           });
        });
};
