// Photos
var photoProvider = new Flickr('photoProvider');
photoProvider.containerId = 'artist_photos';
photoProvider.thumbWidth = 75;
photoProvider.thumbHeight = 75;
photoProvider.maxPages = 1;
photoProvider.pagingHtml = '<a href="' + $('#flickrChannelURL').val() + '" target="_blank" class="channelLink"><img src="../img/flickrChannel.png" /><span>flickr</span></a><div id="flickrtext">Artist Gallery</div>';

// Videos
var videoProvider = new YouTube('videoProvider');	
videoProvider.containerId = 'artist_videos';
videoProvider.thumbWidth = 114;
videoProvider.thumbHeight = 75;
videoProvider.overlayImage = '/img/play.png';
videoProvider.pagingHtml = '<a href="' + $('#youTubeChannelURL').val() + '" target="_blank" class="channelLink"><img src="../img/ytChannel.png" /><span>youtube</span></a><div id="youtubetext">Artist Channel</div>';

// Artist Products
var ajaxPage = new AjaxPage('ajaxPage');
ajaxPage.pageURL = BASE + '/ajax/artistproducts';
ajaxPage.containerId = 'artist_products_box';
ajaxPage.pagingContainerId = 'artist_products_paging';
ajaxPage.numItemsPerPage = 9;

$(document).ready(function()
{
	// Artist products
	ajaxPage.totalElements = $('#totalProducts').html();
	var artistId = $('#artistId').html();
	
	ajaxPage.init(artistId);
	
	// Photos
	// This always returns up to 20 results because this is all the flick allows
	$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=" + $('#flickr_tag').val() + "&lang=en-us&format=json&jsoncallback=?",
		function (data)
		{
			photoProvider.showFeed(data);
		});
});

function showMoreInfo(showId)
{
	var divId = '#ShowMoreInfo' + showId;
	var isVisible = !$(divId).hasClass('hidden');

	if (!isVisible)
	{
		$(divId).show('normal');
	}
	else
	{
		$(divId).hide('normal');
	}
	
	$(divId).toggleClass('hidden');
}

function showWaterfrontShare()
{
	$('#waterfront_share').slideToggle("fast");
}

function selectWaterfrontLink()
{	
	document.getElementById('waterfrontArtistShareLink').focus();
    document.getElementById('waterfrontArtistShareLink').select();
}
