/*
 * Tooltip 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.tooltip = function(){	
	/* CONFIG */		
		xOffset = 20;
		yOffset = -330;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("normal");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};




$(document).ready(function(){	
							
				$(".cat_head").click(function(){
				  
				  $(this).next().slideToggle("fast");
				  var bgi = ($(this).css("background-image"));
				  if(bgi.search(/hover.+/) == -1)
				  	$(this).css ({background:"url(http://www.lieblingszeitschrift.de/bilder/sidebar_box-navi_li-hover.gif) no-repeat"});
				  else
				  	$(this).css ({background:"url(http://www.lieblingszeitschrift.de/bilder/sidebar_box-navi_li.gif) no-repeat"});
				});	
				
				//Einklappen wenn Javascript aktiviert ist
				$('.hideable').css({display:"none"});
				$('.cat_head').css ({background:"url(http://www.lieblingszeitschrift.de/bilder/sidebar_box-navi_li.gif) no-repeat"});
				
				//Tabs
				$(function() { 			    
			    $("ul.tabss").tabs("div.pane"); 
				});
				
				/*$(function() { 
    				$("ul.tabss").tabs("div.pane").history; 
				}); */	
				
								
				//Kategorie aufklappen, wenn Eintrag markiert ist
				$(".hideable > a").each(function(){					
					var actbgi = $(this).css("background-image");
					if(actbgi.search(/hover.+/) > -1) {
						$(this).parent().css({'display':'block'});
						$(this).parent().prev(".cat_head").css({
							'background': 'url(http://www.lieblingszeitschrift.de/bilder/sidebar_box-navi_li-hover.gif) no-repeat'
						});						
					}
				});
				
				$(".cat_head").each(function() {
					if ($(this).attr("id") == 'open') {
						$(this).next().css({
							'display': 'block'});
						$(this).css({
							'background': 'url(http://www.lieblingszeitschrift.de/bilder/sidebar_box-navi_li-hover.gif) no-repeat'
						});
					}							
				});
				
				tooltip();

				
});


 
