if (typeof North52 == 'undefined') { North52 = {}; }
if (typeof North52.CloneSchedule == 'undefined') { North52.CloneSchedule = {}; }

North52.CloneSchedule.Ok= function () {

        };
   
    North52.CloneSchedule.OnLoad = function () {
       $('#btnOk').attr('disabled',true);  
      
      var command = N52.DialogHelpers.GetParameterByName('data');
      var recordid= N52.DialogHelpers.GetParameterByName('id');
      var configurationId = N52.DialogHelpers.GetConfigurationId();

      var serverUrl = N52.DialogHelpers.GetServerUrl();
      North52.CloneSchedule.ExecuteClone(command, recordid, serverUrl, configurationId  );     
    };


North52.CloneSchedule.ExecuteClone= function(command, recordid, serverurl, configurationId ) {

                    var configuration = {};
                    configuration.north52_Command = { Value: command };
                    configuration.north52_CommandParameter = recordid + "|" + 10000 + "|" + 5 ;

                    SDK.JQuery.updateRecord(
                         configurationId,
                         configuration,
                         "north52_configuration", 
                         North52.CloneSchedule.configSuccess,
                         North52.CloneSchedule.configError
                      );
          
};

 North52.CloneSchedule.configSuccess= function () {    

        window.close();
     };

 North52.CloneSchedule.configError= function (XmlHttpRequest, textStatus, errorThrown) {
                      
                      alert('North52 Formula Manager: ' + XmlHttpRequest.message )
                      $('#btnOk').attr('disabled',false); 
                     $('#loading').hide(); 
       };