if (typeof com == "undefined") {com = {};};
if (typeof com.parolemanager == "undefined") {com.parolemanager = {};};
if (typeof com.parolemanager.javascript == "undefined") {com.parolemanager.javascript = {};};

if (typeof com.parolemanager.javascript.RemoteAccount == "undefined") {
 com.parolemanager.javascript.RemoteAccount = function() {} 
 com.parolemanager.javascript.RemoteAccount.prototype = new  com.oclib.javascript.lang.Root();

 com.parolemanager.javascript.RemoteAccount.prototype.className = "RemoteAccount"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classNamespace = "com.parolemanager.javascript.RemoteAccount"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classCreated = "20070213"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classCreator = "http://www.parolemanager.com/"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classLocation = "http://www.parolemanager.com/library/com/parolemanager/javascript/RemoteAccount.js"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classIndexLocation = "http://www.parolemanager.com/library/com/parolemanager/javascript/remoteAccount/"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classVersion = "20070213"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classVersionLocation = "http://www.parolemanager.com/library/com/parolemanager/javascript/20070213/RemoteAccount.js"; 
 com.parolemanager.javascript.RemoteAccount.prototype.classVersionIndexLocation = "http://www.parolemanager.com/library/com/parolemanager/javascript/20070213/"; 

 com.parolemanager.javascript.RemoteAccount.prototype.accounts = new com.parolemanager.javascript.Accounts();
  com.parolemanager.javascript.RemoteAccount.prototype.getAccounts = function () {return this.accounts;};
  com.parolemanager.javascript.RemoteAccount.prototype.setAccounts = function (accounts) {this.accounts = accounts; return 1;};
 com.parolemanager.javascript.RemoteAccount.prototype.blowfish;
  com.parolemanager.javascript.RemoteAccount.prototype.getBlowfish = function () {return this.blowfish;};
  com.parolemanager.javascript.RemoteAccount.prototype.setBlowfish = function (blowfish) {this.blowfish = blowfish; return 1;};
 com.parolemanager.javascript.RemoteAccount.prototype.method = "POST";
  com.parolemanager.javascript.RemoteAccount.prototype.getMethod = function () {return this.method;};
  com.parolemanager.javascript.RemoteAccount.prototype.setMethod = function (method) {this.method = method; return 1;};
 com.parolemanager.javascript.RemoteAccount.prototype.url;
  com.parolemanager.javascript.RemoteAccount.prototype.getUrl = function () {return this.url;};
  com.parolemanager.javascript.RemoteAccount.prototype.getURL = function () {return this.getUrl();};
  com.parolemanager.javascript.RemoteAccount.prototype.setUrl = function (url) {this.url = url; return 1;};
  com.parolemanager.javascript.RemoteAccount.prototype.setURL = function (url) {return this.setUrl(url);};
 com.parolemanager.javascript.RemoteAccount.prototype.uid = "";
  com.parolemanager.javascript.RemoteAccount.prototype.getUid = function () {return this.uid;};
  com.parolemanager.javascript.RemoteAccount.prototype.setUid = function (uid) {this.uid = uid; return 1;};

 com.parolemanager.javascript.RemoteAccount.prototype.addAccount = function(account, doIfSuccess, doIfError) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.addAccount is runing...");};
  var data = "action=add"
             +"&uid="+escape(this.uid)
             +"&email="+escape(account.getEncryptedEmail())
             +"&accountName="+escape(account.getEncryptedAccountName())
             +"&note="+escape(account.getEncryptedNote())
             +"&service="+escape(account.getEncryptedService())
             +"&password="+escape(account.getEncryptedPassword())
             +"&accountUid="+escape(account.getEncryptedUid())
             +"&url="+escape(account.getEncryptedUrl());
  if(this.mustDebug()) {this.getLog().println("RemoteAccount.login data="+data);};
  var loader = new com.oclib.javascript.util.Loader();
  loader.setDebugging(this.getDebugging());
  loader.setLog(this.getLog());
  loader.setTracing(this.getTracing());
  loader.setDoIfError(doIfError);
  var the = this;
  var thisDoIfSuccess = function() {the.addAccountParseResponse(doIfSuccess, doIfError, loader, account);};
  loader.setDoIfSuccess(thisDoIfSuccess);
  loader.makeRequest(this.method, this.url, data);
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.addAccountParseResponse = function(doIfSuccess, doIfError, loader, account) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.loginParseResponse is runing...");};
  var responseXML = loader.xml;  
  if(responseXML.getElementsByTagName("status") && responseXML.getElementsByTagName("status").item(0) && responseXML.getElementsByTagName("status").item(0).firstChild) {
   var status = responseXML.getElementsByTagName("status").item(0).firstChild.data;
   if(this.mustDebug()) {this.getLog().println("RemoteAccount.loginParseResponse: status="+status);};
   if(status == "success") {
    this.accounts.addAccount(account);
    doIfSuccess();
   } else {
    doIfError();
   };
  };
  return 1;
 };
 
 com.parolemanager.javascript.RemoteAccount.prototype.editAccount = function(deletedAccountName, account, doIfSuccess, doIfError) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.editAccount is runing...");};
  var data = "action=edit"
             +"&uid="+escape(this.uid)
             +"&deletedAccountName="+deletedAccountName
             +"&email="+escape(account.getEncryptedEmail())
             +"&accountName="+escape(account.getEncryptedAccountName())
             +"&note="+escape(account.getEncryptedNote())
             +"&service="+escape(account.getEncryptedService())
             +"&password="+escape(account.getEncryptedPassword())
             +"&accountUid="+escape(account.getEncryptedUid())
             +"&url="+escape(account.getEncryptedUrl());
  if(this.mustDebug()) {this.getLog().println("RemoteAccount.edit data="+data);};
  var loader = new com.oclib.javascript.util.Loader();
  loader.setDebugging(this.getDebugging());
  loader.setLog(this.getLog());
  loader.setTracing(this.getTracing());
  loader.setDoIfError(doIfError);
  var the = this;
  var thisDoIfSuccess = function() {the.editAccountParseResponse(doIfSuccess, doIfError, loader, deletedAccountName, account);};
  loader.setDoIfSuccess(thisDoIfSuccess);
  loader.makeRequest(this.method, this.url, data);
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.editAccountParseResponse = function(doIfSuccess, doIfError, loader, deletedAccountName, account) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.editParseResponse is runing...");};
  var responseXML = loader.xml;  
  if(responseXML.getElementsByTagName("status") && responseXML.getElementsByTagName("status").item(0) && responseXML.getElementsByTagName("status").item(0).firstChild) {
   var status = responseXML.getElementsByTagName("status").item(0).firstChild.data;
   if(this.mustDebug()) {this.getLog().println("RemoteAccount.editParseResponse: status="+status);};
   if(status == "success") {
    this.accounts.editAccount(deletedAccountName, account);
    doIfSuccess();
   } else {
    doIfError();
   };
  };
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.deleteAccount = function(account, doIfSuccess, doIfError) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.deleteAccount is runing...");};
  var data = "action=delete"
             +"&uid="+escape(this.uid)
             +"&accountName="+escape(account.getEncryptedAccountName());
  if(this.mustDebug()) {this.getLog().println("RemoteAccount.deleteAccount data="+data);};
  var loader = new com.oclib.javascript.util.Loader();
  loader.setDebugging(this.getDebugging());
  loader.setLog(this.getLog());
  loader.setTracing(this.getTracing());
  loader.setDoIfError(doIfError);
  var the = this;
  var thisDoIfSuccess = function() {the.deleteAccountParseResponse(doIfSuccess, doIfError, loader, account);};
  loader.setDoIfSuccess(thisDoIfSuccess);
  loader.makeRequest(this.method, this.url, data);
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.deleteAccountParseResponse = function(doIfSuccess, doIfError, loader, account) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.loginParseResponse is runing...");};
  var responseXML = loader.xml;  
  if(responseXML.getElementsByTagName("status") && responseXML.getElementsByTagName("status").item(0) && responseXML.getElementsByTagName("status").item(0).firstChild) {
   var status = responseXML.getElementsByTagName("status").item(0).firstChild.data;
   if(this.mustDebug()) {this.getLog().println("RemoteAccount.deleteAccountParseResponse: status="+status);};
   if(status == "success") {
    this.accounts.deleteAccount(account);
    doIfSuccess();
   } else {
    doIfError();
   };
  };
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.getAccountsList = function(doIfSuccess, doIfError) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.getAccountsList is runing...");};
  var data = "action=get"
             +"&uid="+escape(this.uid);
  if(this.mustDebug()) {this.getLog().println("RemoteAccount.getAccountsList data="+data);};
  var loader = new com.oclib.javascript.util.Loader();
  loader.setDebugging(this.getDebugging());
  loader.setLog(this.getLog());
  loader.setTracing(this.getTracing());
  loader.setDoIfError(doIfError);
  var the = this;
  var thisDoIfSuccess = function() {the.getAccountsListParseResponse(doIfSuccess, doIfError, loader);};
  loader.setDoIfSuccess(thisDoIfSuccess);
  loader.makeRequest(this.method, this.url, data);
  return 1;
 };

 com.parolemanager.javascript.RemoteAccount.prototype.getAccountsListParseResponse = function(doIfSuccess, doIfError, loader) {
  if(this.mustTrace()) {this.getLog().println("RemoteAccount.getAccountsListParseResponse is runing...");};
  var responseXML = loader.xml;  
  if(responseXML.getElementsByTagName("status") && responseXML.getElementsByTagName("status").item(0) && responseXML.getElementsByTagName("status").item(0).firstChild) {
   var status = responseXML.getElementsByTagName("status").item(0).firstChild.data;
   if(this.mustDebug()) {this.getLog().println("RemoteAccount.getAccountsListParseResponse: status="+status);};
   if(status == "success") {
    if(this.mustTrace()) {this.getLog().println("RemoteAccount.getAccountsListParseResponse: success...");};
    if(responseXML.getElementsByTagName("account")) {
	 var accounts = new com.parolemanager.javascript.Accounts();
	 accounts.setDebugging(this.getDebugging());accounts.setTracing(this.getTracing());accounts.setLog(this.getLog());
     var i = 0;
     while(responseXML.getElementsByTagName("account").item(i)) {
      var account = new com.parolemanager.javascript.Account();
      account.setBlowfish(this.blowfish);
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("email")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("email").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("email").item(0).firstChild) {
       account.setEncryptedEmail(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("email").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountName")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountName").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountName").item(0).firstChild) {
       account.setEncryptedAccountName(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountName").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("note")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("note").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("note").item(0).firstChild) {
       account.setEncryptedNote(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("note").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("service")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("service").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("service").item(0).firstChild) {
       account.setEncryptedService(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("service").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("password")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("password").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("password").item(0).firstChild) {
       account.setEncryptedPassword(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("password").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountUid")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountUid").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountUid").item(0).firstChild) {
       account.setEncryptedUid(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("accountUid").item(0).firstChild.data);
	  };
      if(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("url")
         && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("url").item(0)
		 && responseXML.getElementsByTagName("account").item(i).getElementsByTagName("url").item(0).firstChild) {
       account.setEncryptedUrl(responseXML.getElementsByTagName("account").item(i).getElementsByTagName("url").item(0).firstChild.data);
	  };
	  accounts.addAccount(account);
      i++;
	 };
	};
	this.accounts = accounts;
    doIfSuccess();
   } else {
    doIfError();
   };
  };
  return 1;
 };
};
