$(document).ready(function() {
//	$('#media .content h2').each(function() {
//		if($(this).css('display') != 'block') {
//			$(this).next('iframe').show();
//		}
//	});
	
	// swap media
	$('#media-feed .thumb a').click(function() {
		var mediaId = $(this).prev('input').val();
		$('#media .content h2').hide();
		$('#media .content').find('iframe').remove();
		$('#media .content').append('<iframe src="' + $(this).attr('href') + '?title=0&amp;byline=0&amp;portrait=0" width="580" height="327" frameborder="0"></iframe>');
		$('#media .content #' + $(this).attr('class')).slideDown(250);
		return false;
	});
	
	// swap sidebar detail
	$('#media-feed .thumb a').mouseenter(function() {
		var mediaId = $(this).prev('input').val();
		$('#media-feed .detail').each(function() {
			if($(this).css('display') == 'block') {
				$(this).slideUp(125, function() {
					var currentDetail = $('#media-detail-' + mediaId);
					currentDetail.slideDown(125, function() {
					currentDetail.css('display', 'block');
					});
				});
			}
		});
		return false;
	});
});
