/* my network */
function loadMyFavorites( divId, userId )
{
  var url = "/publicManageUserNetworkController.dobbb";
  var params = "op=userFavorites&firstResults=0&pageSize=10&user_id=" + userId;
  ajaxUpdate(divId, url, params);
}
function loadMyFans( divId, userId )
{
  var url = "/publicManageUserNetworkController.dobbb";
  var params = "op=userFans&firstResults=0&pageSize=10&user_id=" + userId;
  ajaxUpdate(divId, url, params);
}
function loadMyFriends( divId, userId )
{
  var url = "/publicManageUserNetworkController.dobbb";
  var params = "op=userFriends&firstResults=0&pageSize=10&user_id=" + userId;
  ajaxUpdate(divId, url, params);
}
function loadNotificationWidget( divId, onCompleteFunction, async )
{
  var url = "/manageNotificationFilters.dobbb";
  var params = "op=viewNotificationsWidget";
  ajaxUpdate( divId, url, params, null, null, null, onCompleteFunction, async );
}
var gDivId;
function removeNotification( notificationId, divId )
{
  if( confirm( 'Are you sure you want to remove this notification? This process cannot be reversed.' ) )
  {
    gDivId = divId;
    var url = "/manageNotificationFilters.dobbb";
    var params = "op=removeNotification&notificationId=" + notificationId;
    ajaxRequest( url, params, onRemoveNotificationSuccess );
  }
}
function onRemoveNotificationSuccess( request )
{
  hideElement( gDivId );
}
function hideElement( divId )
{
  var element = $( divId );
  if( element )
  {
    element.style.display = 'none';
  }
}
function loadUserBookmarks( divId, userId )
{
  var url = '/publicManageUserNetworkController.dobbb?op=myBookmarks';
  var params = 'user_id=' + userId;
  ajaxUpdate( divId, url, params );
}
function highLightTab( num )
{
  $('netTab1').className = 'tab-search-off';
  $('netTab2').className = 'tab-search-off';
  $('netTab3').className = 'tab-search-off';
  $('netTab' + num).className = 'tab-search-on';
}
function userBookmarks( userId )
{
  document.location = '/userHomepage.dobbb?op=tagDetail&tagViewMode=user&otherUserId=' + userId;
}
/* notifications */
function removeNotifications()
{
  if( !validateCheckboxes( 'notificationsToRemove', 'Notification' ) )
  {
    return false;
  }
  if( !confirm('Are you sure you want to remove these notifications? This process cannot be reversed.') )
  {
    return false;
  }
  document.forms['notificationCmd'].submit();
  return true;
}
function viewNotifications( divName, category )
{
  var url = '/manageNotificationFilters.dobbb';
  var params = 'op=viewNotifications&category=' + category;
  ajaxUpdate( divName, url, params );
}
function clearAllNotifications( divName, category )
{
  if( !confirm( getConfirmationMessage( category ) ) )
  {
    return;
  }
  var url = '/manageNotificationFilters.dobbb';
  var params = 'op=clearAllNotifications&category=' + category;
  ajaxUpdate( divName, url, params );
}
function getConfirmationMessage( category )
{
  switch( category )
  {
    case 'FRIENDS':
      return 'Continuing with this action will remove ALL of your Notifications from Friends. This process is irreversible. Are you sure you wish to remove all of your Notifications from Friends?';
    case 'FAVORITES':
      return 'Continuing with this action will remove ALL of your Notifications from Favorites. This process is irreversible. Are you sure you wish to remove all of your Notifications from Favorites?';
    case 'SYSTEM':
      return 'Continuing with this action will remove ALL of your Notifications from the System. This process is irreversible. Are you sure you wish to remove all of your Notifications from the System?';
    case 'ADMIN':
      return 'Unsupported Operation. Cancel?';
    default:
      return 'Continuing with this action will remove ALL of your Notifications. This process is irreversible. Are you sure you wish to remove all of your Notifications?';
  }
}
function highLightNotificationTab( currElement, operation )
{
  $('tab_ALL').className = 'tab-search-off';
  $('tab_FRIENDS').className = 'tab-search-off';
  $('tab_FAVORITES').className = 'tab-search-off';
  $('tab_SYSTEM').className = 'tab-search-off';
  $('tab_' + operation).className = 'tab-search-on';
  $('currentTab').value = operation;
}
function refreshNetworkResults( divId, opCode, pageSize, firstResults )
{
  var url = "/publicManageUserNetworkController.dobbb";
  var params = "op=" + opCode + "&firstResults=" + firstResults + "&pageSize=" + pageSize;
  ajaxUpdate(divId, url, params);
}