/**
Vertigo Tip by www.vertigo-project.com
Requires jQuery
*/

this.vtip = function() {    
    this.xOffset = -150; // x distance from mouse
    this.yOffset = 0; // y distance from mouse
    this.canBeRemoved = true;
    
    $(".vtip").unbind().hover(    
        function(e) {
	    $("p#vtip").fadeOut("slow").remove();

            this.t = $(this).next('div').html();
            //this.title = '';
            this.top = (e.pageY + yOffset); this.left = (e.pageX + xOffset);
            
            $('body').append( '<p id="vtip"><img id="vtipArrow" />' + this.t + '</p>' );
	    
            $('p#vtip #vtipArrow').attr("src", 'images/vtip_arrow.png');
            $('p#vtip').css("top", this.top+"px").css("left", this.left+"px").fadeIn("slow");

	    $('p#vtip').mouseover(function(){
		canBeRemoved = false;
	    });
	    $('p#vtip').mouseout(function(){
		canBeRemoved = true;
	    });

	    $('p#vtip .product_description').hide();
	    
	    $('p#vtip .product_title').click(function(){
		if ($('#' + $(this).attr('title')).is(":hidden")){
		    $('#' + $(this).attr('title')).slideDown(400);
		}else{
		    $('#' + $(this).attr('title')).hide(400);
		}
	    });
        },
        function() {
            //this.title = this.t;
	    setTimeout(function(){
		$('p#vtip').mouseover(function(){
		    canBeRemoved = false;
		});
		$('p#vtip').mouseout(function(){
		    canBeRemoved = true;
		    $("p#vtip").fadeOut("slow").remove();
		});
		if (canBeRemoved){
		    $("p#vtip").fadeOut("slow").remove();
		}
	    }, 2500);
        }
    ).mousemove(
        /*function(e) {
            this.top = (e.pageY + yOffset);
            this.left = (e.pageX + xOffset);
                         
            $("p#vtip").css("top", this.top+"px").css("left", this.left+"px");
        }*/
    );
};

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