$(document).ready(function() {

	var hostname= window.location.hostname;


	//Default Action
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content
	
	// Change tabs
	$("ul.tabs li img.tab-reach").click(function() {
           $(this).attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_reach.png");
           $("ul.tabs li img.tab-results").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_results_close.png")
           $("ul.tabs li img.tab-resources").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_resources_close.png")
     });
	$("ul.tabs li img.tab-results").click(function() {
        $(this).attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_results.png");
        $("ul.tabs li img.tab-reach").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_reach_close.png")
        $("ul.tabs li img.tab-resources").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_resources_close.png")
     });
	 $("ul.tabs li img.tab-resources").click(function() {
        $(this).attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_resources.png");
        $("ul.tabs li img.tab-reach").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_reach_close.png")
        $("ul.tabs li img.tab-results").attr("src", "http://"+hostname+"/wp-content/themes/pmn/images/index_tabs/tab_results_close.png")
     });
	 
	//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 rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	
	$("#calendar").click(
			function()
			{
			    window.location = $(this).attr("url");
			    return false;
			});

    
});

