$(document).ready( function()
{
	initCluetip();
	
	GetFlickr();
	
	$(".flickrview").live("click", function() {
		var url = $(this).attr("src").replace("_s.jpg", ".jpg");
		
		$("#flickrViewPort").fadeOut("fast", function() {
			$("#flickrLoader").show();
			$(this).load(function() {
				$("#flickrLoader").hide();
				$(this).fadeIn("slow");
			}).attr("src", url);
			
		});
	});
	
	
});

function GetFlickr() {
	$.ajax({
		type: "POST",
		url: localhost + "/Portfolio/GetFlickrFeed",
		data: { talent_id: $("#profileAuthId").val() },
		dataType: "json",
		async: true,
		success: function( msg ) {
			if( msg.success ) {
				$("#flickrFeed").html(msg.html);
				if( !msg.show && !msg.owner ) {
						$("#flickrFeedContainer").hide();
				} else {
					$("#flickrFeedContainer").show();
					if( !msg.show && msg.owner ) {
						$(".flickr-toggle").after("&nbsp;&nbsp;&nbsp;<span class=\"bold red\">(Hidden)</span>");
						$("#flickrhtml").addClass("hide");
						$("#flickrhtml").hide();
					}
				}
			} else {
				alert(msg.errormsg);
			}
		}
	});
}

