Box = new (function() {
   var _data, _this = this;
   
   _this.constructor = null;
   
   _this.getData = function() {
      return _data;
   }
   
   _this.activate = function(form) {
      Utils.request({
         url: '/backend/confirm_box.php',
         data: $(form).serialize(),
         success: function(box) {
            /* Empty the fields. */
            form.id.value = '';
            form.code.value = '';
               
            if ((box.ptype == 0) || ((box.ptype == 3) && (box.prod_id != 0))) {
               Content.load('/boxinfo', null);
            } else if(box.ptype == 4) { 
               Content.load('/presentkort2');
            } else if(box.ptype == 3) {
               Content.load('/choicebox2');
            }
         },
         error: function(errno, error) {
            Utils.alert('Fel: ' + error);
            /*var html;

            if (i == 0) {
               alert('Fel: ' + error);
            } else {
               if ($('#info').children().length > 0) {
                  $('#info').children().fadeOut(1000, function() {
                     $(this).remove();
                  });
               }
                  
               html  = '<div class="ui-state-error ui-corner-all" style="margin-bottom: 5px;">';
               html += '<div style="margin:10px 5px 10px 5px">';
               html += '<span class="ui-icon ui-icon-alert" style="float: left; margin-right: 0.3em;"></span>';
               html += '<strong>Fel:</strong> ' + error + '</div></div>';
                  
               $('#info').append(html);
            }*/
         }
      });
   }
});
