/*
 * Url preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
this.screenshotPreview = function(){	
	/* CONFIG */
		
		xOffset = 10;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */

/*
	$(".anlage").mouseenter(function() {

		
		var text = $("#" + String(this.anlageTooltipID)).html();
		
		if (text == "") return;
		
		$("#anlage1111").html(text);
		
		var width = $("#anlage1111").width();
										
		$("#anlage1111")
			.css("left",(180) + "px");

		$("#anlage1111").css("visibility", "visible");
		$("#anlage1111 P").css("line-height", "12px");
		
	});
	
	$(".anlage").mouseleave(function() {
		$("#anlage1111").css("visibility", "hidden");
	});
	
	$(".anlage").mousemove(function(e){

		//alert($("#" + String(this.newsID)).top());
		

		var top = $(this).attr("offsetTop") + $(".slideshow").attr("offsetTop");

		var width = $("#anlage1111").width();
										
		$("#anlage1111")
			.css("top",(top) + "px")
			//.css("left",(830 - width) + "px");
			//.css("left",(e.pageX + yOffset - 200) + "px");
	});	
*/
	

	$(".news").mouseenter(function() {

		$element = $("#" + String(this.id));
		value = $element.data('value');

		var text = $("#newscontent_" + String(value)).html();
		
		//alert(text);
		$("#news1111").html(text);
		
		var width = $("#news1111").width();
										
		$("#news1111")
			.css("left",(830 - width) + "px");

		$("#news1111").css("visibility", "visible");
		//$("#news1111 P").css("line-height", "14px");
		
	});
	
	$(".news").mouseleave(function() {
		$("#news1111").css("visibility", "hidden");
	});

	$(".news").hover(function(e){

/*
		$("#news1111")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
*/
		return;

		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 - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
				
		//$("#news1111").css("visibility", "hidden");

		//this.title = this.t;	
		//$("#screenshot").remove();
    });	
	$(".news").mousemove(function(e){
										 
										 //var position = $("#screenshot").offset();
										var width = $("#news1111").width();
										var height = $("#news1111").height();
										
										 //alert(width);
										 
										 
		$top = e.pageY - xOffset - height/2;
		
		if (($top + height + 30) > $(window).height()) $top = $(window).height() - height - 30;
										 
		$("#news1111").css("top",($top) + "px")
			//.css("left",(830 - width) + "px");
			//.css("left",(e.pageX + yOffset - 200) + "px");
			
		//$('#label').attr('innerHTML', $(window).height());

	});			
};


