$(document).ready(function(){ // doc ready

	tooltip();

///////////////////////////////
//
//	Slider
//
///////////////////////////////

	
  $('#slider').bxSlider({
	auto: true,
	autoHover: true,
	pause: 4000,
	autoDelay: 4000,
	ticker: true,
	speed: 2000,
	mode: 'fade',
	controls: false
  });


//////////////////////////////
//
//	Externe Links in neuem Fenster öffnen
//
///////////////////////////////
	
 $('a.extern').click(function(){
  window.open($(this).attr('href'));
  return false;
 });


///////////////////////////////
//
//	Accordion
//
///////////////////////////////

$('.accordionueberschrift').click(function() {

		$('.accordionueberschrift').removeClass('aktiv');
	 	$('.accordioninhalt').slideUp(300);

		if($(this).next().is(':hidden') == true) {
				$(this).addClass('aktiv');

				$(this).next().slideDown(300);
	 			} 
});

$('.accordionueberschrift').mouseover(function() {
			$(this).addClass('hover');
}).mouseout(function() {
		$(this).removeClass('hover');										
	});
$('.accordioninhalt').hide();


});



///////////////////////////////
//
// Tooltip
//
///////////////////////////////


this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 100;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("area.tooltip").hover(function(e){											  
		this.t = this.id;
		this.a = this.alt;		
		this.id = "";									  
		this.alt = "";	
		$("body").append("<div id='tooltip' class='"+ this.a +"'>"+ this.t +"</div>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.id = this.t;		
		this.alt = this.a;			
		$("#tooltip").remove();
    });	
	$("area.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};
