function writeFacebookLikeTag () {
  	var pageAddress = $(location).attr('href');
  	var facebookLikeTag = '<fb:like href="'+pageAddress+'"show_faces="false" width="270" font="helvetica"></fb:like>';
  	$("#jquery_facebook_like_tag").empty().append(facebookLikeTag);
  }
 
function buildCelticsFooterSchedule(gameDate,gameDay,gameMonthDay,gameOpponent,gameLogoFile,gameTipoff,gameURL) {	
	// Build HTML string and return
	output = '';
	output += '<tr>';
	output +='<td>' + gameMonthDay + '</td>';
	output += '<td>vs. <a href="' + gameURL + '&amp;camefrom=NBACELTICS_WEBARTICLEFOOTER&amp;brand=celtics" target="_blank">' + gameOpponent + '</a></td>';
	output += '<td class="buy"><a href=" ' + gameURL + '&amp;camefrom=NBACELTICS_WEBARTICLEFOOTER&amp;brand=celtics" onclick="popUp(this.href,\'console\',850,775);return false;" target="newWin"><img src="/celtics/media/tix_icon1810.gif" width="18" height="10" alt="Buy Tickets" /></a></td>';
	output += '</tr>';
	return output;
} 
  
function displayArticleFooterTickets(xml_file_name,content_area) {
	// Open the upcoming games .xml file
	
	var rnd = Math.round(Math.random() * 100000);
	file_name = xml_file_name +'?random='+rnd;
	$.get(file_name,{},function(xml){
      	
		// Build an HTML string
		myHTMLOutput = '';
	 	myHTMLOutput += '<table id="quick_schedule" cellpadding="0" cellspacing="0">';
		myHTMLOutput += '<tr><th>Date</th><th>Opponent</th><th>Buy Tickets</th></tr>';
		
		totalGames = $('game',xml).length;		
		gameCounter = 0;
		
		$('game',xml).each(function(i) {
		
		gameDate = $(this).attr("gamedate");
		theGamedateFromXML = $(this).attr("gamedate");
		
		gameDay = $(this).attr("day");
		gameMonthDay = $(this).attr("monthday");
		gameOpponent = $(this).attr("opponent");
		gameLogoFile = $(this).attr("logo");
		gameTipoff = $(this).attr("tipoff");
		gameURL = $(this).attr("url");
		
		gameDateArray = theGamedateFromXML.split('/');
		mon = Number(gameDateArray[0]);
		day = Number(gameDateArray[1]);
		year = Number(gameDateArray[2]);
		hour = Number(gameDateArray[3]);
		minutes = Number(gameDateArray[4]);
		
		if (year < 4)
			year += 2000;
		
		else if (year < 100)
			year += 1900;

		asGameDate = new Date(year,mon-1,day,hour,minutes);
		
		todayDate = new Date();
		
			if (asGameDate > todayDate || asGameDate == todayDate) 	{
				
				if (gameCounter < 5) {
				
				mydata = buildCelticsFooterSchedule(gameDate,gameDay,gameMonthDay,gameOpponent,gameLogoFile,gameTipoff,gameURL);
				myHTMLOutput = myHTMLOutput + mydata;
				//break;
				gameCounter++;
					}
				else 
					{
					//alert("don't print this game");
					}
				
				}
				else
				{
				//alert("That game was already played.");		
			}
			
		});
		myHTMLOutput += '</table>';
		
		// Update the DIV called Content Area with the HTML string
		$(content_area).append(myHTMLOutput);
	});		
}
