/*
 * Url preview script 
 * written by Alen Grakalic (http://cssglobe.com)
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 */
(function($){
	this.screenshotPreview = function(){	
		/* CONFIG */
			
			xOffset = -125;
			yOffset = 350;
			
			// these 2 variable determine popup's distance from the cursor
			// you might want to adjust to get the right result
			
		/* END CONFIG */
		$("a.screenshot").hover(function(e){
			this.t = this.title;
			this.title = "";	
			var c = (this.t != "") ? "<br/>" + this.t : "";
			$("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");								 
			$("#screenshot")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast")
			;			
	    },
		function(){
			this.title = this.t;	
			$("#screenshot").remove();
	    });	
		$("a.screenshot").mousemove(function(e){
			$("#screenshot")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px");
		});			
	};
}(jQuery));

// DOCUMENT.READY
(function($){
	$(document).ready(function(){
		// CALL URL PREVIEW SCRIPT
		screenshotPreview();
	
		// INDEX EXPLORE ISSUE BUTTON
		$('#explore-issue-button, div.views-field-field-issue-cover').hover(
			function(){
				$('#explore-issue-button').animate ({
					left: '+=15'
					}, 200, function (){
					// the callback when animate() complete
				});
			},
			function(){
				$('#explore-issue-button').animate ({
					left: '-=15'
					}, 400, function (){
					// the callback when animate() complete
				});				
			});
		
		// UC GRID OVERLAY MOUSEOVER
		// IMPORTANT!!!! If this function is changed, line 159 must also be updated in sites/all/libraries/autopager/jquery.autopager-1.0.0.js
		$("div.grid-cell-container").hover(
			function(){
				$(this).children('.grid-image-label-overlay').fadeTo("fast", 1)
			},
			function(){
				$(this).children('.grid-image-label-overlay').fadeTo("slow", 0.5)
			});
	});
}(jQuery));;

