// JavaScript Document
$(document).ready(function () {	
	$("body").addClass("hasJS");
	$(".scroll-pane").jScrollPane({showArrows: true});
	$(".tab_content").hide();
	$("ul.tabs li:first").addClass("active").show(); 
	$(".tab_content:first").show();
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("active"); 
		$(this).addClass("active"); 
		$(".tab_content").hide(); 
		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn();
		return false;
	});
	$("#header .nav ul").css({display: "none"}); // Opera Fix
    $("#header .nav li").hover(function(){	$(this).addClass('current_page_item').find('ul:first').animate({height:"show"}, 500); }, function() { $(this).removeClass('current_page_item').find('ul:first').stop(true, true).animate({height:"hide"}, 500);	});
	$("#tabs-nav").tabs("#panes > div",{ event:'mouseover',	effect: 'fade' });
	// add classes to indicate an external link, pdf, doc or ppt
	$('a').filter(function() { return this.hostname && this.hostname !== location.hostname; }).addClass("external").attr({ target: "_blank" });
	$("a[href$=pdf]").addClass("pdf");
	$("a[href$=doc]").addClass("doc");
	$("a[href$=ppt]").addClass("ppt");
	$("a[href$=xls]").addClass("xls");
	// fish animations
	$('#fish1-right').animate({ right: "450px", opacity: 1.0 }, 4000).animate({ opacity: 0 }, 1000).animate({ right: "265px" }, 1010).animate({ right: "340px", opacity: 1.0 }, 3000);
	$('#fish1-left').css('opacity', 0).delay(2800).fadeIn().animate({ right: "265px", opacity: 1.0 }, 3800).fadeOut();	
	$('#fish2-right').animate({	right: "450px",	opacity: 1.0 }, 6000).animate({ opacity: 0 }, 1000).animate({ right: "200px" }, 10).delay(2000).animate({ right: "284px", opacity: 1.0 }, 2000);		
	$('#fish2-left').css('opacity', 0).delay(4500).fadeIn().animate({ right: "250px", opacity: 1.0 }, 5000).fadeOut();
	$('#fish3-right').css('opacity', 0).delay(1500).fadeIn().animate({ right: "200px", opacity: 1.0 }, 4000).animate({ opacity: 0 }, 500).animate({ right: "20px" }, 10).delay(2500).animate({ right: "200px", opacity: 1.0 }, 2500).fadeOut(500);
	$('#fish3-left').animate({ right: "20px", opacity: 1.0 }, 3800).animate({ opacity: 0 }, 500).animate({ right: "250px" }, 10).animate({ right: "20px", opacity: 1.0 }, 4500).animate({ opacity: 0 }, 500).animate({ right: "200px" }, 10).animate({ right: "110px", opacity: 1.0 }, 4000);
	$(".showhide").click(function() { $(".article table").toggle(); });
	$("#indicator-tabs").tabs("#indicator-panes > div",{ effect: 'fade' });
});
