$(document).ready(function() {
	
	var twitterWidgets = document.createElement('script');
    twitterWidgets.type = 'text/javascript';
    twitterWidgets.async = true;
    twitterWidgets.src = 'https://platform.twitter.com/widgets.js';
    document.getElementsByTagName('head')[0].appendChild(twitterWidgets);

	/* SWITCHES DATE FORMAT ------------- */	
	$('body#client span.date').each(function() {
		var dateArray = $(this).text().split('-');
		var newDay = dateArray[0];
		var newMonth = dateArray[1];
		var newYear = dateArray[2];
		var newDateFormat = "" + newMonth + " " + newDay + ", " + newYear + "";
	$(this).html(newDateFormat);
	});
	
	/* TABS --------------------------------- */	
	var tabs = $('dl.tabs');
		tabsContent = $('ul.tabs-content')
	
	tabs.each(function(i) {
		//Get all tabs
		var tab = $(this).children('dd').children('a');
		tab.click(function(e) {
			
			//Get Location of tab's content
			var contentLocation = $(this).attr("href")
			contentLocation = contentLocation + "Tab";
			
			//Let go if not a hashed one
			if(contentLocation.charAt(0)=="#") {
			
				e.preventDefault();
			
				//Make Tab Active
				tab.removeClass('active');
				$(this).addClass('active');
				
				//Show Tab Content
				$(contentLocation).parent('.tabs-content').children('li').css({"display":"none"});
				$(contentLocation).css({"display":"block"});
				
			} 
		});
	});
	
});
