function YouTube(id)
{
	//-----------------------------------------------------------------------------------------------------------
	// Member variables
	//-----------------------------------------------------------------------------------------------------------

	// Public
	this.id = id;
	this.feed = null;
	this.currentPage = 1;
	this.maxPages = 8;
	this.numItemsPerPage = 3;
	this.containerId = 'videos';
	this.thumbWidth = 130;
	this.thumbHeight = 97;
	this.overlayImage = '';
	this.pagingHtml = '';
	
	// Private
	var mNumPages = 1;
	
	//-----------------------------------------------------------------------------------------------------------
	// Public functions
	//-----------------------------------------------------------------------------------------------------------

	this.showFeed = showFeed;
	this.showPage = showPage;
	
	//-----------------------------------------------------------------------------------------------------------
	// Functions
	//-----------------------------------------------------------------------------------------------------------

	function showFeed(data)
	{
		// Feed
		var feed = data.feed;
		var entries = feed.entry || [];
		
		this.feed = entries;
		mNumPages = Math.ceil(this.feed.length / this.numItemsPerPage);
		
		this.showPage(1);
	}
	
	function showPage(page)
	{
		if (page > mNumPages)
		{
			return;
		}
		
		this.currentPage = page;
		var html = '';

		var firstItem = (this.numItemsPerPage * (page - 1));
		var i;
		for (i = firstItem; i < firstItem + this.numItemsPerPage; i++)
		{
			if (i >= this.feed.length)
			{
				break;
			}
			
			var entry = this.feed[i];
			var title = entry.title.$t;
			var publishedDate = Date.parseUTCString(entry.published.$t);   // UTC date format (e.g. 2007-10-29T08:23:48.000Z)
			var thumbnailUrl = this.feed[i].media$group.media$thumbnail[0].url;
			var playerUrl = this.feed[i].media$group.media$player[0].url;
			
			html += '<div class="video">'
				+ '<a href=' + playerUrl + ' target="_blank" class="imageLink">'
				+ (this.overlayImage.length > 0 ? '<img class="overlay" src="' + BASE + this.overlayImage + '" />' : '')
				+ '<img class="image" src="' + BASE + "/thumbnails/phpThumb.php?src=" + thumbnailUrl
					+ '&w=' + this.thumbWidth + '&h=' + this.thumbHeight + '&zc=1" alt=' + thumbnailUrl + '/>'
				+ '</a>\n'
				+ '<div class="description">'
				+ '<a href=' + playerUrl + ' target="_blank" class="title">' + title+ '</a>\n'
				+ publishedDate.format('mmm d yyyy') + '</div>\n'
				+ '</div>\n';
		}
		
		$('#' + this.containerId).html('<div class="videos">' + html + '</div>');
		
		// Add paging
		// TODO refactor this code
		if (this.feed.length > this.numItemsPerPage)
		{
			var mPaging = new Paging(id);

			mPaging.numPages = mNumPages;
			mPaging.maxPages = this.maxPages;
			mPaging.numItemsPerPage = this.numItemsPerPage;
			mPaging.currentPage = this.currentPage;
			mPaging.containerId = this.containerId;
			mPaging.pagingHtml = this.pagingHtml;
			
			mPaging.addPaging();
		}	
	}
}