// JavaScript Document

	function mail(a,b) {
		parent.location = 'mailto:'+a+'@'+b;
		return false;
	}
	
	
/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * idea by Alen Grakalic (http://cssglobe.com)
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */	

(function($){
   $.fn.tooltip = function(){	
	  /* CONFIG */	
	  var defaults = {
		  xOffset: 10,
		  yOffset: 10
	  };
	  var options = $.extend(defaults, options);
	  var currentTitle;
	  
		  // these 2 variable determine popup's distance from the cursor
		  // you might want to adjust to get the right result		
	  /* END CONFIG */		
	  return $(this).hover(function(e){											  
		  currentTitle = $(this).attr('title');
		  // this.title = '';	
		  $(this).removeAttr('title');
		  $('body').append('<p id="tooltip">'+ currentTitle +'</p>');
		  $('#tooltip').css({
			  	'opacity':0.8 //,
			  	// 'top':(e.pageY - options.xOffset) + 'px',
			  	// 'left':(e.pageX + options.yOffset) + 'px'
			  })
			  .fadeIn(400);		
	  },
	  function(){
		  $(this).attr('title',currentTitle);		
		  $('#tooltip').remove();
	  }).mousemove(function(ePos){
				var border_top = $(window).scrollTop();
				var border_right = $(window).width();
				var left_pos;
				var top_pos;
				if(border_right - (options.xOffset *2) >= $('#tooltip').width() + ePos.pageX){
					left_pos = ePos.pageX+options.xOffset;
					} else{
					left_pos = border_right-$('#tooltip').width()-options.xOffset;
					}

				if(border_top + (options.yOffset *2)>= ePos.pageY - $('#tooltip').height()){
					top_pos = border_top +options.yOffset;
					} else{
					top_pos = ePos.pageY-$('#tooltip').height()-options.yOffset;
					}	

				$('#tooltip').css({
						left:left_pos+'px', 
						top:top_pos+'px'
				});
		});			
  };
})(jQuery);
	
	
	

 $(document).ready(function(){
	// starting the tooltip on page load						
	// $('area[title]').tooltip();
	
	/*
	setTimeout(function(){
		//$('area[title]').each(function(){alert($(this).attr('title'));});
		$('area[title]').tooltip();
	 }, 5000);
	*/	
							
	// email adress antispam
	$("p:contains('@'),li:contains('@')").each(function(){
		//alert($(this).html());
		var filter = /([a-zA-Z0-9_\.\-]+)(<span> @ <\/span>)([a-zA-Z0-9_\.\-]+)/ig;
		//var link = "<a href=\"mailto:$1@$3\" class=\"email\">$1@$3</a>";

		var link = "<a onclick=\"mail('$1','$3')\" class=\"email\">$1<span> @ <\/span>$3</a>";
		$(this).html($(this).html().replace(filter, link));	
	});	
	
	$(function(){
		$("a.popupwindow").popupwindow();
	});
	
							
	var showLink = "&nbsp;<a class=\"showhidelink\" title=\"Text vollständig anzeigen\">[mehr...]<\/a>";
	
	$(".text2").hide(); 
	$(".text1").append(showLink);
	
	$(".text1 a").click(function(){	
		$(this).parents("p").next("div").slideToggle("fast");
		
		if($(this).contains("mehr").text() != "")
		{	
			$(this).attr({title:"Text ausblenden"});
			$(this).text("[ausblenden...]");	
		}
		else
		{	
			$(this).attr({title:"Text vollständig anzeigen"});
			$(this).text("[mehr...]");
		}
	});  
	
	var showLink2 = "<a class=\"showhidelink\" title=\"Text anzeigen\">» ";
	$(".showtextlink").each(function(){ 
			$(this).html(showLink2 + $(this).html() + "<span> anzeigen</span></a>");
	});
	
	$(".showtextlink a").click(function(){	
		$(this).parents("p").next("div").toggle();
		
		if($(this).contains("anzeigen").text() != "")
		{	
			$(this).attr({title:"Text ausblenden"});
			$(".showtextlink span").text(" ausblenden");	
		}
		else
		{	
			$(this).attr({title:"Text anzeigen"});
			$(".showtextlink span").text(" anzeigen");	
		}
	});  
	
 });
 

/* PopUpWindow */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('8.P.x=f(p){c l=p||{};r 5.z(f(s){c A,k,4,b,a;4=(8(5).B("C")||"").j(",");3={h:D,d:N,e:1,o:1,g:0,n:1,6:0,7:0};m(4.9==1&&4[0].j(":").9==1){a=4[0];m(t l[a]!="u"){3=8.E(3,l[a])}}H{I(c i=0;i<4.9;i++){b=4[i].j(":");m(t 3[b[0]]!="u"&&b.9==2){3[b[0]]=b[1]}}}k="h="+3.h+",d="+3.d+",e="+3.e+",o="+3.o+",g="+3.g+",n="+3.n+",6="+3.6+",F="+3.6+",7="+3.7+",J="+3.7;8(5).M("v",f(){c q="y"+s;G.K(5.w,q,k).O();r L})})};',52,52,'|||settings|mysettings|this|left|top|jQuery|length|||var|width|toolbar|function|status|height||split|parameters|profiles|if|resizable|scrollbars||name|return|index|typeof|undefined|click|href|popupwindow|PopUpWindow|each|setting|attr|rel|650|extend|screenX|window|else|for|screenY|open|false|bind|500|focus|fn'.split('|'),0,{}))



