	(function($){

	  $.fn.vCenter = function(options) {

    var pos = {

      sTop : function() {

return window.pageYOffset || $.boxModel && document.documentElement.scrollTop || document.body.scrollTop; 

      },

      wHeight : function() {

if ( $.browser.opera || ($.browser.safari && parseInt ($.browser.version) > 520) ) { return window.innerHeight - (($(document).height() > window.innerHeight) ? getScrollbarWidth() : 0); 

                } else if ( $.browser.safari ) {

                        return window.innerHeight;

                }       else {

return $.boxModel && document.documentElement.clientHeight || document.body.clientHeight; 

        }

      }

    };

    return this.each(function(index) {

      if (index == 0) {

        var $this = $(this);

        var elHeight = $this.height();

        

        $this.css({

          position: 'absolute',

          marginTop: '0',

          top: pos.sTop() + (pos.wHeight() / 2) - (elHeight / 2)

        });

      }

    });

  };



})(jQuery);



(function($){

	  $.fn.hCenter = function(options) {

    var pos = {

      sTop : function() {

return window.pageYOffset || $.boxModel && document.documentElement.scrollTop || document.body.scrollTop; 

      },

      wHeight : function() {

if ( $.browser.opera || ($.browser.safari && parseInt ($.browser.version) > 520) ) { return window.innerWidth - (($(document).width() > window.innerWidth) ? getScrollbarWidth() : 0); 

                } else if ( $.browser.safari ) {

                        return window.innerWidth;

                }       else {

return $.boxModel && document.documentElement.clientWidth || document.body.clientWidth; 

        }

      }

    };

    return this.each(function(index) {

      if (index == 0) {

        var $this = $(this);

        var elWidth = $this.width();

        

        $this.css({

          position: 'absolute',

          marginLeft: '0',

          left: pos.sTop() + (pos.wWidth() / 2) - (elWidth / 2)

        });

      }

    });

  };



})(jQuery);

function checkPosition(element,mousex,mousey){
				
	var cposy = mousey + 20 + element.innerHeight();
	var cposx = mousex -10 + element.innerWidth();
	
	var rcposy = 0;
	var rcposx = 0;
	
	if( cposx >= $(document).width())
			rcposx = mousex - element.innerWidth();
  else 
  		rcposx = mousex - 10;
  
	
	if( cposy >= $(document).height())
			rcposy = mousey - element.innerHeight();
  else 
  		rcposy = mousey + 20; 			

			//element.offset({ left: rcposx, top: rcposy }); 
			$(element).css('top', function(index) { return rcposy; });
			$(element).css('left', function(index) { return rcposx; });
}

$(document).ready(function() {

  jQuery.fn.center = function () {

	  this.css("position","absolute");

	  this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");

	  this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");

	  return this;

  }

  jQuery.fn.addBackground = function () {

	  this.css("position","absolute");

	  this.css("width", ( $(window).width() - 668 ) / 2 + "px");

	  return this;

  }

	$("#hintergrund").addBackground();

});



jQuery(function(){

var title = '';

$("span#keyword").each(function(index) { 

  $(this).hover(

  function () 

	  {

	  	title = $(this).attr("title");

			if(title.length == 0) exit;

			$(this).attr('title', function() {

	  			return '';

			});

			//$(this).fadeOut(100);

			//$(this).fadeIn(500);

			
			/*$(document).bind('mousemove',function(e){ 
				$('div#fbox').css('top', function(index) { return e.pageY+20; });
				$('div#fbox').css('left', function(index) { return e.pageX-20; });
 		 });*/
		
			var tmp = title;

			if( title.indexOf("#", 0) >= 0 ) {

				var imgUrl = tmp.substring(tmp.indexOf("#", 0)+1,tmp.indexOf("%", tmp.indexOf("#", 0)));

				var img = new Image();
				img.src = imgUrl;
				
				var pwidth = img.width;
				var pheight =img.height;
				
				//alert("w=" + pwidth + "  h=" + pheight);
				
				$("span#content").before('<img class="tmpimg" src="' + imgUrl + '" />');
				//$('table.fbox-table').css('width', function(index) { return 390; });
				//$('table.fbox-table').css('height', function(index) { return 390; });
				
				$('table.fbox-table').css('width', function(index) { return pwidth + 40; });
				$('table.fbox-table').css('height', function(index) { return pheight; });
				tmp = tmp.substring(tmp.indexOf("%",0)+1,tmp.length);	

			}
			else {
				$('table.fbox-table').css('width', function(index) { return 550; });
			}

			$("span#content").text(tmp);
			
			$(document).bind('mousemove',function(e){ 
				checkPosition($('div#fbox'), e.pageX, e.pageY);
			});

			$('div#fbox').css('visibility', function(index) { return "visible"; });

	  }, 

  function () 

  	  {

			$('div#fbox').css('visibility', function(index) { return "hidden"; });

			$('.tmpimg').remove();

			$(this).attr('title', function() {

	  			return title;

			});

      }

)})});



jQuery(function(){

var title = '';

$("span.keyword").each(function(index) { 

  $(this).hover(

  function () 

	  {

	  	title = $(this).attr("title");

			if(title.length == 0) exit;

			$(this).attr('title', function() {

	  			return '';

			});

	    var browserWidth = $(window).width();
	    var browserHeight = $(window).height();

			/*$(document).bind('mousemove',function(e){ 
				$('div#fbox').css('top', function(index) { return e.pageY+20; });
				$('div#fbox').css('left', function(index) { return e.pageX-20; });
  		});*/

			var tmp = title;

			var pwidth = 0;
			var pheight = 0;

			if( title.indexOf("#", 0) >= 0 ) {

				var imgUrl = tmp.substring(tmp.indexOf("#", 0)+1,tmp.indexOf("%", tmp.indexOf("#", 0)));

				var img = new Image();
				img.src = imgUrl;
				
				pwidth = img.width;
				pheight =img.height;
				
				//alert("w=" + pwidth + "  h=" + pheight);
				
				$("span#content").before('<img class="tmpimg" src="' + imgUrl + '" />');
				//$('table.fbox-table').css('width', function(index) { return 390; });
				//$('table.fbox-table').css('height', function(index) { return 390; });
				
				$('table.fbox-table').css('width', function(index) { return pwidth + 40; });
				$('table.fbox-table').css('height', function(index) { return pheight; });
				tmp = tmp.substring(tmp.indexOf("%",0)+1,tmp.length);	

			}		
			else {
				$('table.fbox-table').css('width', function(index) { return 550; });
			}
			
			$("span#content").text(tmp);
			
			$(document).bind('mousemove',function(e){ 
						checkPosition($('div#fbox'), e.pageX, e.pageY);
			});

			$('div#fbox').css('visibility', function(index) { return "visible"; });

	  }, 

  function () 

  	  {

			$('div#fbox').css('visibility', function(index) { return "hidden"; });

			$('.tmpimg').remove();

			$(this).attr('title', function() {

	  			return title;

			});

      }

)})});

$(function() {

$(window).resize(function(){

	$('#hintergrund').addBackground();

});

});
