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

North52.ScheduleProcessing.Ok= function () {

        };
   
    North52.ScheduleProcessing.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.ScheduleProcessing.ExecuteSchedule(recordid, command, serverUrl,configurationId  );     
    };


North52.ScheduleProcessing.ExecuteSchedule= function(recordid, command, serverurl, configurationId ) {

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

                    SDK.JQuery.updateRecord(
                         configurationId,
                         configuration,
                         "north52_configuration", 
                         North52.ScheduleProcessing.configSuccess,
                         North52.ScheduleProcessing.configError
                      );
}
  catch (ex)
  {
     alert('North52 Formula Manager Error: ' + ex.message);
   }

};

 North52.ScheduleProcessing.configSuccess= function () {
 
        window.close();
     };

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