
/*
 *  Contains all tasks related to photos.
 */
 
var ezpPhotos = Class.create();
ezpPhotos.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.photos.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  getAuthenticationRequirements: function(argsArray,cb) 
  {
    var msg = new XMLRPCMessage( "getAuthenticationRequirements" , null);
    msg.addParameter(argsArray);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getAuthenticationRequirementsForm:function ( cb ) 
  {
    this.getAuthenticationRequirements(V('argsArray','String[]'),cb);		          
  }

  ,
  authenticate: function(token,argsArray,cb) 
  {
    var msg = new XMLRPCMessage( "authenticate" , null);
    msg.addParameter(token);
    msg.addParameter(argsArray);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  authenticateForm:function ( cb ) 
  {
    this.authenticate(V('token','String'),V('argsArray','String[]'),cb);		          
  }

  ,
  getPhotoByAlbumIdByPhotoId: function(token,albumId,photoId,cb) 
  {
    var msg = new XMLRPCMessage( "getPhotoByAlbumIdByPhotoId" , null);
    msg.addParameter(token);
    msg.addParameter(albumId);
    msg.addParameter(photoId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPhotoByAlbumIdByPhotoIdForm:function ( cb ) 
  {
    this.getPhotoByAlbumIdByPhotoId(V('token','String'),V('albumId','String'),V('photoId','String'),cb);		          
  }

  ,
  getPhotoByAlbumIdByPhotoIdNoCache: function(token,albumId,photoId,cb) 
  {
    var msg = new XMLRPCMessage( "getPhotoByAlbumIdByPhotoIdNoCache" , null);
    msg.addParameter(token);
    msg.addParameter(albumId);
    msg.addParameter(photoId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPhotoByAlbumIdByPhotoIdNoCacheForm:function ( cb ) 
  {
    this.getPhotoByAlbumIdByPhotoIdNoCache(V('token','String'),V('albumId','String'),V('photoId','String'),cb);		          
  }

  ,
  getPhotosByAlbumId: function(token,albumId,cb) 
  {
    var msg = new XMLRPCMessage( "getPhotosByAlbumId" , null);
    msg.addParameter(token);
    msg.addParameter(albumId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPhotosByAlbumIdForm:function ( cb ) 
  {
    this.getPhotosByAlbumId(V('token','String'),V('albumId','String'),cb);		          
  }

  ,
  getPhotosByAlbumIdNoCache: function(token,albumId,cb) 
  {
    var msg = new XMLRPCMessage( "getPhotosByAlbumIdNoCache" , null);
    msg.addParameter(token);
    msg.addParameter(albumId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPhotosByAlbumIdNoCacheForm:function ( cb ) 
  {
    this.getPhotosByAlbumIdNoCache(V('token','String'),V('albumId','String'),cb);		          
  }

  ,
  getAlbumByAlbumId: function(token,albumId,cb) 
  {
    var msg = new XMLRPCMessage( "getAlbumByAlbumId" , null);
    msg.addParameter(token);
    msg.addParameter(albumId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getAlbumByAlbumIdForm:function ( cb ) 
  {
    this.getAlbumByAlbumId(V('token','String'),V('albumId','String'),cb);		          
  }

  ,
  getAlbumsByUserId: function(token,userId,cb) 
  {
    var msg = new XMLRPCMessage( "getAlbumsByUserId" , null);
    msg.addParameter(token);
    msg.addParameter(userId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getAlbumsByUserIdForm:function ( cb ) 
  {
    this.getAlbumsByUserId(V('token','String'),V('userId','String'),cb);		          
  }

}
var ezpPhotosSdk = new ezpPhotos();



 
var ezpSecurity = Class.create();
ezpSecurity.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.security.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  
  /*********
    
    Gets a user, if they exist and if not, creates them and logs you in.
    
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id
    @UserName : User login.
    @Password : Clear text password typed in by the user
    
    returns : string Token - This string is used in all subsequent calls to the system to identify the user session.
    
  *********/
  getUser: function(BrandId,UserName,Password,cb) 
  {
    var msg = new XMLRPCMessage( "getUser" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(Password);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getUserForm:function ( cb ) 
  {
    this.getUser(V('BrandId','String'),V('UserName','String'),V('Password','String'),cb);		          
  }

  ,
  
  /*********
    
    login is used to establish a user session with the system.  
    
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id
    @UserName : User login.
    @Password : Clear text password typed in by the user
    
    returns : string Token - This string is used in all subsequent calls to the system to identify the user session.Thrown for the following:
    Invalid UserInvalid PasswordlogOff
    
  *********/
  login: function(BrandId,UserName,Password,cb) 
  {
    var msg = new XMLRPCMessage( "login" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(Password);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  loginForm:function ( cb ) 
  {
    this.login(V('BrandId','String'),V('UserName','String'),V('Password','String'),cb);		          
  }

  ,
  
  /*********
    
    logOff is used to end a session with the system.
    All session related data is removed from the system.
    login
    @Token : This is the token returned from login
    
    returns : true if the user is logged off, false if not.
    
  *********/
  logOff: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "logOff" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  logOffForm:function ( cb ) 
  {
    this.logOff(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    setUserPassword is used to set the user password.
    login
    @Token : This is the token returned from login
    @userPassword : This is the new user passwordlogin
    
    returns : true if the user login is set, false if not.
    
  *********/
  setUserPassword: function(Token,userPassword,cb) 
  {
    var msg = new XMLRPCMessage( "setUserPassword" , null);
    msg.addParameter(Token);
    msg.addParameter(userPassword);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  setUserPasswordForm:function ( cb ) 
  {
    this.setUserPassword(V('Token','String'),V('userPassword','String'),cb);		          
  }

  ,
  
  /*********
    
    setUserLogin is used to change the user login.
    login
    @Token : This is the token returned from login
    @userLogin : This is the new user loginlogin
    
    returns : true if the user login is set, false if not.
    
  *********/
  setUserLogin: function(Token,userLogin,cb) 
  {
    var msg = new XMLRPCMessage( "setUserLogin" , null);
    msg.addParameter(Token);
    msg.addParameter(userLogin);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  setUserLoginForm:function ( cb ) 
  {
    this.setUserLogin(V('Token','String'),V('userLogin','String'),cb);		          
  }

  ,
  
  /*********
    
    validPassword is used to check a potential password.
    login
    @password : This is the password 
    
    returns : true if the password is valid, false if not.
    
  *********/
  validPassword: function(password,cb) 
  {
    var msg = new XMLRPCMessage( "validPassword" , null);
    msg.addParameter(password);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  validPasswordForm:function ( cb ) 
  {
    this.validPassword(V('password','String'),cb);		          
  }

  ,
  
  /*********
    
    userExists is used to verify that a particular user exists for a specific brand
    
    This call can be used to verify that a user exists before attempting other calls
    
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id.
    @UserName : This is the user id to verify. This is not case sensitive
    
    returns : ReturnDescriptiontrueThe user is validfalseThe user does not exist
    
  *********/
  userExists: function(BrandId,UserName,cb) 
  {
    var msg = new XMLRPCMessage( "userExists" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  userExistsForm:function ( cb ) 
  {
    this.userExists(V('BrandId','Int32'),V('UserName','String'),cb);		          
  }

  ,
  
  /*********
    
    userValid is used to verify that a particular user 
    1) exists for a specific brand
    2) matches the First name provided
    
    This call can be used to pre-certify a user before attempting to call 
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id.
    @UserName : This is the user id to verify. This is not case sensitive
    @FirstName : This is the First Name associated with the user.  This is not case sensitive
    
    returns : ReturnDescriptiontrueThe user is valid and matches the first name providedfalseThe user is not valid or does not match the first name provided
    
  *********/
  userValid: function(BrandId,UserName,FirstName,cb) 
  {
    var msg = new XMLRPCMessage( "userValid" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(FirstName);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  userValidForm:function ( cb ) 
  {
    this.userValid(V('BrandId','Int32'),V('UserName','String'),V('FirstName','String'),cb);		          
  }

  ,
  
  /*********
    
    This sets the user password to a random value and triggers an eMail to be sent to the user with the new password.
    
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id.
    @UserName : This is the user id to verify. This is not case sensitive
    @FirstName : This is the First Name associated with the user.  This is not case sensitive
    
    returns : ReturnDescriptiontrueThe password has been resetfalseThe password could not be resetThe user is not valid.   Call  before calling this.
    
  *********/
  resetPassword: function(BrandId,UserName,FirstName,cb) 
  {
    var msg = new XMLRPCMessage( "resetPassword" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(FirstName);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  resetPasswordForm:function ( cb ) 
  {
    this.resetPassword(V('BrandId','Int32'),V('UserName','String'),V('FirstName','String'),cb);		          
  }

  ,
  
  /*********
    
    Changes a password given a clear text existing one and a new password. You must
    set your tokens based on this new .
    
    @token : User Token
    @encryptionToken : Encryption token (if one exists)
    @existingPassword : existing password - must match database
    @newPassword : A new valid password
    
    returns : A user with new credentials
    
  *********/
  changePassword: function(token,encryptionToken,existingPassword,newPassword,cb) 
  {
    var msg = new XMLRPCMessage( "changePassword" , null);
    msg.addParameter(token);
    msg.addParameter(encryptionToken);
    msg.addParameter(existingPassword);
    msg.addParameter(newPassword);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  changePasswordForm:function ( cb ) 
  {
    this.changePassword(V('token','String'),V('encryptionToken','String'),V('existingPassword','String'),V('newPassword','String'),cb);		          
  }

}
var ezpSecuritySdk = new ezpSecurity();



 
var ezpRegistration = Class.create();
ezpRegistration.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.registration.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  
  /*********
    
    Returns the countries for a brand
    
    @BrandId : Assigned by EZPrints
    
    returns : CountryList list of countries
    
  *********/
  getCountriesForBrand: function(BrandId,cb) 
  {
    var msg = new XMLRPCMessage( "getCountriesForBrand" , null);
    msg.addParameter(BrandId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCountriesForBrandForm:function ( cb ) 
  {
    this.getCountriesForBrand(V('BrandId','Int32'),cb);		          
  }

  ,
  
  /*********
    
    Returns the contact information for a given account
    
    @Token : The token returned from the Security login method
    
    returns : RegistrationContact
    
  *********/
  getContact: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getContact" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getContactForm:function ( cb ) 
  {
    this.getContact(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
     Adds a new address to the RegAddress table in the database.
     
    @token : The token for the current user session.
    @sAddress1 : The required address field.
    @sAddress2 : The optional address field.
    @sCity : The city of the address.
    @sStateProvince : The state of the address.
    @sCountry : The user's country.
    @sPostalCode : The postal code of the user's address.
    @bVerified : Whether or not the user has been verified.
    
    returns : 
     Long of the address added.
     
    
  *********/
  addAddress: function(token,sAddress1,sAddress2,sCity,sStateProvince,sCountry,sPostalCode,bVerified,cb) 
  {
    var msg = new XMLRPCMessage( "addAddress" , null);
    msg.addParameter(token);
    msg.addParameter(sAddress1);
    msg.addParameter(sAddress2);
    msg.addParameter(sCity);
    msg.addParameter(sStateProvince);
    msg.addParameter(sCountry);
    msg.addParameter(sPostalCode);
    msg.addParameter(bVerified);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addAddressForm:function ( cb ) 
  {
    this.addAddress(V('token','String'),V('sAddress1','String'),V('sAddress2','String'),V('sCity','String'),V('sStateProvince','String'),V('sCountry','String'),V('sPostalCode','String'),V('bVerified','Boolean'),cb);		          
  }

  ,
  
  /*********
    
    Adds a new managed address to the curret user's account.
    
    @sToken : The user's session token.
    @sAddressLabel : The label given to this account.
    @sFirstname : The user's firstname.
    @sLastname : This user's lastname.
    @sAddress1 : The first line of the address.
    @sAddress2 : The second line of the address.
    @sCity : The address' city.
    @sStateProvince : The address' state.
    @sCountry : The address' country.
    @sPostalCode : The address' zip.
    @sEmailAddress : The user's email address.
    @bEmailConfirmed : Whether or not the email address has been confirmed.
    @sPhoneNumber : The user's phone number.
    @bVerified : 
    
    returns : The address ID.
    
  *********/
  RegAddressAddAddressExtra: function(sToken,sAddressLabel,sFirstname,sLastname,sAddress1,sAddress2,sCity,sStateProvince,sCountry,sPostalCode,sEmailAddress,bEmailConfirmed,sPhoneNumber,bVerified,cb) 
  {
    var msg = new XMLRPCMessage( "RegAddressAddAddressExtra" , null);
    msg.addParameter(sToken);
    msg.addParameter(sAddressLabel);
    msg.addParameter(sFirstname);
    msg.addParameter(sLastname);
    msg.addParameter(sAddress1);
    msg.addParameter(sAddress2);
    msg.addParameter(sCity);
    msg.addParameter(sStateProvince);
    msg.addParameter(sCountry);
    msg.addParameter(sPostalCode);
    msg.addParameter(sEmailAddress);
    msg.addParameter(bEmailConfirmed);
    msg.addParameter(sPhoneNumber);
    msg.addParameter(bVerified);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  RegAddressAddAddressExtraForm:function ( cb ) 
  {
    this.RegAddressAddAddressExtra(V('sToken','String'),V('sAddressLabel','String'),V('sFirstname','String'),V('sLastname','String'),V('sAddress1','String'),V('sAddress2','String'),V('sCity','String'),V('sStateProvince','String'),V('sCountry','String'),V('sPostalCode','String'),V('sEmailAddress','String'),V('bEmailConfirmed','Boolean'),V('sPhoneNumber','String'),V('bVerified','Boolean'),cb);		          
  }

  ,
  
  /*********
    
    Adds a user to the EZPrints system.
    
    @BrandId : 
    @UserName : 
    @Password : 
    @CustomerID : 
    @FirstName : 
    @LastName : 
    @Email : 
    @PhoneNumber : 
    @EULA : 
    @EmailConfirmed : 
    @MarketingOptIn : 
    @ShippingAddress1 : 
    @ShippingAddress2 : 
    @ShippingCity : 
    @ShippingStateProvince : 
    @ShippingPostalCode : 
    @ShippingCountry : 
    @ShippingVerified : 
    @BillingSameAsShipping : 
    @BillingAddress1 : 
    @BillingAddress2 : 
    @BillingCity : 
    @BillingStateProvince : 
    @BillingPostalCode : 
    @BillingCountry : 
    @BillingVerified : 
    
    returns : RegistrationContact
    
  *********/
  addContact: function(BrandId,UserName,Password,CustomerID,FirstName,LastName,Email,PhoneNumber,EULA,EmailConfirmed,MarketingOptIn,ShippingAddress1,ShippingAddress2,ShippingCity,ShippingStateProvince,ShippingPostalCode,ShippingCountry,ShippingVerified,BillingSameAsShipping,BillingAddress1,BillingAddress2,BillingCity,BillingStateProvince,BillingPostalCode,BillingCountry,BillingVerified,cb) 
  {
    var msg = new XMLRPCMessage( "addContact" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(Password);
    msg.addParameter(CustomerID);
    msg.addParameter(FirstName);
    msg.addParameter(LastName);
    msg.addParameter(Email);
    msg.addParameter(PhoneNumber);
    msg.addParameter(EULA);
    msg.addParameter(EmailConfirmed);
    msg.addParameter(MarketingOptIn);
    msg.addParameter(ShippingAddress1);
    msg.addParameter(ShippingAddress2);
    msg.addParameter(ShippingCity);
    msg.addParameter(ShippingStateProvince);
    msg.addParameter(ShippingPostalCode);
    msg.addParameter(ShippingCountry);
    msg.addParameter(ShippingVerified);
    msg.addParameter(BillingSameAsShipping);
    msg.addParameter(BillingAddress1);
    msg.addParameter(BillingAddress2);
    msg.addParameter(BillingCity);
    msg.addParameter(BillingStateProvince);
    msg.addParameter(BillingPostalCode);
    msg.addParameter(BillingCountry);
    msg.addParameter(BillingVerified);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addContactForm:function ( cb ) 
  {
    this.addContact(V('BrandId','Int32'),V('UserName','String'),V('Password','String'),V('CustomerID','String'),V('FirstName','String'),V('LastName','String'),V('Email','String'),V('PhoneNumber','String'),V('EULA','Boolean'),V('EmailConfirmed','Boolean'),V('MarketingOptIn','Boolean'),V('ShippingAddress1','String'),V('ShippingAddress2','String'),V('ShippingCity','String'),V('ShippingStateProvince','String'),V('ShippingPostalCode','String'),V('ShippingCountry','String'),V('ShippingVerified','Boolean'),V('BillingSameAsShipping','Boolean'),V('BillingAddress1','String'),V('BillingAddress2','String'),V('BillingCity','String'),V('BillingStateProvince','String'),V('BillingPostalCode','String'),V('BillingCountry','String'),V('BillingVerified','Boolean'),cb);		          
  }

  ,
  
  /*********
    
    Adds a user to the EZPrints system.
    
    @BrandId : 
    @UserName : 
    @Password : 
    @CustomerID : 
    @FirstName : 
    @LastName : 
    @Email : 
    @PhoneNumber : 
    @EULA : 
    @EmailConfirmed : 
    @MarketingOptIn : 
    @ShippingAddress1 : 
    @ShippingAddress2 : 
    @ShippingCity : 
    @ShippingStateProvince : 
    @ShippingPostalCode : 
    @ShippingCountry : 
    @ShippingVerified : 
    @BillingSameAsShipping : 
    @BillingAddress1 : 
    @BillingAddress2 : 
    @BillingCity : 
    @BillingStateProvince : 
    @BillingPostalCode : 
    @BillingCountry : 
    @BillingVerified : 
    
    returns : RegistrationContact
    
  *********/
  addContact: function(Token,FirstName,LastName,CustomerID,Email,PhoneNumber,Address1,Address2,City,StateProvince,PostalCode,country,cb) 
  {
    var msg = new XMLRPCMessage( "addContact" , null);
    msg.addParameter(Token);
    msg.addParameter(FirstName);
    msg.addParameter(LastName);
    msg.addParameter(CustomerID);
    msg.addParameter(Email);
    msg.addParameter(PhoneNumber);
    msg.addParameter(Address1);
    msg.addParameter(Address2);
    msg.addParameter(City);
    msg.addParameter(StateProvince);
    msg.addParameter(PostalCode);
    msg.addParameter(country);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addContactForm:function ( cb ) 
  {
    this.addContact(V('Token','String'),V('FirstName','String'),V('LastName','String'),V('CustomerID','String'),V('Email','String'),V('PhoneNumber','String'),V('Address1','String'),V('Address2','String'),V('City','String'),V('StateProvince','String'),V('PostalCode','String'),V('country','String'),cb);		          
  }

  ,
  
  /*********
    
    Updates the contact information for a given user
    
    @Token : The token returned from the Security login method
    @CustomerID : 
    @FirstName : 
    @LastName : 
    @Email : 
    @PhoneNumber : 
    @EULA : 
    @EmailConfirmed : 
    @MarketingOptIn : 
    @ShippingAddress1 : 
    @ShippingAddress2 : 
    @ShippingCity : 
    @ShippingStateProvince : 
    @ShippingPostalCode : 
    @ShippingCountry : 
    @ShippingVerified : 
    @BillingSameAsShipping : 
    @BillingAddress1 : 
    @BillingAddress2 : 
    @BillingCity : 
    @BillingStateProvince : 
    @BillingPostalCode : 
    @BillingCountry : 
    @BillingVerified : 
    
    returns : RegistrationContact
    
  *********/
  updateContact: function(Token,CustomerID,FirstName,LastName,Email,PhoneNumber,EULA,EmailConfirmed,MarketingOptIn,ShippingAddress1,ShippingAddress2,ShippingCity,ShippingStateProvince,ShippingPostalCode,ShippingCountry,ShippingVerified,BillingSameAsShipping,BillingAddress1,BillingAddress2,BillingCity,BillingStateProvince,BillingPostalCode,BillingCountry,BillingVerified,cb) 
  {
    var msg = new XMLRPCMessage( "updateContact" , null);
    msg.addParameter(Token);
    msg.addParameter(CustomerID);
    msg.addParameter(FirstName);
    msg.addParameter(LastName);
    msg.addParameter(Email);
    msg.addParameter(PhoneNumber);
    msg.addParameter(EULA);
    msg.addParameter(EmailConfirmed);
    msg.addParameter(MarketingOptIn);
    msg.addParameter(ShippingAddress1);
    msg.addParameter(ShippingAddress2);
    msg.addParameter(ShippingCity);
    msg.addParameter(ShippingStateProvince);
    msg.addParameter(ShippingPostalCode);
    msg.addParameter(ShippingCountry);
    msg.addParameter(ShippingVerified);
    msg.addParameter(BillingSameAsShipping);
    msg.addParameter(BillingAddress1);
    msg.addParameter(BillingAddress2);
    msg.addParameter(BillingCity);
    msg.addParameter(BillingStateProvince);
    msg.addParameter(BillingPostalCode);
    msg.addParameter(BillingCountry);
    msg.addParameter(BillingVerified);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  updateContactForm:function ( cb ) 
  {
    this.updateContact(V('Token','String'),V('CustomerID','String'),V('FirstName','String'),V('LastName','String'),V('Email','String'),V('PhoneNumber','String'),V('EULA','Boolean'),V('EmailConfirmed','Boolean'),V('MarketingOptIn','Boolean'),V('ShippingAddress1','String'),V('ShippingAddress2','String'),V('ShippingCity','String'),V('ShippingStateProvince','String'),V('ShippingPostalCode','String'),V('ShippingCountry','String'),V('ShippingVerified','Boolean'),V('BillingSameAsShipping','Boolean'),V('BillingAddress1','String'),V('BillingAddress2','String'),V('BillingCity','String'),V('BillingStateProvince','String'),V('BillingPostalCode','String'),V('BillingCountry','String'),V('BillingVerified','Boolean'),cb);		          
  }

  ,
  
  /*********
    
    This method updates the address with which the user is currently working with.
    
    @sToken : The token for the current session.
    @sAddressID : The address ID of the address to update.
    @sFirstname : The address' first name.
    @sLastname : The address' last name.
    @sAddress1 : The first line of the address.
    @sAddress2 : The second line of the address.
    @sCity : The city of the address.
    @sState : The state of the address.
    @sCountry : The country of the address.
    @sZip : The postal code of the address.
    @sEmail : The user's email address.
    @bEmailConfirmed : Whether or not the email address is confirmed
    @sPhone : The phone number for the address.
    @bVerified : Whether or not the address is verified.
    @sAddressLabel : The label by which this address is identified.
    
    returns : Address ID
    
  *********/
  RegAddressUpdateExtra: function(sToken,sAddressID,sFirstname,sLastname,sAddress1,sAddress2,sCity,sState,sCountry,sZip,sEmail,bEmailConfirmed,sPhone,bVerified,sAddressLabel,cb) 
  {
    var msg = new XMLRPCMessage( "RegAddressUpdateExtra" , null);
    msg.addParameter(sToken);
    msg.addParameter(sAddressID);
    msg.addParameter(sFirstname);
    msg.addParameter(sLastname);
    msg.addParameter(sAddress1);
    msg.addParameter(sAddress2);
    msg.addParameter(sCity);
    msg.addParameter(sState);
    msg.addParameter(sCountry);
    msg.addParameter(sZip);
    msg.addParameter(sEmail);
    msg.addParameter(bEmailConfirmed);
    msg.addParameter(sPhone);
    msg.addParameter(bVerified);
    msg.addParameter(sAddressLabel);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  RegAddressUpdateExtraForm:function ( cb ) 
  {
    this.RegAddressUpdateExtra(V('sToken','String'),V('sAddressID','String'),V('sFirstname','String'),V('sLastname','String'),V('sAddress1','String'),V('sAddress2','String'),V('sCity','String'),V('sState','String'),V('sCountry','String'),V('sZip','String'),V('sEmail','String'),V('bEmailConfirmed','Boolean'),V('sPhone','String'),V('bVerified','Boolean'),V('sAddressLabel','String'),cb);		          
  }

  ,
  
  /*********
    
    Deletes the address identified by the specified addressID.
    
    @sToken : The token for the current user's session.
    @sAddressID : The ID of the address to delete.
    
    returns :  Whether or not the address was deleted successfully.
    
  *********/
  RegAddressDeleteExtra: function(sToken,sAddressID,cb) 
  {
    var msg = new XMLRPCMessage( "RegAddressDeleteExtra" , null);
    msg.addParameter(sToken);
    msg.addParameter(sAddressID);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  RegAddressDeleteExtraForm:function ( cb ) 
  {
    this.RegAddressDeleteExtra(V('sToken','String'),V('sAddressID','String'),cb);		          
  }

}
var ezpRegistrationSdk = new ezpRegistration();



 
var ezpSession = Class.create();
ezpSession.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.session.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  
  /*********
    
    Saves session data associated with a session.  The data will be removed upon logout.
    
    @Token : The token returned from the Security login method
    @Name : A name to associate with the data.  May be passed to . 
    @Data : 
    
    returns : the name used to identify the dataData not Saved
    
  *********/
  saveData: function(Token,Name,Data,cb) 
  {
    var msg = new XMLRPCMessage( "saveData" , null);
    msg.addParameter(Token);
    msg.addParameter(Name);
    msg.addParameter(Data);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveDataForm:function ( cb ) 
  {
    this.saveData(V('Token','String'),V('Name','String'),V('Data','String'),cb);		          
  }

  ,
  
  /*********
    
    Saves data associated with a user.  The data will not be removed upon logout.
    
    @Token : The token returned from the Security login method
    @Name : A name to associate with the data.  May be passed to . 
    @Data : 
    
    returns : a key used to identify the datumData not Saved
    
  *********/
  savePersistentData: function(Token,Name,Data,cb) 
  {
    var msg = new XMLRPCMessage( "savePersistentData" , null);
    msg.addParameter(Token);
    msg.addParameter(Name);
    msg.addParameter(Data);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  savePersistentDataForm:function ( cb ) 
  {
    this.savePersistentData(V('Token','String'),V('Name','String'),V('Data','String'),cb);		          
  }

  ,
  
  /*********
    
    Removes session data.  The data will be removed upon logout.
    
    @Token : The token returned from the Security login method
    @Name : A name associated with the data.
    
    returns : true indicates the data were removed
    
  *********/
  removeData: function(Token,Name,cb) 
  {
    var msg = new XMLRPCMessage( "removeData" , null);
    msg.addParameter(Token);
    msg.addParameter(Name);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  removeDataForm:function ( cb ) 
  {
    this.removeData(V('Token','String'),V('Name','String'),cb);		          
  }

  ,
  
  /*********
    
    Retrieves session data.
    
    @Token : The token returned from the Security login method
    @Name : A name associated with the data.
    
    returns : true indicates the data were removed
    
  *********/
  getData: function(Token,Name,cb) 
  {
    var msg = new XMLRPCMessage( "getData" , null);
    msg.addParameter(Token);
    msg.addParameter(Name);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getDataForm:function ( cb ) 
  {
    this.getData(V('Token','String'),V('Name','String'),cb);		          
  }

}
var ezpSessionSdk = new ezpSession();




/*
 *  This API abstracts away the handling of resources and resource caching from the user.
 */
 
var ezpResource = Class.create();
ezpResource.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.resource.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  getImageResized: function(uri,maxSize,cb) 
  {
    var msg = new XMLRPCMessage( "getImageResized" , null);
    msg.addParameter(uri);
    msg.addParameter(maxSize);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getImageResizedForm:function ( cb ) 
  {
    this.getImageResized(V('uri','String'),V('maxSize','Int32'),cb);		          
  }

  ,
  getImageOrientation: function(uri,cb) 
  {
    var msg = new XMLRPCMessage( "getImageOrientation" , null);
    msg.addParameter(uri);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getImageOrientationForm:function ( cb ) 
  {
    this.getImageOrientation(V('uri','String'),cb);		          
  }

  ,
  getImage: function(uri,cb) 
  {
    var msg = new XMLRPCMessage( "getImage" , null);
    msg.addParameter(uri);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getImageForm:function ( cb ) 
  {
    this.getImage(V('uri','String'),cb);		          
  }

}
var ezpResourceSdk = new ezpResource();



 
var ezpJcm = Class.create();
ezpJcm.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.jcm.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  
  /*********
    
    This returns a collection of PhotoPasses for a given account
    
    @Token : The token returned from the Security login method
    
    returns : A collection of PhotoPasses
    
  *********/
  photoPassGet: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "photoPassGet" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  photoPassGetForm:function ( cb ) 
  {
    this.photoPassGet(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    This removes all photopasses for an account
    
    @Token : The security token of the account
    
    returns : true the photopass can be assigned, false it cannot
    
  *********/
  removeAccountImages: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "removeAccountImages" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  removeAccountImagesForm:function ( cb ) 
  {
    this.removeAccountImages(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    This removes a photopass from its account
    
    @PhotoPass : The photo pass to be removed
    
    returns : true the photopass can be assigned, false it cannot
    
  *********/
  removePhotoPass: function(PhotoPass,cb) 
  {
    var msg = new XMLRPCMessage( "removePhotoPass" , null);
    msg.addParameter(PhotoPass);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  removePhotoPassForm:function ( cb ) 
  {
    this.removePhotoPass(V('PhotoPass','String'),cb);		          
  }

  ,
  
  /*********
    
    This returns a list of valid assets
    
    @LocationCode : The location of the image
    
    returns : true the photopass can be assigned, false it cannot
    
  *********/
  assetList: function(LocationCode,cb) 
  {
    var msg = new XMLRPCMessage( "assetList" , null);
    msg.addParameter(LocationCode);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  assetListForm:function ( cb ) 
  {
    this.assetList(V('LocationCode','String'),cb);		          
  }

  ,
  
  /*********
    
    This determines whether or not the photopass is valid and available to be used
    
    @PhotoPass : The photo pass to be validated
    
    returns : true the photopass can be assigned, false it cannot
    
  *********/
  validPhotoPass: function(PhotoPass,cb) 
  {
    var msg = new XMLRPCMessage( "validPhotoPass" , null);
    msg.addParameter(PhotoPass);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  validPhotoPassForm:function ( cb ) 
  {
    this.validPhotoPass(V('PhotoPass','String'),cb);		          
  }

  ,
  
  /*********
    
    pingAccount is used to establish a user session with the system.  
    
    @Token : The token returned from loginDisney.
    
    returns : True if it succeeds.logOff
    
  *********/
  pingAccount: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "pingAccount" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  pingAccountForm:function ( cb ) 
  {
    this.pingAccount(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    login is used to establish a user session with the system.  
    
    @BrandId : The brand id.
    @UserName : User login.
    @Password : Clear text password typed in by the user
    
    returns : string Token - This string is used in all subsequent calls to the system to identify the user session.Thrown for the following:
    Invalid UserInvalid PasswordlogOff
    
  *********/
  loginDisney: function(BrandId,UserName,Password,cb) 
  {
    var msg = new XMLRPCMessage( "loginDisney" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(Password);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  loginDisneyForm:function ( cb ) 
  {
    this.loginDisney(V('BrandId','String'),V('UserName','String'),V('Password','String'),cb);		          
  }

  ,
  
  /*********
    
    This sets the user password to a random value and triggers an eMail to be sent to the user with the new password.
    
    @BrandId : This is the EZPrints assigned brand id.  See your EZPrints representative to determine your brand id.
    @UserName : This is the user id to verify. This is not case sensitive
    @FirstName : This is the First Name associated with the user.  This is not case sensitive
    
    returns : ReturnDescriptiontrueThe password has been resetfalseThe password could not be reset
    
  *********/
  resetDisneyPassword: function(BrandId,UserName,FirstName,cb) 
  {
    var msg = new XMLRPCMessage( "resetDisneyPassword" , null);
    msg.addParameter(BrandId);
    msg.addParameter(UserName);
    msg.addParameter(FirstName);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  resetDisneyPasswordForm:function ( cb ) 
  {
    this.resetDisneyPassword(V('BrandId','Int32'),V('UserName','String'),V('FirstName','String'),cb);		          
  }

  ,
  
  /*********
    
    logOff is used to end a session with the system.
    All session related data is removed from the system.
    login
    @Token : This is the token returned from login
    
    returns : true if the user is logged off, false if not.
    
  *********/
  logOffDisney: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "logOffDisney" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  logOffDisneyForm:function ( cb ) 
  {
    this.logOffDisney(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    Adds a share account to be used for a shopping cart
    
    @BrandId : 
    @AccountId : 
    
    returns : 
    
  *********/
  addDisneyContactGuest: function(BrandId,AccountId,cb) 
  {
    var msg = new XMLRPCMessage( "addDisneyContactGuest" , null);
    msg.addParameter(BrandId);
    msg.addParameter(AccountId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addDisneyContactGuestForm:function ( cb ) 
  {
    this.addDisneyContactGuest(V('BrandId','Int32'),V('AccountId','String'),cb);		          
  }

  ,
  
  /*********
    
    Adds a share account to be used for a shopping cart
    
    @BrandId : 
    @AccountId : 
    
    returns : 
    
  *********/
  addDisneyContact: function(BrandId,Password,FirstName,LastName,Email,PhoneNumber,EULA,EmailConfirmed,MarketingOptIn,ShippingAddress1,ShippingAddress2,ShippingCity,ShippingStateProvince,ShippingPostalCode,ShippingCountry,ShippingVerified,BillingSameAsShipping,BillingAddress1,BillingAddress2,BillingCity,BillingStateProvince,BillingPostalCode,BillingCountry,BillingVerified,PhotoPass,cb) 
  {
    var msg = new XMLRPCMessage( "addDisneyContact" , null);
    msg.addParameter(BrandId);
    msg.addParameter(Password);
    msg.addParameter(FirstName);
    msg.addParameter(LastName);
    msg.addParameter(Email);
    msg.addParameter(PhoneNumber);
    msg.addParameter(EULA);
    msg.addParameter(EmailConfirmed);
    msg.addParameter(MarketingOptIn);
    msg.addParameter(ShippingAddress1);
    msg.addParameter(ShippingAddress2);
    msg.addParameter(ShippingCity);
    msg.addParameter(ShippingStateProvince);
    msg.addParameter(ShippingPostalCode);
    msg.addParameter(ShippingCountry);
    msg.addParameter(ShippingVerified);
    msg.addParameter(BillingSameAsShipping);
    msg.addParameter(BillingAddress1);
    msg.addParameter(BillingAddress2);
    msg.addParameter(BillingCity);
    msg.addParameter(BillingStateProvince);
    msg.addParameter(BillingPostalCode);
    msg.addParameter(BillingCountry);
    msg.addParameter(BillingVerified);
    msg.addParameter(PhotoPass);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addDisneyContactForm:function ( cb ) 
  {
    this.addDisneyContact(V('BrandId','Int32'),V('Password','String'),V('FirstName','String'),V('LastName','String'),V('Email','String'),V('PhoneNumber','String'),V('EULA','Boolean'),V('EmailConfirmed','Boolean'),V('MarketingOptIn','Boolean'),V('ShippingAddress1','String'),V('ShippingAddress2','String'),V('ShippingCity','String'),V('ShippingStateProvince','String'),V('ShippingPostalCode','String'),V('ShippingCountry','String'),V('ShippingVerified','Boolean'),V('BillingSameAsShipping','Boolean'),V('BillingAddress1','String'),V('BillingAddress2','String'),V('BillingCity','String'),V('BillingStateProvince','String'),V('BillingPostalCode','String'),V('BillingCountry','String'),V('BillingVerified','Boolean'),V('PhotoPass','String'),cb);		          
  }

  ,
  
  /*********
    
    This associates a PhotoPass with an existing account
    
    @Token : The token returned from the Security login method
    @PhotoPass : 
    
    returns : true if the account was associated.
    
  *********/
  addPhotoPassToAccount: function(Token,PhotoPass,cb) 
  {
    var msg = new XMLRPCMessage( "addPhotoPassToAccount" , null);
    msg.addParameter(Token);
    msg.addParameter(PhotoPass);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addPhotoPassToAccountForm:function ( cb ) 
  {
    this.addPhotoPassToAccount(V('Token','String'),V('PhotoPass','String'),cb);		          
  }

  ,
  
  /*********
    
    Updates the contact information for a given user
    
    @Token : The token returned from the Security login method
    @FirstName : 
    @LastName : 
    @Email : 
    @PhoneNumber : 
    @EULA : 
    @EmailConfirmed : 
    @MarketingOptIn : 
    @ShippingAddress1 : 
    @ShippingAddress2 : 
    @ShippingCity : 
    @ShippingStateProvince : 
    @ShippingPostalCode : 
    @ShippingCountry : 
    @ShippingVerified : 
    @BillingSameAsShipping : 
    @BillingAddress1 : 
    @BillingAddress2 : 
    @BillingCity : 
    @BillingStateProvince : 
    @BillingPostalCode : 
    @BillingCountry : 
    @BillingVerified : 
    
    returns : RegistrationContact
    
  *********/
  updateDisneyContact: function(Token,FirstName,LastName,Email,PhoneNumber,EULA,EmailConfirmed,MarketingOptIn,ShippingAddress1,ShippingAddress2,ShippingCity,ShippingStateProvince,ShippingPostalCode,ShippingCountry,ShippingVerified,BillingSameAsShipping,BillingAddress1,BillingAddress2,BillingCity,BillingStateProvince,BillingPostalCode,BillingCountry,BillingVerified,cb) 
  {
    var msg = new XMLRPCMessage( "updateDisneyContact" , null);
    msg.addParameter(Token);
    msg.addParameter(FirstName);
    msg.addParameter(LastName);
    msg.addParameter(Email);
    msg.addParameter(PhoneNumber);
    msg.addParameter(EULA);
    msg.addParameter(EmailConfirmed);
    msg.addParameter(MarketingOptIn);
    msg.addParameter(ShippingAddress1);
    msg.addParameter(ShippingAddress2);
    msg.addParameter(ShippingCity);
    msg.addParameter(ShippingStateProvince);
    msg.addParameter(ShippingPostalCode);
    msg.addParameter(ShippingCountry);
    msg.addParameter(ShippingVerified);
    msg.addParameter(BillingSameAsShipping);
    msg.addParameter(BillingAddress1);
    msg.addParameter(BillingAddress2);
    msg.addParameter(BillingCity);
    msg.addParameter(BillingStateProvince);
    msg.addParameter(BillingPostalCode);
    msg.addParameter(BillingCountry);
    msg.addParameter(BillingVerified);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  updateDisneyContactForm:function ( cb ) 
  {
    this.updateDisneyContact(V('Token','String'),V('FirstName','String'),V('LastName','String'),V('Email','String'),V('PhoneNumber','String'),V('EULA','Boolean'),V('EmailConfirmed','Boolean'),V('MarketingOptIn','Boolean'),V('ShippingAddress1','String'),V('ShippingAddress2','String'),V('ShippingCity','String'),V('ShippingStateProvince','String'),V('ShippingPostalCode','String'),V('ShippingCountry','String'),V('ShippingVerified','Boolean'),V('BillingSameAsShipping','Boolean'),V('BillingAddress1','String'),V('BillingAddress2','String'),V('BillingCity','String'),V('BillingStateProvince','String'),V('BillingPostalCode','String'),V('BillingCountry','String'),V('BillingVerified','Boolean'),cb);		          
  }

  ,
  
  /*********
    
    Uploads an image to the JCM service and associates it with the account
    
    @Token : The token returned from the Security login method
    @sLocation : The URI to the requested image
    
    returns : ImageInfo
    
  *********/
  imageUpload: function(Token,sLocation,cb) 
  {
    var msg = new XMLRPCMessage( "imageUpload" , null);
    msg.addParameter(Token);
    msg.addParameter(sLocation);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imageUploadForm:function ( cb ) 
  {
    this.imageUpload(V('Token','String'),V('sLocation','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns the list of images associated with an account.
    
    @AccountId : The guest account id
    @Type : STOCK, PROFESSIONAL, Uploaded
    
    returns : List of Images
    
  *********/
  imagesGetGuest: function(AccountId,Type,cb) 
  {
    var msg = new XMLRPCMessage( "imagesGetGuest" , null);
    msg.addParameter(AccountId);
    msg.addParameter(Type);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imagesGetGuestForm:function ( cb ) 
  {
    this.imagesGetGuest(V('AccountId','String'),V('Type','String'),cb);		          
  }

  ,
  imageDetails: function(Token,imageId,cb) 
  {
    var msg = new XMLRPCMessage( "imageDetails" , null);
    msg.addParameter(Token);
    msg.addParameter(imageId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imageDetailsForm:function ( cb ) 
  {
    this.imageDetails(V('Token','String'),V('imageId','String'),cb);		          
  }

  ,
  imageDelete: function(Token,imageId,cb) 
  {
    var msg = new XMLRPCMessage( "imageDelete" , null);
    msg.addParameter(Token);
    msg.addParameter(imageId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imageDeleteForm:function ( cb ) 
  {
    this.imageDelete(V('Token','String'),V('imageId','String'),cb);		          
  }

  ,
  
  /*********
    
    Allows the user to edit an image
    
    @Token : Secrity Token
    @BaseImageId : If this is a new image, please pass the base image id
    @ExistingImageId : If this is an existing image, pass the existing image id
    @Rotation :  Clockwise270,Clockwise180,Clockwise90,None
    @OverlayId : The asset ID of the bug or border
    @Orientation : Portrait,Landscape
    @CropX : The X offset from the rotated origin of the image
    @CropY : The Y offset from the rotated origin of the image
    @CropWidthPercent : The percent of the rotated width of the image  1.0 = 100%
    @CropAspectRatio : EightByTen,FiveBySeven,FourBySix
    
    returns : ImageInfo
    
  *********/
  imageEdit: function(Token,BaseImageId,ExistingImageId,Rotation,OverlayId,Orientation,CropX,CropY,CropWidthPercent,CropAspectRatio,cb) 
  {
    var msg = new XMLRPCMessage( "imageEdit" , null);
    msg.addParameter(Token);
    msg.addParameter(BaseImageId);
    msg.addParameter(ExistingImageId);
    msg.addParameter(Rotation);
    msg.addParameter(OverlayId);
    msg.addParameter(Orientation);
    msg.addParameter(CropX);
    msg.addParameter(CropY);
    msg.addParameter(CropWidthPercent);
    msg.addParameter(CropAspectRatio);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imageEditForm:function ( cb ) 
  {
    this.imageEdit(V('Token','String'),V('BaseImageId','String'),V('ExistingImageId','String'),V('Rotation','String'),V('OverlayId','String'),V('Orientation','String'),V('CropX','String'),V('CropY','String'),V('CropWidthPercent','String'),V('CropAspectRatio','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns the list of images associated with an account.
    
    @AccountId : The guest account id
    @Type : STOCK, PROFESSIONAL, Uploaded
    
    returns : List of Images
    
  *********/
  imagesGet: function(Token,Type,cb) 
  {
    var msg = new XMLRPCMessage( "imagesGet" , null);
    msg.addParameter(Token);
    msg.addParameter(Type);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imagesGetForm:function ( cb ) 
  {
    this.imagesGet(V('Token','String'),V('Type','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns the list of images associated with an account.
    
    @Token : The token returned from the Security login method
    @Type : STOCK, PROFESSIONAL, Uploaded
    
    returns : List of Images
    
  *********/
  imagesCache: function(Token,Type,cb) 
  {
    var msg = new XMLRPCMessage( "imagesCache" , null);
    msg.addParameter(Token);
    msg.addParameter(Type);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  imagesCacheForm:function ( cb ) 
  {
    this.imagesCache(V('Token','String'),V('Type','String'),cb);		          
  }

}
var ezpJcmSdk = new ezpJcm();




/*
 *  Contains all tasks related to configurators.
 */
 
var ezpConfigurators = Class.create();
ezpConfigurators.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.configurators.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  postData: function(token,data,url,cb) 
  {
    var msg = new XMLRPCMessage( "postData" , null);
    msg.addParameter(token);
    msg.addParameter(data);
    msg.addParameter(url);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  postDataForm:function ( cb ) 
  {
    this.postData(V('token','String'),V('data','String'),V('url','String'),cb);		          
  }

  ,
  getTemplatesByTags: function(sku,orientation,tags,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplatesByTags" , null);
    msg.addParameter(sku);
    msg.addParameter(orientation);
    msg.addParameter(tags);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplatesByTagsForm:function ( cb ) 
  {
    this.getTemplatesByTags(V('sku','String'),V('orientation','String'),V('tags','String[]'),cb);		          
  }

  ,
  getTemplateThumbsByTags: function(sku,orientation,tags,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplateThumbsByTags" , null);
    msg.addParameter(sku);
    msg.addParameter(orientation);
    msg.addParameter(tags);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplateThumbsByTagsForm:function ( cb ) 
  {
    this.getTemplateThumbsByTags(V('sku','String'),V('orientation','String'),V('tags','String[]'),cb);		          
  }

  ,
  GetHolidaysByTagsWithinRange: function(tags,startDate,numberOfMonths,cb) 
  {
    var msg = new XMLRPCMessage( "GetHolidaysByTagsWithinRange" , null);
    msg.addParameter(tags);
    msg.addParameter(startDate);
    msg.addParameter(numberOfMonths);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  GetHolidaysByTagsWithinRangeForm:function ( cb ) 
  {
    this.GetHolidaysByTagsWithinRange(V('tags','String[]'),V('startDate','String'),V('numberOfMonths','Int32'),cb);		          
  }

  ,
  getPageThumbsByTemplateId: function(sku,templateId,cb) 
  {
    var msg = new XMLRPCMessage( "getPageThumbsByTemplateId" , null);
    msg.addParameter(sku);
    msg.addParameter(templateId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPageThumbsByTemplateIdForm:function ( cb ) 
  {
    this.getPageThumbsByTemplateId(V('sku','String'),V('templateId','String'),cb);		          
  }

  ,
  getTemplateById: function(sku,templateId,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplateById" , null);
    msg.addParameter(sku);
    msg.addParameter(templateId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplateByIdForm:function ( cb ) 
  {
    this.getTemplateById(V('sku','String'),V('templateId','String'),cb);		          
  }

  ,
  getPageByTemplateIdByPageId: function(sku,templateId,pageId,cb) 
  {
    var msg = new XMLRPCMessage( "getPageByTemplateIdByPageId" , null);
    msg.addParameter(sku);
    msg.addParameter(templateId);
    msg.addParameter(pageId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getPageByTemplateIdByPageIdForm:function ( cb ) 
  {
    this.getPageByTemplateIdByPageId(V('sku','String'),V('templateId','String'),V('pageId','String'),cb);		          
  }

  ,
  getTemplateCategories: function(sku,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplateCategories" , null);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplateCategoriesForm:function ( cb ) 
  {
    this.getTemplateCategories(V('sku','String'),cb);		          
  }

  ,
  getTemplateFontNames: function(sku,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplateFontNames" , null);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplateFontNamesForm:function ( cb ) 
  {
    this.getTemplateFontNames(V('sku','String'),cb);		          
  }

  ,
  getTemplateFontData: function(sku,cb) 
  {
    var msg = new XMLRPCMessage( "getTemplateFontData" , null);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getTemplateFontDataForm:function ( cb ) 
  {
    this.getTemplateFontData(V('sku','String'),cb);		          
  }

  ,
  postProduct: function(token,key,url,cb) 
  {
    var msg = new XMLRPCMessage( "postProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(url);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  postProductForm:function ( cb ) 
  {
    this.postProduct(V('token','String'),V('key','String'),V('url','String'),cb);		          
  }

  ,
  postProductAndClose: function(token,key,url,cb) 
  {
    var msg = new XMLRPCMessage( "postProductAndClose" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(url);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  postProductAndCloseForm:function ( cb ) 
  {
    this.postProductAndClose(V('token','String'),V('key','String'),V('url','String'),cb);		          
  }

  ,
  closeProduct: function(token,key,cb) 
  {
    var msg = new XMLRPCMessage( "closeProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  closeProductForm:function ( cb ) 
  {
    this.closeProduct(V('token','String'),V('key','String'),cb);		          
  }

  ,
  productClosed: function(token,key,cb) 
  {
    var msg = new XMLRPCMessage( "productClosed" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  productClosedForm:function ( cb ) 
  {
    this.productClosed(V('token','String'),V('key','String'),cb);		          
  }

  ,
  getProduct: function(token,key,sku,cb) 
  {
    var msg = new XMLRPCMessage( "getProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductForm:function ( cb ) 
  {
    this.getProduct(V('token','String'),V('key','String'),V('sku','String'),cb);		          
  }

  ,
  getProductDescriptor: function(token,key,sku,cb) 
  {
    var msg = new XMLRPCMessage( "getProductDescriptor" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductDescriptorForm:function ( cb ) 
  {
    this.getProductDescriptor(V('token','String'),V('key','String'),V('sku','String'),cb);		          
  }

  ,
  createProduct: function(token,sku,key,cb) 
  {
    var msg = new XMLRPCMessage( "createProduct" , null);
    msg.addParameter(token);
    msg.addParameter(sku);
    msg.addParameter(key);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  createProductForm:function ( cb ) 
  {
    this.createProduct(V('token','String'),V('sku','String'),V('key','String'),cb);		          
  }

  ,
  getProducts: function(token,sku,cb) 
  {
    var msg = new XMLRPCMessage( "getProducts" , null);
    msg.addParameter(token);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductsForm:function ( cb ) 
  {
    this.getProducts(V('token','String'),V('sku','String'),cb);		          
  }

  ,
  getProductDescriptors: function(token,sku,cb) 
  {
    var msg = new XMLRPCMessage( "getProductDescriptors" , null);
    msg.addParameter(token);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductDescriptorsForm:function ( cb ) 
  {
    this.getProductDescriptors(V('token','String'),V('sku','String'),cb);		          
  }

  ,
  saveProduct: function(token,key,xml,cb) 
  {
    var msg = new XMLRPCMessage( "saveProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(xml);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveProductForm:function ( cb ) 
  {
    this.saveProduct(V('token','String'),V('key','String'),V('xml','String'),cb);		          
  }

  ,
  saveProductAttributes: function(token,key,xml,cb) 
  {
    var msg = new XMLRPCMessage( "saveProductAttributes" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(xml);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveProductAttributesForm:function ( cb ) 
  {
    this.saveProductAttributes(V('token','String'),V('key','String'),V('xml','String'),cb);		          
  }

  ,
  saveAndValidateProduct: function(token,key,xml,verifyBitmap,cb) 
  {
    var msg = new XMLRPCMessage( "saveAndValidateProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(xml);
    msg.addParameter(verifyBitmap);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveAndValidateProductForm:function ( cb ) 
  {
    this.saveAndValidateProduct(V('token','String'),V('key','String'),V('xml','String'),V('verifyBitmap','Boolean'),cb);		          
  }

  ,
  validateProduct: function(token,key,verifyBitmap,cb) 
  {
    var msg = new XMLRPCMessage( "validateProduct" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(verifyBitmap);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  validateProductForm:function ( cb ) 
  {
    this.validateProduct(V('token','String'),V('key','String'),V('verifyBitmap','Boolean'),cb);		          
  }

  ,
  saveProductPages: function(token,key,xml,cb) 
  {
    var msg = new XMLRPCMessage( "saveProductPages" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(xml);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveProductPagesForm:function ( cb ) 
  {
    this.saveProductPages(V('token','String'),V('key','String'),V('xml','String[]'),cb);		          
  }

  ,
  saveAndValidateProductPages: function(token,key,xml,verifyBitmap,cb) 
  {
    var msg = new XMLRPCMessage( "saveAndValidateProductPages" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(xml);
    msg.addParameter(verifyBitmap);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  saveAndValidateProductPagesForm:function ( cb ) 
  {
    this.saveAndValidateProductPages(V('token','String'),V('key','String'),V('xml','String[]'),V('verifyBitmap','Boolean'),cb);		          
  }

  ,
  getPreviewFixedSize: function(token,key,maxSize,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewFixedSize" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(maxSize);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewFixedSizeForm:function ( cb ) 
  {
    this.getPreviewFixedSize(V('token','String'),V('key','String'),V('maxSize','Int32'),V('renderOptions','String'),cb);		          
  }

  ,
  getPreviewByXmlFixedSize: function(xml,maxSize,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewByXmlFixedSize" , null);
    msg.addParameter(xml);
    msg.addParameter(maxSize);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewByXmlFixedSizeForm:function ( cb ) 
  {
    this.getPreviewByXmlFixedSize(V('xml','String'),V('maxSize','Int32'),V('renderOptions','String'),cb);		          
  }

  ,
  getFullSizeByXml: function(xml,cb) 
  {
    var msg = new XMLRPCMessage( "getFullSizeByXml" , null);
    msg.addParameter(xml);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getFullSizeByXmlForm:function ( cb ) 
  {
    this.getFullSizeByXml(V('xml','String'),cb);		          
  }

  ,
  getPreviewByPageIdFixedSize: function(token,key,pageId,maxSize,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewByPageIdFixedSize" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(pageId);
    msg.addParameter(maxSize);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewByPageIdFixedSizeForm:function ( cb ) 
  {
    this.getPreviewByPageIdFixedSize(V('token','String'),V('key','String'),V('pageId','String'),V('maxSize','Int32'),V('renderOptions','String'),cb);		          
  }

  ,
  getPreviewByXmlByPageIdFixedSize: function(xml,pageId,maxSize,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewByXmlByPageIdFixedSize" , null);
    msg.addParameter(xml);
    msg.addParameter(pageId);
    msg.addParameter(maxSize);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewByXmlByPageIdFixedSizeForm:function ( cb ) 
  {
    this.getPreviewByXmlByPageIdFixedSize(V('xml','String'),V('pageId','String'),V('maxSize','Int32'),V('renderOptions','String'),cb);		          
  }

  ,
  getPreviewByPageIdByRegionIdFixedSize: function(token,key,pageId,regionId,maxSize,outputFormat,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewByPageIdByRegionIdFixedSize" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(pageId);
    msg.addParameter(regionId);
    msg.addParameter(maxSize);
    msg.addParameter(outputFormat);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewByPageIdByRegionIdFixedSizeForm:function ( cb ) 
  {
    this.getPreviewByPageIdByRegionIdFixedSize(V('token','String'),V('key','String'),V('pageId','String'),V('regionId','String'),V('maxSize','Int32'),V('outputFormat','String'),V('renderOptions','String'),cb);		          
  }

  ,
  getPreviewByXmlByPageIdByRegionIdFixedSize: function(xml,pageId,regionId,maxSize,outputFormat,renderOptions,cb) 
  {
    var msg = new XMLRPCMessage( "getPreviewByXmlByPageIdByRegionIdFixedSize" , null);
    msg.addParameter(xml);
    msg.addParameter(pageId);
    msg.addParameter(regionId);
    msg.addParameter(maxSize);
    msg.addParameter(outputFormat);
    msg.addParameter(renderOptions);
  
      if (cb==null) return this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
      else cb.src = this.baseUrl+this.binaryProxy+"?remotingPage="+this.remotingPage+"&output=jpeg&message="+msg.xml()+"&mod="+(new Date()).getTime();
    
  }
  ,

  // Form-based short-cut for the above function.
  getPreviewByXmlByPageIdByRegionIdFixedSizeForm:function ( cb ) 
  {
    this.getPreviewByXmlByPageIdByRegionIdFixedSize(V('xml','String'),V('pageId','String'),V('regionId','String'),V('maxSize','Int32'),V('outputFormat','String'),V('renderOptions','String'),cb);		          
  }

  ,
  getCenterCropOffsetByPageIdByPhotoRegionId: function(token,key,pageId,regionId,cb) 
  {
    var msg = new XMLRPCMessage( "getCenterCropOffsetByPageIdByPhotoRegionId" , null);
    msg.addParameter(token);
    msg.addParameter(key);
    msg.addParameter(pageId);
    msg.addParameter(regionId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCenterCropOffsetByPageIdByPhotoRegionIdForm:function ( cb ) 
  {
    this.getCenterCropOffsetByPageIdByPhotoRegionId(V('token','String'),V('key','String'),V('pageId','String'),V('regionId','String'),cb);		          
  }

}
var ezpConfiguratorsSdk = new ezpConfigurators();



 
var ezpeCommerce = Class.create();
ezpeCommerce.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.ecommerce.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  
  /*********
    
    Removes a promotion code from a cart
    
    @Token : The token returned from the Security login method
    @PromotionCode : The Promotion code of the call
    
    returns : true if the cart was updated
    
  *********/
  removePromotionCode: function(Token,PromotionCode,cb) 
  {
    var msg = new XMLRPCMessage( "removePromotionCode" , null);
    msg.addParameter(Token);
    msg.addParameter(PromotionCode);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  removePromotionCodeForm:function ( cb ) 
  {
    this.removePromotionCode(V('Token','String'),V('PromotionCode','String'),cb);		          
  }

  ,
  
  /*********
    
    Applies a promotion code to a cart
    
    @Token : The token returned from the Security login method
    @PromotionCode : The Promotion code of the call
    
    returns : true if the cart was updated
    
  *********/
  applyPromotionCode: function(Token,PromotionCode,cb) 
  {
    var msg = new XMLRPCMessage( "applyPromotionCode" , null);
    msg.addParameter(Token);
    msg.addParameter(PromotionCode);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  applyPromotionCodeForm:function ( cb ) 
  {
    this.applyPromotionCode(V('Token','String'),V('PromotionCode','String'),cb);		          
  }

  ,
  
  /*********
    
    Empties the Shopping Cart for the user
    
    @Token : The token returned from the Security login method
    
    returns : true if the cart was emptied
    
  *********/
  emptyCart: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "emptyCart" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  emptyCartForm:function ( cb ) 
  {
    this.emptyCart(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns the available products
    
    @Token : Security Sets this value
    
    returns : A list of line items
    
  *********/
  getProducts: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getProducts" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductsForm:function ( cb ) 
  {
    this.getProducts(V('Token','String'),cb);		          
  }

  ,
  getProductsByBrandId: function(BrandId,cb) 
  {
    var msg = new XMLRPCMessage( "getProductsByBrandId" , null);
    msg.addParameter(BrandId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getProductsByBrandIdForm:function ( cb ) 
  {
    this.getProductsByBrandId(V('BrandId','Int32'),cb);		          
  }

  ,
  
  /*********
    
    Sets the shipping address of the cart
    
    @Token : Returned from the security system
    @FirstName : First Name
    @MiddleInitial : MI
    @LastName : Last Name
    @PhoneNumber : Phone Number
    @Address1 : Address Line
    @Address2 : Address Line 2
    @City : City
    @StateProvince : State or Province
    @PostalCode : Postal Code
    @Country : Country
    
    returns : The updated shopping cart
    
  *********/
  setCartShippingAddress: function(Token,FirstName,MiddleInitial,LastName,PhoneNumber,Address1,Address2,City,StateProvince,PostalCode,Country,cb) 
  {
    var msg = new XMLRPCMessage( "setCartShippingAddress" , null);
    msg.addParameter(Token);
    msg.addParameter(FirstName);
    msg.addParameter(MiddleInitial);
    msg.addParameter(LastName);
    msg.addParameter(PhoneNumber);
    msg.addParameter(Address1);
    msg.addParameter(Address2);
    msg.addParameter(City);
    msg.addParameter(StateProvince);
    msg.addParameter(PostalCode);
    msg.addParameter(Country);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  setCartShippingAddressForm:function ( cb ) 
  {
    this.setCartShippingAddress(V('Token','String'),V('FirstName','String'),V('MiddleInitial','String'),V('LastName','String'),V('PhoneNumber','String'),V('Address1','String'),V('Address2','String'),V('City','String'),V('StateProvince','String'),V('PostalCode','String'),V('Country','String'),cb);		          
  }

  ,
  
  /*********
    
    Sets the cart billing address
    
    @Token : Returned from the security system
    @FirstName : First Name
    @MiddleInitial : MI
    @LastName : Last Name
    @PhoneNumber : Phone Number
    @Address1 : Address Line
    @Address2 : Address Line 2
    @City : City
    @StateProvince : State or Province
    @PostalCode : Postal Code
    @Country : Country
    
    returns : The updated shopping cart
    
  *********/
  setCartBillingAddress: function(Token,FirstName,MiddleInitial,LastName,PhoneNumber,Address1,Address2,City,StateProvince,PostalCode,Country,cb) 
  {
    var msg = new XMLRPCMessage( "setCartBillingAddress" , null);
    msg.addParameter(Token);
    msg.addParameter(FirstName);
    msg.addParameter(MiddleInitial);
    msg.addParameter(LastName);
    msg.addParameter(PhoneNumber);
    msg.addParameter(Address1);
    msg.addParameter(Address2);
    msg.addParameter(City);
    msg.addParameter(StateProvince);
    msg.addParameter(PostalCode);
    msg.addParameter(Country);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  setCartBillingAddressForm:function ( cb ) 
  {
    this.setCartBillingAddress(V('Token','String'),V('FirstName','String'),V('MiddleInitial','String'),V('LastName','String'),V('PhoneNumber','String'),V('Address1','String'),V('Address2','String'),V('City','String'),V('StateProvince','String'),V('PostalCode','String'),V('Country','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns all active carts (carts with items) which are set to expire between now and the given date
    
    @maxDate : Maximum date for cart search
    
    returns : a list of carts
    
  *********/
  getCartsSetToExpire: function(Token,maxDate,cb) 
  {
    var msg = new XMLRPCMessage( "getCartsSetToExpire" , null);
    msg.addParameter(Token);
    msg.addParameter(maxDate);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCartsSetToExpireForm:function ( cb ) 
  {
    this.getCartsSetToExpire(V('Token','String'),V('maxDate','DateTime'),cb);		          
  }

  ,
  getQuantity: function(Token,itemId,cb) 
  {
    var msg = new XMLRPCMessage( "getQuantity" , null);
    msg.addParameter(Token);
    msg.addParameter(itemId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getQuantityForm:function ( cb ) 
  {
    this.getQuantity(V('Token','String'),V('itemId','String'),cb);		          
  }

  ,
  
  /*********
    
    Sets the shipping method
    
    @Token : The token returned from the Security login method
    @shipMethod : The shipping method
    
    returns : The amount of the shipping charge
    
  *********/
  setShippingMethod: function(Token,shipMethod,cb) 
  {
    var msg = new XMLRPCMessage( "setShippingMethod" , null);
    msg.addParameter(Token);
    msg.addParameter(shipMethod);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  setShippingMethodForm:function ( cb ) 
  {
    this.setShippingMethod(V('Token','String'),V('shipMethod','String'),cb);		          
  }

  ,
  
  /*********
    
    Adds an item to the cart.
    If the item already exists, the quantity will be incremented
    
    @Token : The token returned from the Security login method
    @photoId : The id of the image associated with this account.  This may be a comma delimited list of ids
    @qty : The additional number of these to purchase.  The total number of items may be set directly using 
    @sku : The sku of the item to add
    
    returns : true if the item was added to the cart
    
  *********/
  addToCart: function(Token,photoId,qty,sku,cb) 
  {
    var msg = new XMLRPCMessage( "addToCart" , null);
    msg.addParameter(Token);
    msg.addParameter(photoId);
    msg.addParameter(qty);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addToCartForm:function ( cb ) 
  {
    this.addToCart(V('Token','String'),V('photoId','String'),V('qty','Int32'),V('sku','String'),cb);		          
  }

  ,
  
  /*********
    
    Adds an item to the cart.
    If the item already exists, the quantity will be incremented
    
    @Token : The token returned from the Security login method
    @projectId : The project id associated with this picture.
    @projectType : Type of project (i.e. image).
    @qty : The additional number of these to purchase.  The total number of items may be set directly using 
    @sku : The sku of the item to add
    @loRes : Low resolution photo uri
    @medRes : Medium resolution photo uri
    @hiRes : High resolution photo uri
    
    returns : true if the item was added to the cart
    
  *********/
  addItemToCart: function(Token,projectId,projectType,qty,sku,loRes,medRes,hiRes,cb) 
  {
    var msg = new XMLRPCMessage( "addItemToCart" , null);
    msg.addParameter(Token);
    msg.addParameter(projectId);
    msg.addParameter(projectType);
    msg.addParameter(qty);
    msg.addParameter(sku);
    msg.addParameter(loRes);
    msg.addParameter(medRes);
    msg.addParameter(hiRes);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addItemToCartForm:function ( cb ) 
  {
    this.addItemToCart(V('Token','String'),V('projectId','String'),V('projectType','String'),V('qty','Int32'),V('sku','String'),V('loRes','String'),V('medRes','String'),V('hiRes','String'),cb);		          
  }

  ,
  
  /*********
    
    
    returns : true if the item was added to the cart
    
  *********/
  swapItemInCart: function(Token,projectId,sku,swapOutSku,cb) 
  {
    var msg = new XMLRPCMessage( "swapItemInCart" , null);
    msg.addParameter(Token);
    msg.addParameter(projectId);
    msg.addParameter(sku);
    msg.addParameter(swapOutSku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  swapItemInCartForm:function ( cb ) 
  {
    this.swapItemInCart(V('Token','String'),V('projectId','String'),V('sku','String'),V('swapOutSku','String'),cb);		          
  }

  ,
  
  /*********
    
    Adds an item to the cart.
    If the item already exists, the quantity will be incremented
    
    @Token : The token returned from the Security login method
    @xml : The XML of the line items to add
    Here is the general form
    
    Here is an image
    
    /// Here is a collection of images
    
    
    returns : true if the item was added to the cart
    
  *********/
  addToCartXml: function(Token,xml,cb) 
  {
    var msg = new XMLRPCMessage( "addToCartXml" , null);
    msg.addParameter(Token);
    msg.addParameter(xml);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  addToCartXmlForm:function ( cb ) 
  {
    this.addToCartXml(V('Token','String'),V('xml','String'),cb);		          
  }

  ,
  
  /*********
    
    Gets the cart line item count.
    
    @Token : The token returned from the Security login method
    
    returns : an integer representing the count of line items in the cart
    
  *********/
  getCartLineItemCount: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getCartLineItemCount" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCartLineItemCountForm:function ( cb ) 
  {
    this.getCartLineItemCount(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    Gets the cart item count.
    
    @Token : The token returned from the Security login method
    
    returns : an integer representing the count of items in the cart
    
  *********/
  getCartItemCount: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getCartItemCount" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCartItemCountForm:function ( cb ) 
  {
    this.getCartItemCount(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    Removes an item from the cart.
    If the item exists, it will be removed
    
    @Token : The token returned from the Security login method
    @photoId : The id of the image associated with this account
    @sku : The sku of the item to remove
    
    returns : true if the item was added to the cart
    
  *********/
  removeFromCart: function(Token,photoId,sku,cb) 
  {
    var msg = new XMLRPCMessage( "removeFromCart" , null);
    msg.addParameter(Token);
    msg.addParameter(photoId);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  removeFromCartForm:function ( cb ) 
  {
    this.removeFromCart(V('Token','String'),V('photoId','String'),V('sku','String'),cb);		          
  }

  ,
  
  /*********
    
    Sets the exact number of items of a specific sku and image id in the cart
    If the item already exists, the quantity will be updated to this value
    If it does not exist, the item will be added and the quantity set to the quantity passed
    
    @Token : The token returned from the Security login method
    @projectId : The id of the project
    @qty : The additional number of these to purchase.  The total number of items may be set directly using 
    @sku : The sku of the item to add
    
    returns : true if the item was added to the cart
    
  *********/
  updateCartQuantity: function(Token,projectId,qty,sku,cb) 
  {
    var msg = new XMLRPCMessage( "updateCartQuantity" , null);
    msg.addParameter(Token);
    msg.addParameter(projectId);
    msg.addParameter(qty);
    msg.addParameter(sku);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  updateCartQuantityForm:function ( cb ) 
  {
    this.updateCartQuantity(V('Token','String'),V('projectId','String'),V('qty','Int32'),V('sku','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns all active carts (carts with items) which are set to expire between now and the given date
    
    @maxDate : Maximum date for cart search
    
    returns : a list of carts
    
  *********/
  getCart: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getCart" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getCartForm:function ( cb ) 
  {
    this.getCart(V('Token','String'),cb);		          
  }

  ,
  
  /*********
    
    Returns the current shopping cart for a user
    
    @EzpOrderId : The G1 reference number
    
    returns : Shopping Cart
    
  *********/
  getXmlOrder: function(EzpOrderId,cb) 
  {
    var msg = new XMLRPCMessage( "getXmlOrder" , null);
    msg.addParameter(EzpOrderId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getXmlOrderForm:function ( cb ) 
  {
    this.getXmlOrder(V('EzpOrderId','String'),cb);		          
  }

  ,
  QueueOrder: function(BrandId,OrderId,cb) 
  {
    var msg = new XMLRPCMessage( "QueueOrder" , null);
    msg.addParameter(BrandId);
    msg.addParameter(OrderId);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  QueueOrderForm:function ( cb ) 
  {
    this.QueueOrder(V('BrandId','String'),V('OrderId','String'),cb);		          
  }

  ,
  
  /*********
    
    Changes the specified attribute for all line items
    That have that attribute defined.
    
    @Token : The token returned from the Security login method
    @finishValue : Save the finish value to teh cart.
    
    returns : True for success, false for failure
    
  *********/
  savePhotoFinish: function(Token,finishValue,cb) 
  {
    var msg = new XMLRPCMessage( "savePhotoFinish" , null);
    msg.addParameter(Token);
    msg.addParameter(finishValue);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  savePhotoFinishForm:function ( cb ) 
  {
    this.savePhotoFinish(V('Token','String'),V('finishValue','String'),cb);		          
  }

  ,
  
  /*********
    
    Changes the specified attribute for all line items
    That have that attribute defined.
    
    @Token : The token returned from the Security login method
    @name : The name of the attribute to change
    @value : The value to set to.
    
    returns : A list of line items
    
  *********/
  changeAttribute: function(Token,name,value,cb) 
  {
    var msg = new XMLRPCMessage( "changeAttribute" , null);
    msg.addParameter(Token);
    msg.addParameter(name);
    msg.addParameter(value);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  changeAttributeForm:function ( cb ) 
  {
    this.changeAttribute(V('Token','String'),V('name','String'),V('value','String'),cb);		          
  }

}
var ezpeCommerceSdk = new ezpeCommerce();



 
var ezpDPP = Class.create();
ezpDPP.prototype = {
  initialize: function() {
    this.baseUrl = "/PrintstoreAPI/";         
    this.remotingPage = "ezp.dpp.rem";            
    this.strApi=this.baseUrl + this.remotingPage;
    this.output="json";
    this.binaryProxy="SendMessageForBinary.aspx";
  }
  
  ,
  sharePhotos: function(Token,Addresses,From,Subj,Message,WebSite,cb) 
  {
    var msg = new XMLRPCMessage( "sharePhotos" , null);
    msg.addParameter(Token);
    msg.addParameter(Addresses);
    msg.addParameter(From);
    msg.addParameter(Subj);
    msg.addParameter(Message);
    msg.addParameter(WebSite);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  sharePhotosForm:function ( cb ) 
  {
    this.sharePhotos(V('Token','String'),V('Addresses','String'),V('From','String'),V('Subj','String'),V('Message','String'),V('WebSite','String'),cb);		          
  }

  ,
  notifyPasswordReset: function(Token,Website,cb) 
  {
    var msg = new XMLRPCMessage( "notifyPasswordReset" , null);
    msg.addParameter(Token);
    msg.addParameter(Website);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  notifyPasswordResetForm:function ( cb ) 
  {
    this.notifyPasswordReset(V('Token','String'),V('Website','String'),cb);		          
  }

  ,
  getGuestOrderHistory: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getGuestOrderHistory" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getGuestOrderHistoryForm:function ( cb ) 
  {
    this.getGuestOrderHistory(V('Token','String'),cb);		          
  }

  ,
  getOrderHistory: function(Token,cb) 
  {
    var msg = new XMLRPCMessage( "getOrderHistory" , null);
    msg.addParameter(Token);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getOrderHistoryForm:function ( cb ) 
  {
    this.getOrderHistory(V('Token','String'),cb);		          
  }

  ,
  getOrder: function(Token,OrderID,cb) 
  {
    var msg = new XMLRPCMessage( "getOrder" , null);
    msg.addParameter(Token);
    msg.addParameter(OrderID);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getOrderForm:function ( cb ) 
  {
    this.getOrder(V('Token','String'),V('OrderID','String'),cb);		          
  }

  ,
  getAd: function(siteID,locID,adClass,launch,cb) 
  {
    var msg = new XMLRPCMessage( "getAd" , null);
    msg.addParameter(siteID);
    msg.addParameter(locID);
    msg.addParameter(adClass);
    msg.addParameter(launch);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  getAdForm:function ( cb ) 
  {
    this.getAd(V('siteID','String'),V('locID','String'),V('adClass','String'),V('launch','String'),cb);		          
  }

  ,
  checkWords: function(testWords,cb) 
  {
    var msg = new XMLRPCMessage( "checkWords" , null);
    msg.addParameter(testWords);
    var request = EZP.util.ConnectionManager.asyncRequest('POST', this.strApi, cb , msg.xml() , this.output);
  }
  ,

  // Form-based short-cut for the above function.
  checkWordsForm:function ( cb ) 
  {
    this.checkWords(V('testWords','String'),cb);		          
  }

}
var ezpDPPSdk = new ezpDPP();



