jQuery(document).ready(function() {
	//Default Action
	//jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content
	//On Click Event
	jQuery("ul.tabs li").click(function() {
		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		if(jQuery("ul.tabs li:last").hasClass("active")){
			jQuery("ul.tabs li:last").removeClass("lastlist");
		}else{
			jQuery("ul.tabs li:last").addClass("lastlist");	
		}
		var activeTab = jQuery(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		jQuery('div.tab_content').hide();
		jQuery(activeTab).fadeIn(); //Fade in the active content
		return false;
	});
	//Scroll to feature..
	jQuery('ul#nav a').click(function(){
		_href = jQuery(this).attr('href');
		if(_href.indexOf('#') == "-1") { return true;}
		currentpage = _href.replace(/#(.+)/,'');
		hashtag = _href.replace(/(.+?)#/,'');
		if(document.location.pathname.indexOf(currentpage) != '-1') {
			jQuery('ul.tabs li a[href*=#'+hashtag+']').trigger('click');
			$.scrollTo('ul.tabs', 800);
			return false;
		}
	});
	
	if(document.location.hash !=''){
		hashtag = document.location.hash;
		jQuery('ul.tabs li a[href*='+hashtag+']').trigger('click');
		$.scrollTo('ul.tabs', 800);
	}
});

