// JavaScript Document

function yes(j) {
	   if(j && j.songs)	
	   {
			var html = "<ul>";
			for(var i=1;i<j.songs.length;i++)
			{
				var s = j.songs[i];
				var d = s.at;								// Set the Variable
				var stringParts = d.split(" ");				// Split into two sections on the space between date and time making an array of two parts
				var dateParts = stringParts[0].split("-");	// Split the date into a three part array on the dashes
				var timeParts = stringParts[1].split(":");	// Split the time into a three part array on the colons
				var iYear = dateParts[0];
				var iMonth = dateParts[1];
				var iDay = dateParts[2];
				var iHour = timeParts[0];
				var iMinute = timeParts[1];
				var iSecond = timeParts[2];	
				var iampm = 'am';
				if (iHour == '00') {						// Replacing ARMY time with regular time
					iHour = '12';	
				}
				else if (iHour == '12') {
					iampm = 'pm';
				}
				else if (iHour == '13') {
					iHour = '1';
					iampm = 'pm';	
				}
				else if (iHour == '14') {
					iHour = '2';	
					iampm = 'pm';	
				}
				else if (iHour == '15') {
					iHour = '3';	
					iampm = 'pm';	
				}
				else if (iHour == '16') {
					iHour = '4';	
					iampm = 'pm';	
				}
				else if (iHour == '17') {
					iHour = '5';	
					iampm = 'pm';	
				}
				else if (iHour == '18') {
					iHour = '6';	
					iampm = 'pm';	
				}
				else if (iHour == '19') {
					iHour = '7';	
					iampm = 'pm';	
				}
				else if (iHour == '20') {
					iHour = '8';	
					iampm = 'pm';	
				}
				else if (iHour == '21') {
					iHour = '9';	
					iampm = 'pm';	
				}
				else if (iHour == '22') {
					iHour = '10';	
					iampm = 'pm';	
				}
				else if (iHour == '23') {
					iHour = '11';	
					iampm = 'pm';	
				}
				html += "<li><img src='"+s.cover+"' class='cover' width='100' height='91' alt=' "+s.by+" - "+s.title+" ' title=' "+s.by+" - "+s.title+" ' /> <h4 class='title'>"+s.by+"</h4> <h4 class='artist'>"+s.title+"</h4><h5>Played at "+iHour + ':' + iMinute+ "" +iampm+ " on "+iMonth + '/' + iDay+"</h5><a href='http://yes.com/i"+s.id+"' target='_blank'><img src='img/buttons/bigItunes.jpg' class='itunes' /></a></li>";
			}
		html += "</ul>";
		document.write(html);
	   }   
}