function WXList() {
  this.title = '';
  this.id    = '';
  
  this.SetOver = function (id, item, tool) {
    var obj = null, i = 0;
    if (obj = document.getElementById(id + 'Check')) obj.className = 'cListCheckPlaceOver';
    for (i=0; i<item; i++) {
      if (obj = document.getElementById(id + 'Item' + ((i < 10) ? '0' : '') + i)) obj.className = 'cListItemOver';
    }
    for (i=0; i<tool; i++) {
      if (obj = document.getElementById(id + 'Tool' + ((i < 10) ? '0' : '') + i)) obj.className = 'cListToolOver';
    }
  }

  this.SetOut = function (id, item, tool) {
    var obj = null;
    if (obj = document.getElementById(id + 'Check')) obj.className = 'cListCheckPlace';
    for (i=0; i<item; i++) {
      if (obj = document.getElementById(id + 'Item' + ((i < 10) ? '0' : '') + i)) obj.className = 'cListItem';
    }
    for (i=0; i<tool; i++) {
      if (obj = document.getElementById(id + 'Tool' + ((i < 10) ? '0' : '') + i)) obj.className = 'cListTool';
    }
  }
  
  this.SetTitle = function (title) {
    this.title = title;
  }
  
  this.SetID = function (id) {
    this.id = id;
  }
  
  this.Checkbox = function (id, row, action) {
    var obj = null, i = 0;
    for (i=0; i<row; i++) {
      var oId = id + 'I' + ((i < 9) ? '0' : '') + (i + 1);
      if (obj = document.getElementById(oId)) {
        if (action == 'a') obj.checked = true;
        else if (action == 'n') obj.checked = false;
        else obj.checked = ((obj.checked) ? false : true);
      }
    }
    this.CheckAction(id, row);
  }
  
  this.CheckAction = function (id, row) {
    var select = false, obj = null, i = 0;
    for (i=0; i<row; i++) {
      var oId = id + 'I' + ((i < 9) ? '0' : '') + (i + 1);
      if (obj = document.getElementById(oId)) {
        if (obj.checked) select = true;
      }
    }
    
    if (select) {
      document.getElementById(id + 'ActionSelect').disabled = false;
      document.getElementById(id + 'ActionButton').disabled = (document.getElementById(id + 'ActionSelect').value == '');
    } else {
      document.getElementById(id + 'ActionSelect').disabled = true;
      document.getElementById(id + 'ActionButton').disabled = true;
    }
  }
  
  this.Confirm = function (image, todo, content, action) {
    var data = [document.getElementById(this.id + 'Data').value, this.title];
    wx.Confirm(image, todo, content, data, action);
  }
  
  this.Action = function (id, row) {
    var select = document.getElementById(id + 'ActionSelect');
    var action = select.options[select.selectedIndex];

    var obj = null, i = 0, checked = [];
    for (i=0; i<row; i++) {
      var oId = id + 'I' + ((i < 9) ? '0' : '') + (i + 1);
      if (obj = document.getElementById(oId)) {
        if ((obj.checked) && (obj.name != '')) checked[checked.length] = obj.name;
      }
    }
    
    if (checked.length == 0) return;
    wxMessage.Show(action.text, wxMessage.Progress('ارسال اطلاعات به سرور'));
    
    wxQuery.Reset(action.value);
    wxQuery.AddData('data', checked.join('|'));
    wxAjax.AddQuery(wxQuery);
  }
}
