/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/

this.vtip = function () {
    this.xOffset = -10; // x distance from mouse
    this.yOffset = 10; // y distance from mouse       

    jQuery(".vtip").unbind().hover(
        function (e) {
            this.t = this.title;
            this.title = '';
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);

            jQuery('body').append('<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>');

            jQuery('p#vtip #vtipArrow').attr("src", '/images/vtip_arrow.png');
            jQuery('p#vtip').css("top", this.top + "px").css("left", this.left + "px").fadeIn("slow");

        },
        function () {
            this.title = this.t;
            jQuery("p#vtip").fadeOut("slow").remove();
        }
    ).mousemove(
        function (e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);

            jQuery("p#vtip").css("top", this.top + "px").css("left", this.left + "px");
        }
    ).bind('showIt', function (e, data) {    //call ex.  $("#myelement").trigger('showIt',{ delay: 2000 });
        var delay = 1000; //1 sec
        if (data.delay) delay = data.delay;

        this.t = this.title;
        this.title = '';
        var position = jQuery(this).offset();
        var width = jQuery(this).outerWidth(true);
        this.top = position.top + yOffset;
        this.left = position.left + width + xOffset;
        jQuery('body').append('<p id="vtip"><img id="ztipArrow" src="/images/vtip_arrow.png"/>' + this.t + '</p>');
        jQuery('p#vtip').css("top", this.top + "px").css("left", this.left + "px").fadeIn("slow");

        this.title = this.t;
        jQuery("p#vtip").delay(delay).fadeOut(1000).queue(function () {
            this.title = this.t;
            jQuery("p#vtip").remove();
        });
    });

};

jQuery(document).ready(function($){vtip();}) 
