var TBB = TBB || {};

TBB.UserProfileOverlay = {

	getProfileSummary: function(vieweeUserId) {
		if (vieweeUserId != "") {
			jQuery.ajax(
				{
					url: '/c/portal/user_profile/view',
					data: {
						cmd: 'view_profile',
						vieweeUserId: vieweeUserId
					},
					dataType: 'json',
					success: function(message) {
						var screenName = message.screenName || '';
						var bio = message.bio || '';
						var primary = message.primaryProgram || '';
						var goal = message.goal || '';
						var buddy = message.buddyUserId || '';
						var coach = message.repNumber || '';
						var routine = message.currentRoutine || '';
						jQuery('#' + vieweeUserId + '-bio').html(bio);
						jQuery('#' + vieweeUserId + '-primary-program').html(primary);
						jQuery('#' + vieweeUserId + '-goal').html(goal);
						if (coach != null && coach != '') {
							jQuery('#' + vieweeUserId + '-coach').html('<img src="/team-beachbody-theme/images/custom/coach_tag_small.png" />');
						}
						if (buddy != null && buddy != '') {
							jQuery('#' + vieweeUserId + '-buddy').html('Your Buddy');
							jQuery('#' + vieweeUserId + '-send-message-link').html('<a href="/connect/message-center/inbox?p_p_id=1_WAR_mailportlet&p_p_lifecycle=0&p_p_col_id=column-4&p_p_col_pos=1&p_p_col_count=2&_1_WAR_mailportlet_viewMode=composeMessage&_1_WAR_mailportlet_composeTo=' + screenName + '">Send Message</a>');
						}
						if (routine != null && routine != '') {
							jQuery('.profile-table').addClass('include-working-out-box');
							jQuery('#' + vieweeUserId + '-join-me-link').html('Join me');
							jQuery('#' + vieweeUserId + '-working-out-now').html('I&#39;m Working Out Now!');
							jQuery('#' + vieweeUserId + '-routine').html(currentRoutine);
						}
					}
				}
			);
		}
	}
}