// JavaScript Document

jQuery(document).ready( init );

function init()
{
//	console.log('asdfasdfa');
	$('.amaztext_head').mouseover( amaztext_show );
	$('.amaztext_head').mouseout( amaztext_hide );
	$('.amaztext_head').next().hide();
	
	screenshotPreview();
}


function amaztext_show()
{
	$(this).next().show();
	return false;
}


function amaztext_hide()
{
	$(this).next().hide('fast');
	return false;
}



this.screenshotPreview = function(){	
	xOffset = 30;
	yOffset = 30;
		
	
	$("a.amaztext_link").hover( 
		/* over */
		function(e){
			this.t = this.title;
			this.title = "";	
			var icon = '<img src="/image/icons/amazon.png" class="popicon" /><br />';//(this.t != "") ? "<br/>" + this.t : "";
			$("body").append("<p class='amaztextpreview'>"+ icon +"<img src='"+ this.rel +"' alt='"+this.title+"' width='100px' class='amaztextimage' /></p>");								 
			$(".amaztextpreview")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast");						
		},
		
		/* out */		
		function(){
			this.title = this.t;	
			$(".amaztextpreview").remove();
		}
	);	
	
	
	
	$("a.amaztext_link").mousemove(function(e){
		$(".amaztextpreview")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};


