/*
 * Image 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.imagePreview = function(){	
	/* CONFIG */
		
//		xOffset = 10;
		yOffset = ((document.body.offsetWidth/2) - 240);

		
	/* END CONFIG */
	$("table.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? " " + this.t : "";
		if(document.body.id == 'eingetroffen') { // Admin
				$("body").append("<p id='preview'><img src='../../img/neu-eingetroffen/"+ this.id +".jpg' alt='Image preview' /><span>"+ c +"</span></p>");								 
		} else {
				$("body").append("<p id='preview'><img src='img/neu-eingetroffen/"+ this.id +".jpg' alt='Image preview' /><span>"+ c +"</span></p>");								 
		}
		$("#preview")
			//.css("top",(e.pageY - xOffset) + "px")
			.css("top", "200px")
			.css("left", yOffset + "px")
			.css("height", "362px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
 });	
	
		/* END CONFIG */
	$("table.previewNews").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var b = this.getAttribute('datum');
		var c = (this.t != "") ? " " + this.t : "";
		var d = this.getAttribute('fliesstext');
		$("body").append("<p id='preview' style='background:#fff; border:5px solid #000; overflow:auto;'><span style='color:#000;'>" + b + "<br /><b>"+ c + "</b><br /><br />" + d + "</span></p>");								 
		$("#preview")
			//.css("top",(e.pageY - xOffset) + "px")
			.css("top", "200px")
			.css("left", yOffset + "px")
			.css("height", "354px")
			.css("width", "492px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
 });	

	
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});
