/* Tooltips */

$(document).ready(function() {
	
	 $('a').tooltip({ 
	     track: true, 
	     delay: 2000, 
	     showURL: false, 
	     showBody: " - ", 
	     fade: 500 
	 });
	 
	 $('#container img').tooltip({ 
	     track: true, 
	     delay: 2000, 
	     showURL: false, 
	     showBody: " - ", 
	     fade: 500 
	 });
	 

	 
	/* Faded Loop */
	
		$(".fade").faded({
			speed: 3000,
			crossfade: true,
			bigtarget: true,
			sequentialloading: true,
			loadingimg: "/images/loader.gif",
			autoplay: 8000,
			autorestart: false,
			random: false,
			autopagination:false
		});
	
		
	/* External Links */
		function externalLinks() {   
		 if (!document.getElementsByTagName) return;   
		 var anchors = document.getElementsByTagName("a");   
		 for (var i=0; i<anchors.length; i++) {   
		   var anchor = anchors[i];   
		   if (anchor.getAttribute("href") &&   
		       anchor.getAttribute("rel") == "external")   
		     anchor.target = "_blank";   
		 }   
		}   
		window.onload = externalLinks;
	
	/* Sliding Panel */
	$(".btn-slide").click(function () {
	  $("#panel").slideToggle("slow");
	  $(this).text($(this).text() == 'hide ↑' ? 'show ↓' : 'hide ↑');
	  return false;
	});
	
	/* Tabs */
	$(".tab-content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab-content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab-content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
	
});

