// SlideToggle Left NAV
function toggleNavItem(item,btn) {
    	$(item).slideToggle('slow');
		//	$(item).toggleClass("active").next().slideToggle("slow");
			return false;
					
					if($(item).is(':visible')){
			        $(btn).removeClass('navToggleOpen');
			        $(btn).next(0).removeClassName('open');
			    }else{
			        $(btn).addClass('navToggleOpen');
			        $(btn).next(0).addClassName('open');
			    }
}
function hideNav(item,btn){
    $(btn).removeClass('navToggleOpen');
    $(btn).next(0).removeClass('open');
    $(item).hide();
}


/* Toggle effect - eg about art-tv.ch*/
$(document).ready(function(){
	
	$(".toggle_container").hide();

	$("h2.trigger").click(function(){
		$(this).toggleClass("active").next().slideToggle("slow");
		return false;
	});

}); 

// Img hover effekt
$(document).ready(function(){
		
	$("a img.trans").each(function() {
		$(this).parent("a").hover(function(){
			$("img.trans", this).stop().fadeTo(600, 0.6);
		},function(){
			$("img.trans", this).stop().fadeTo(900, 1);
		});
	})
	
	$("a p.trans").each(function() {
		$(this).parent("a").hover(function(){
			$("p.trans", this).stop().fadeTo(600, 0.6);
		},function(){
			$("p.trans", this).stop().fadeTo(600, 1);
		});
	})
	
	$("a img.imgfade").each(function() {
		$(this).parent("a").hover(function(){
			$("img.imgfade", this).stop().fadeTo(200, 0.4);
		},function(){
			$("img.imgfade", this).stop().fadeTo(500, 1);
		});
	})
		
});

/*
 * 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 = 10;
		yOffset = 20;		
		// 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("fast");		
    },
	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");
	});			
};

// starting the script on page load
$(document).ready(function(){
	tooltip();
});

// externe links new window
$(document).ready(function(){
	$('a[href^="http://"]')
	  .attr("target", "_blank");
});
