$(document).ready(function(){
	//console.log("tab n ->" + $('#mtabs ul li a').attr('href'));
	
			$('#tab-1').hide(); 
			$('#tab-2').hide(); 
			$('#tab-3').hide(); 
			$('#tab-4').hide(); 
			$('#tab-5').attr("style","visibility:hidden;min-height:0px;height:0px;overflow:hidden;padding:0px;");
			$('#mtabs div:first').show(); 
			$('#mtabs ul li:first').addClass('active'); 

	$('#mtabs ul li a').click(function(){ 
		$('#mtabs ul li').removeClass('active'); 
		$(this).parent().addClass('active'); 
		var currentTab = $(this).attr('href'); 
		activeTab=currentTab; 
		//console.log("activeTab -> " + activeTab);
		$('#tab-1').hide(); 
		$('#tab-2').hide(); 
		$('#tab-3').hide(); 
		$('#tab-4').hide(); 
		$('#tab-5').attr("style","visibility:hidden;min-height:0px;height:0px;overflow:hidden;padding:0px;");
		if (currentTab == "#tab-5"){
			$('#tab-5').attr("style","visibility:visible;height:380px;padding:inherits;");		
		}else $(currentTab).show(); 
		return false;
	});//end click
	
	if ( isNaN(activeTab) || (activeTab > 5 || activeTab < 1) ){
		$('#tab-1').show(); 
	}else{
		$('#mtabs ul li').removeClass('active');
		$('#tab-'+activeTab).show();
		$('#litab'+activeTab).addClass('active');
	}
	
	//console.log("url -> " + $(window.location).attr('href'));
	var url = $(window.location).attr('href');
	var tabb = url.split("#");
	//console.log('#'+tabb[1]);
	
	if(typeof(tabb[1])!="undefined"){

		$('#mtabs ul li').removeClass('active'); 
		var currentTabURL = '#' + tabb[1]; 
		var litab = '#li' + tabb[1];
		activeTabURL = currentTabURL; 
		$('#tab-1').hide(); 
		$('#tab-2').hide(); 
		$('#tab-3').hide(); 
		$('#tab-4').hide(); 
		$('#tab-5').attr("style","visibility:hidden;min-height:0px;height:0px;overflow:hidden;padding:0px;");
		
			if (currentTabURL == "#tab-5"){
				$('#tab-5').attr("style","visibility:visible;height:380px;padding:inherits;");	
				$('#litab5').addClass('active');	
			}else {
				$(currentTabURL).show();
				$('#mtabs ul li').removeClass('active');
				$('#mtabs ' + litab).addClass('active');
				//console.log(litab);
			}//end if
			

		}//end if


});


