this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 8;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append('<p id="tooltip"><img src="'+ this.t +'" alt="EcoQuip" /></p>');
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(document).ready(function(){
	// hover images
	tooltip();
	
	// equipment galleries
	$(".gallery").fancybox({
		openEffect	: 'fade',
		closeEffect	: 'fade'
	});
	// rotator
	$(function() {
	    $('#feature').before('<div class="wrapper clearfix" style="padding-top:40px;"><h1 class="feature">EQ Equipment</h1><ul id="navi">').cycle({
	        fx:     'fade',
	        speed:  'slow',
	        timeout: 6000,
	        pager:  '#navi',
	        pagerEvent: 'mouseover',
	        
	        pagerAnchorBuilder: function(idx, slide, img) {
	            return '<li><a href="'+ slide.longDesc +'"><h2>' + slide.alt + ':<span>' + slide.title + '</span></h2></a></li>';
	        }
	    });
	});
	// video pop-up
	$(".various").fancybox({
		maxWidth	: 800,
		maxHeight	: 600,
		fitToView	: false,
		width		: '70%',
		height		: '70%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'fade',
		closeEffect	: 'fade'
	});
});

