var mh_Error_Label = function() {};

mh_Error_Label.prototype.parseFormFields = function(json, prefix) {
  this.reset();
  
  prefix = ((prefix != null) && (prefix != undefined)) ? prefix : "";
  json = (typeof json != "object") ? eval("(" + json + ")") : json;
  
  var obj;
  var focus = false;
  for(elem in json) {
    obj = $("#" + prefix + elem);
    
    if(!focus) {
      obj.focus();
      focus = true;
    }
    
    obj.addClass("mh_Error_Label");
    obj[0].title = json[elem];
    obj.tooltip({
      id: "mh_Error_Label_tooltip",
      extraClass: "mh_Error_Label_tooltip",
      fade: 250,
      track: true
    });
  }
};

mh_Error_Label.prototype.reset = function(obj) {
  var elem = $(obj + ".mh_Error_Label");
  if(elem.length > 0) {
    $(obj + ".mh_Error_Label").removeClass("mh_Error_Label");

    elem = $(obj + ".tooltip");
  } else {
    if((obj != undefined) && (obj.length > 1)) {
      $(obj + " .mh_Error_Label").removeClass("mh_Error_Label");
    } else {
      $(".mh_Error_Label").removeClass("mh_Error_Label");
    }
    
    elem = $(".tooltip");
  }
  
  if(elem.length > 0) {
    elem.removeClass("tooltip");
    elem.tooltip();
  }
};

var mh_error = new mh_Error_Label();