manages = {
  ttempArg: null,
  tinterfaceURL: 'manage-interface.aspx',
  tinterfaceContentID: 'rightContent',
  tSaveOrderInitIdAry: '',
  tInit: function(_strArg)
  {
    var tstrArg = _strArg;
    manages.tLoad(tstrArg);
  },
  tLoad: function(_strArg)
  {
    var tstrArg = _strArg;
    manages.ttempArg = tstrArg;
    var tstrURL = manages.tinterfaceURL;
    if (tstrArg) tstrURL += tstrArg;
    manage.windows.tShowPanelLoading();
    cls.tigets(tstrURL, manages.tLoads);
  },
  tLoads: function(_strers)
  {
    var tstrers = _strers;
    manage.windows.tHidePanelLoading();
    if (manage.tckBackString(tstrers))
    {
      if (tstrers.indexOf('<!--alert-->') != -1) manage.message.tAlert(tstrers);
      else setInnerHTML($I(manages.tinterfaceContentID), tstrers);
      var tCategoryListObj = $I('categoryList');
      if (tCategoryListObj)
      {
        manages.tSaveOrderInit(cls.tgetCheckboxsValue('id'));
        tTableSorting.tInit(tCategoryListObj);
      };
    };
  },
  tLoadEdit: function(_id)
  {
    var tid = _id;
    var tListObj = $I('list-keywords-' + tid);
    if (tListObj)
    {
      tListObj.innerHTML = '';
      tListObj.setAttribute('rsid', tid);
      var tNewInput = document.createElement('input');
      tNewInput.className = 'inptext-2';
      tNewInput.setAttribute('rsid', tid);
      tNewInput.setAttribute('type', 'text');
      tNewInput.value = tListObj.getAttribute('confirm');
      tListObj.appendChild(tNewInput);
      tListObj.onclick = function() {};
      tNewInput.select();
      tNewInput.onblur = function()
      {
        var tValue = this.value;
        var tRsId = this.getAttribute('rsid');
        this.parentNode.setAttribute('confirm', tValue);
        this.parentNode.onclick = function() { location.href = cls.treparameter(manages.ttempArg, 'fid', this.getAttribute('rsid')); };
        this.parentNode.innerHTML = cls.thtmlEncode(tValue);
        cls.tigets(manages.tinterfaceURL + '?type=action&atype=edit&id=' + tRsId + '&topic=' + iescape(tValue), nll);
      };
    };
  },
  tAdd: function(_strfname)
  {
    var tstrfname = _strfname;
    var tformObj = $I(tstrfname);
    if (tformObj)
    {
      var tformBeObj = $I(tstrfname + 'BeforeAction');
      if (tformBeObj) eval(tformBeObj.value);
      if (manage.validator.tCheck(tformObj))
      {
        var tAction = tformObj.action;
        var tstrform = cls.form.tgetValues(tformObj);
        tstrform += '&fid=' + iescape($I('fid').value);
        tstrform += '&genre=' + iescape($I('genre').value);
        $I('ajaxSubmit').disabled = true;
        manage.windows.tShowPanelLoading();
        cls.tiposts(tAction, tstrform, manages.tAdds);
      };
    };
    return false;
  },
  tAdds: function(_strers)
  {
    var tstrers = _strers;
    $I('ajaxSubmit').disabled = false;
    manage.windows.tHidePanelLoading();
    if (manage.tckBackString(tstrers))
    {
      if (tstrers.indexOf('<!--200-->') != -1) manages.tRefresh();
      else manage.message.tAlert(tstrers);
    };
  },
  tEdit: function(_strfname)
  {
    var tstrfname = _strfname;
    var tformObj = $I(tstrfname);
    if (tformObj)
    {
      var tformBeObj = $I(tstrfname + 'BeforeAction');
      if (tformBeObj) eval(tformBeObj.value);
      if (manage.validator.tCheck(tformObj))
      {
        var tAction = tformObj.action;
        var tstrform = cls.form.tgetValues(tformObj);
        $I('popup-ajaxSubmit').disabled = true;
        manage.windows.tShowPanelLoading();
        cls.tiposts(tAction, tstrform, manages.tEdits);
      };
    };
    return false;
  },
  tEdits: function(_strers)
  {
    var tstrers = _strers;
    $I('popup-ajaxSubmit').disabled = false;
    manage.windows.tHidePanelLoading();
    if (manage.tckBackString(tstrers))
    {
      manage.message.tAlert(tstrers);
      if (tstrers.indexOf('<!--200-->') != -1) manages.tRefresh();
    };
  },
  tDelete: function(_strid)
  {
    var tstrid = _strid;
    manage.windows.tShowPanelLoading();
    cls.tigets(manages.tinterfaceURL + '?type=action&atype=delete&id=' + tstrid, manages.tDeletes);
  },
  tDeletes: function(_strers)
  {
    var tstrers = _strers;
    manage.windows.tHidePanelLoading();
    if (tstrers == '200') manages.tLoad(manages.ttempArg);
  },
  tSaveOrder: function(_stridary)
  {
    var tstridary = _stridary;
    if (manages.tSaveOrderInitIdAry != tstridary)
    {
      manages.tSaveOrderInitIdAry = tstridary;
      var tgenre = cls.tgetParameter(manages.ttempArg, 'genre');
      cls.tigets(manages.tinterfaceURL + '?type=action&atype=order&genre=' + escape(tgenre) + '&idary=' + tstridary, nll);
    };
  },
  tSaveOrderInit: function(_stridary)
  {
    var tstridary = _stridary;
    manages.tSaveOrderInitIdAry = tstridary;
  },
  tSwitchHidden: function(_id)
  {
    var tid = _id;
    manage.windows.tShowPanelLoading();
    cls.tigets(manages.tinterfaceURL + '?type=action&atype=switch&swtype=hidden&ids=' + tid, manages.tSwitchHiddens);
  },
  tSwitchHiddens: function(_strers)
  {
    var tstrers = _strers;
    manage.windows.tHidePanelLoading();
    if (tstrers == '200') manages.tLoad(manages.ttempArg);
  },
  tRefresh: function()
  {
    manages.tLoad(manages.ttempArg);
  },
  tSelcolumn: function(_strArg)
  {
    var tstrArg = _strArg;
    if (tstrArg == null) tstrArg = cls.tgetParameter(manages.ttempArg, 'genre');
    else
    {
      manages.ttempArg = '?genre=' + escape(tstrArg);
      manages.tRefresh();
    };
    var tstrURL = manages.tinterfaceURL + '?type=action&atype=selcolumn&genre=' + escape(tstrArg);
    cls.tigets(tstrURL, manages.tSelcolumns);
  },
  tSelcolumns: function(_strers)
  {
    var tstrers = _strers;
    manage.windows.tHidePanelLoading();
    if (manage.tckBackString(tstrers)) setInnerHTML($I('selcolumn'), tstrers);
    var tgenre = cls.tgetParameter(manages.ttempArg, 'genre');
    if (!tgenre) manage.message.tAlert($I('textareaErrorMessage-1').value);
  }
};
