function EditUser(ajax_url) {
  this.ajax_url = ajax_url;

  if (typeof EditUser._initialized == "undefined") {

    EditUser.prototype.initLinks = function () {
      var myLink = document.getElementById("random_pass");
      //alert(myLink);
      myLink.pageObj = this;
      addEvent(myLink, 'click', this.processLink, false);
    }

    EditUser.prototype.processLink = function (e) {
      stopBubble(e);
      var el = null;
      el = getTarget(e);

      if (!el) {
        return;
      }
      var pageObj = this.pageObj;

      var param = document.getElementById("login").value;
//alert(param);

      if (!param) {
        alert("You must enter a login to correctly generate a random password");
        return;
      }

      url = pageObj.ajax_url+"&ajax=1&param="+param;

//alert(url);
      myContent = new AjaxContent(url);
      //myContent.setCallObj(pageObj);
      myContent.setCallBack(pageObj.processedLink);
      myContent.setReturnContent(true);
      //myContent.setShowResponse(true);
      myContent.getContent();
    }

    EditUser.prototype.processedLink = function (results) {
      var newPass = results.getElementsByTagName("new_pass")[0].firstChild.nodeValue;

      changeValue("pass1",newPass);
      changeValue("pass2",newPass);
    }

    EditUser._initialized = true;
  }
}

function initPage_obj() {
  user_obj.initLinks();
}


