/**
Vertigo Tip by www.vertigo-project.com
Modified By 
    * Jony Wijaya (jony@netagi.com)
    * Suryadi Lawira (suryadi@netagi.com)
Requires jQuery
*/

this.vtip = function() {    
    this.xOffset = -10; // x distance from mouse
    this.yOffset = 10; // y distance from mouse
    this.custom  = 0;

    $(".vtip").unbind().hover(
        function(e) {
            $("#vtip").remove();

            if ($(this).next(".vtipCustom").length == 1)
            {
               this.t = $(this).next(".vtipCustom").html();
               this.custom = 1;
            }
            else
            {
               if (this.title != '')
               {
                  this.t = this.title.replace(/\n/g, "<br/>");
                  this.title = ''; 
               }
            }

            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            $('body').append( '<div id="vtip"><img id="vtipArrow" />' + this.t + '</div>' );
            $('#vtip #vtipArrow').attr("src", '/sdlc/images/vtip/vtip_arrow.png');
            $('#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");
        },
        function() {
            if (this.custom == 0) {this.title = this.t.replace(/<br\/>/g, "\n");}
            $("#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function(e) {
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            $("#vtip").css("top", this.top+"px").css("left", this.left+"px");
        }
    );
};

jQuery(document).ready(function($){vtip();})
