function toggleButton(bgID) {
  var btn = $("#" + bgID);
  if (btn) {
    if (btn.hasClass("active")) btn.removeClass("active");
    else btn.addClass("active");
  }
}

function blockUser(profileID, bgID) {
  var wBlock = radopen("/profiles/block.aspx?ID=" + profileID, "rwBlock");
  wBlock.setSize(400, 300);
  wBlock.set_visibleStatusbar(false);
  wBlock.Center();
  wBlock.setActive(true);
}

function unlockUser(profileID, bgID) {
  var wUnlock = radopen("/profiles/unlock.aspx?ID=" + profileID, "rwUnlock");
  wUnlock.setSize(400, 300);
  wUnlock.set_visibleStatusbar(false);
  wUnlock.Center();
  wUnlock.setActive(true);
}

function bookmarkUser(profileID, bgID) {
  var wBookmark = radopen("/profiles/bookmark.aspx?ID=" + profileID, "rwBookmark");
  wBookmark.setSize(400, 300);
  wBookmark.set_visibleStatusbar(false);
  wBookmark.Center();
  wBookmark.setActive(true);
}

function flirtUser(profileID, bgID) {
  var wFlirt = radopen("/profiles/flirt.aspx?ID=" + profileID, "rwFlirt");
  wFlirt.setSize(400, 300);
  wFlirt.set_visibleStatusbar(false);
  wFlirt.Center();
  wFlirt.setActive(true);
}

function openMailbox() {
  var wMailbox = window.top.radopen("/users/mailbox.aspx", "rwMailbox");
  wMailbox.setSize(600, 500);
  wMailbox.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Reload);
  wMailbox.set_modal(true);
  wMailbox.set_visibleStatusbar(false);
  wMailbox.Center();
  wMailbox.setActive(true);
}

function composeMessage(id) {
  var wMailbox = window.top.radopen("/users/mailbox.aspx?v=Compose&Recipient=" + id, "rwMailbox");
  wMailbox.setSize(600, 500);
  wMailbox.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Reload);
  wMailbox.set_modal(true);
  wMailbox.set_visibleStatusbar(false);
  wMailbox.Center();
  wMailbox.setActive(true);
}

function displayProfile(profileID) {
  if (profileID > 0) {
    var oWnd = window.top.radopen("/profiles/profile.aspx?ID=" + profileID, "rwProfile");
    oWnd.set_title("Loading Profile...");
    oWnd.Center();
    oWnd.set_modal(false);
    oWnd.setSize(600, 550);
    oWnd.setActive(true);
    oWnd.set_visibleStatusbar(false);
    oWnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Reload);
  }
}

function showPhoto(photoID, size, width, height) {
  if (photoID > 0) {
    var wPhoto = window.top.radopen("/profiles/photo.aspx?ID=" + photoID, "rwPhoto");
    width += 55;
    height += 105;
    wPhoto.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close + Telerik.Web.UI.WindowBehaviors.Move);
    wPhoto.set_visibleStatusbar(false);
    wPhoto.set_modal(false);
    wPhoto.setActive(true);
    wPhoto.setSize(width, height);
    wPhoto.Center();
    return wPhoto;
  }
}

function getHelp(topic) {
  if (topic) {
    var wHelp = radopen("/help/topic.aspx?topic=" + escape(topic), "rwHelp");
    wHelp.Center();
    wHelp.setActive(true);
  }
}
