$(document).ready(function(){

	//hide sub nav w/ js for compat w/ non-js browsers
	$('#nav ul ul').hide();

	$('.email').each(function(){		
		var handle = $(this).text();
		var domain = 'sugarmade.com';
		$(this).text(handle+'@'+domain);
	});

	var file = $.url().attr('file');
		
	$('#nav a').each(function(){				  
		
		var nav = $(this).attr('href');
		
		if (file == nav) {
			
			$(this).parents('ul').css({'display':'block'});
			
			$(this).addClass('active');

		}
	});
	
});


$('.email').bind('click mouseenter', function(){	
	var href = $(this).text();
	$(this).attr('href', 'mailto:'+href);
});

$('.email').mouseleave(function(){
	$(this).attr('href', '#');
});


/* sub nav redirect */
$('.investor-btn').click(function(){
	window.location = 'message-from-the-ceo.php';
});

/* Google Analytics */

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-15813263-18']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


