﻿// CallbackDone
function KGProfileVisibilityControl_CallbackDone(args, context)
{
  // Check for a session time out before completing the callback
  if (CheckSessionTimeout())
    return;
}

// CallbackError Handling
function KGProfileVisibilityControl_CallbackError(args, context)
{
  // Here we are dealing with authentication timeout before callback, 
  // the message from the server is 'elogin' signify an error with 
  // authentication. The response will be trimmed to form the args 
  // 'login' here..... 
  if(args == 'login')
  {
    window.location='home.aspx';
  }
  else
  {
    //debugger;
    alert(args);
  }
}




function KGProfileVisibilityControl_ToggleVisible_Wrapped(_imageClientID, _section, _cbreference, e)
{
  try
  {
    var image = document.getElementById(_imageClientID);
    
    if(image != null)
    {
      var args = 'Action=ToggleVisible|SectionID=' + _section;
      
      if(image.className.indexOf("VisibilityControlHide") > -1)
      {
        args += '|Visibility=false';
        //image.src = 'Images/ProfileShow.png';
        image.className = 'VisibilityControlShow';
      }
      else
      {
        args += '|Visibility=true';
        //image.src = 'Images/ProfileHide.png';
        image.className = 'VisibilityControlHide';
      }
      eval(_cbreference);      
    }
    CancelBubble(e);
  }
  catch (ex) 
  {
    alert("An exception occurred in the script. Error name: " + ex.name + ". Error message: " + ex.message); 
    debugger;
  } 
}

function viewPublicProfile()
{
  var args = "Action=Load|ViewPublic=true";
  Pfl_KGMemberControl_CallbackTrigger(args);
}

function backToPrivateProfile()
{
  var args = "Action=Load|ViewPublic=false";
  Pfl_KGMemberControl_CallbackTrigger(args);
}
