$(document).ready(function() {
	imagePreview();
	// setup tooltip for a single DIV element
	$("#tooltiptable .uppic").tooltip({
		// each trashcan image works as a trigger
		// tip: '#tooltip',
		// custom positioning
		position: 'center right',
		// move tooltip a little bit to the right
		offset: [-30, 5],
		// there is no delay when the mouse is moved away from the trigger
		delay: 0,
		opacity: 0.8
	});
	$('#reflect img').reflect({height: 0.8, opacity: 0.5});
	$('ul.thumb li').Zoomer({speedView: 700, speedRemove: 300, altAnim: true, speedTitle: 700});
	$('#carousel1').CloudCarousel({
		xPos: 390,
		yPos: 30,
		buttonLeft: $('#left-but'),
		buttonRight: $('#right-but'),
		altBox: $('#carousel-alt'),
		titleBox: $('#carousel-title')
	});
});

this.imagePreview = function(){    
	xOffset = 10;
	yOffset = 30;
		
	// these 2 variable determine popup's distance from the cursor
	// you might want to adjust to get the right result
		
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";    
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.rev +"' alt='Image preview' />"+ c +"</p>");                                 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");                        
	},
	function(){
		this.title = this.t;    
		$("#preview").remove();
	});    
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});            
};

