$(document).ready(function(){

	//add slide toggle action to about-btn
	$("#about-btn").click(function(event){
		$("#about-btn").toggleClass("about-btn about-btn-up");
		$("#about-wrapper").slideToggle("normal");
	});
	
	//twitter
	getTwitters('twitter-content', { 
		  id: 'monocubed', 
		  count: 3, 
		  enableLinks: true, 
		  ignoreReplies: true, 
		  clearContents: true,
		  template: '<div class="tweet"><p>%text%</p><div class="tweet-details"><a href="http://twitter.com/%ser_screen_name%/statuses/%id%/">%time%</a></div></div>'
		});
		
	

	//dribbble
	$.jribbble.getShotsByPlayerId('monocubed',
	   	function (playerShots)
		{
	       	var html = [];
	       	$.each(playerShots.shots, function (i, shot)
	       	{
				html.push('<a href="' + shot.url + '"><img class="dribbble-preview" src="' + shot.image_url + '	" width="290" height="217"/></a><div class="dribbble-details">' + shot.title + ' - <a href="' + shot.url + '">' + formatDate(shot.created_at) + '</a></div>');
	       	});

	       	$('#dribbble-content').html(html.join(''));
	   	},
	   	{page: 1, per_page: 1}
	);

	//date format
	function formatDate(t) {
		var m_names = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec");
		var d = new Date(t);
		
		var a_p = "";
		var curr_hour = d.getHours();

		if (curr_hour < 12)
		   {
		   a_p = "AM";
		   }
		else
		   {
		   a_p = "PM";
		   }
		if (curr_hour == 0)
		   {
		   curr_hour = 12;
		   }
		if (curr_hour > 12)
		   {
		   curr_hour = curr_hour - 12;
		   }

		var curr_min = d.getMinutes();
		
		
		
		
		var curr_date = d.getDate(t);
		var sup = "";
		if (curr_date == 1 || curr_date == 21 || curr_date ==31)
		   {
		   sup = "st";
		   }
		else if (curr_date == 2 || curr_date == 22)
		   {
		   sup = "nd";
		   }
		else if (curr_date == 3 || curr_date == 23)
		   {
		   sup = "rd";
		   }
		else
		   {
		   sup = "th";
		   }
		var curr_month = d.getMonth();
		var curr_year = d.getFullYear();
		
		
		//return(curr_hour + ":" + curr_min + " " + a_p + " - " + curr_date + "<SUP>" + sup + "</SUP> " + m_names[curr_month] + " " + curr_year);
		return(curr_date + "<SUP>" + sup + "</SUP> " + m_names[curr_month] + " " + curr_year);
	}

	
});
