﻿$(document).ready(function(){

    // Dates
	$('.dateBox').each(function(){					
		var month = parseInt($(this).text()) - 1; // Subtracting one from the month because array is base 0
		var months = new Array('January','February','March','April','May','June','July','August','Sepember','October','November','December');
		
		if(month + 1 >= 10) {
			var day = parseInt($(this).text().substring(3));
			if(day > 9) {
				var year = parseInt($(this).text().substring(6));
			} else {
				var year = parseInt($(this).text().substring(5));
			}
		} else {
			var day = parseInt($(this).text().substring(2));
			if(day > 9) {
				var year = parseInt($(this).text().substring(5));
			} else {
				var year = parseInt($(this).text().substring(4));
			}
		}
		
		$(this).text("");
		$(this).append(months[month] + " " + day + ', ' + year); 
	});
	
	// Remove first photo li because its the same as featured
	$('.photos li:nth-child(2)').remove();
	$('.photos li:nth-child(4)').addClass("last");
	
	// Video Play Button
	$('.videos li').fader({
    	time: 300,
		selectors: ".play"
	});
	$('.videos li').each(function() {
		var url = $(this).find('a.image').attr("href") + "&artistID=7405";
		var mid = url.substring(55, 59);
		var newUrl = "http://islanddefjam.com/artist/videos_single.aspx?mid=" + mid + "&artistID=7405";
		$(this).find('a').attr("href", newUrl);
	});	
	
	// Twitters
	/*$(".methTweet .tweets").tweet({
		join_text: "auto",
		username: "TheRealMef",
		avatar_size: 0,
		count: 1,
		auto_join_text_default: "",
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "loading tweets..."
	});*/
	$(".groupTweet .tweets").tweet({
		join_text: "auto",
		username: "MethGhostRae",
		avatar_size: 0,
		count: 1,
		auto_join_text_default: "",
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "loading tweets..."
	});
	$(".ghostTweet .tweets").tweet({
		join_text: "auto",
		username: "GhostfaceKillah",
		avatar_size: 0,
		count: 1,
		auto_join_text_default: "",
		auto_join_text_ed: "",
		auto_join_text_ing: "",
		auto_join_text_reply: "",
		auto_join_text_url: "",
		loading_text: "loading tweets..."
	});
});

//Tooltip
$(window).load(function () {
	$(".photos li").each(function(){
		$(this).hover(function(){
			$(this).find(".toolTip").css("display", "block");
		}, function() {
			$(this).find(".toolTip").css("display", "none");
		});
	});
	
	// Fixes if hovered over the info div
	$(".photos li .toolTip").mouseover(function () {
			$(this).css("display", "none");													  
	});
});


