Index: prototipo/index.html
===================================================================
--- prototipo/index.html	(revision 445bdb460964204c9991908264c14f2a086887f4)
+++ prototipo/index.html	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -35,9 +35,13 @@
   <script src="static/js/ie10-viewport-bug-workaround.js"></script>
 
-  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
-  <script src="static/js/cropper.js"></script>
-
+  <!--========== Plugins para el pdf =========-->
   <script src="static/js/pdf.js"></script>
   <script src="static/js/pdf.worker.js"></script>
+
+  <!-- ========== Plugins hwcrypto ========= -->
+  <script type="text/javascript" src="static/js/gitversion.js"></script>
+  <script type="text/javascript" src="static/js/hwcrypto-legacy.js"></script>
+  <script type="text/javascript" src="static/js/hwcrypto.js"></script>
+  <script type="text/javascript" src="static/js/hex2base.js"></script>  
 
 </head>
@@ -114,5 +118,5 @@
                             </li> 
                              <ul class="nav collapse" id="Formato_Visible" role="menu" aria-labelledby="btn-1">
-                                <form id ="form"  enctype='multipart/form-data' >
+                                <form id ="Form-Format-Visible"  enctype='multipart/form-data' >
                                   <div class="btn-group" id="Formato_Visible">
                                      <button type="button" id="upload-button2" class="btn btn-success btn-sm">
@@ -124,8 +128,9 @@
                                      <input type="hidden" class="form-control" id="dataX" placeholder="x">
                                      <input type="hidden" class="form-control" id="dataY" placeholder="y">
-                                     <input type="file" id="file-to-upload2" accept="application/pdf" />
+                                     <input type="hidden" class="form-control" id="pagepdf" placeholder="Page of pdf">
+                                     <input type="file" id="file-sign-ft_Vble" accept="application/pdf" />
                                   </div>
-                                  </form>
-                                  <div class="text imagen" id="texto"></div>
+                                </form>
+                                <div class="text imagen" id="texto"></div>
                               </ul>                            
                               <li><a href="#" id="firm_no_v" class="list-group-item list-group-item-link" data-toggle="collapse" data-target="#Formato_Normal">Firma No visible <span class="glyphicon glyphicon-chevron-down"></span></a>
@@ -159,5 +164,5 @@
                           <span class="glyphicon glyphicon-open"></span>Cargar
                        </button>
-                        <input type="file" id="file-to-upload2" accept="application/pdf" />
+                        <input type="file" id="file-to-uploa" accept="application/pdf" />
                         <div id="etiquet">
                           <div class="text imagen" id="texto"></div>
@@ -230,4 +235,7 @@
                   <!--<div class="ball blue">sdsa</div>-->
                 </div>
+                <br>
+                <br>
+                <div id="respuesta"> </div>
               </div>
               </div>
@@ -288,18 +296,21 @@
   <script src="static/js/jqBootstrapValidation.js"></script>
   <!-- Theme JavaScript -->
-
   <script src="static/js/clean-blog.min.js"></script>
-  <script src="static/js/docs.js"></script>
   <script src="static/js/draggable.js"></script>
   <script src="static/js/bounded.js"></script>
   <script src="static/js/jquery/jquery-ui.js"></script>
-  <script src="static/js/docsDraggable.js"></script>
+  <script src="static/js/variables.js"></script>
+
   <script src="static/js/docFirmaNormal.js"></script>
   <script src="static/js/menu.js"></script>
+
+  <!-- Coordenadas-->
   <script src="static/js/functions/DraggableSortable.js"></script>
+  <script src="static/js/docsDraggable.js"></script>
+  <!-- sign-->
+  <script src="static/js/functions/manejoJsonPDF.js"></script>
   <script src="static/js/functions/firmarDocumentoPdf.js"></script>
 
 
-  
 </body>
 </html>
Index: prototipo/static/css/style.css
===================================================================
--- prototipo/static/css/style.css	(revision 0500480bf9d3ee826bcc58cebd95f0cf8a2ba024)
+++ prototipo/static/css/style.css	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -17,5 +17,5 @@
   border: 1px solid #eee;
   z-index: 2;
-  margin-bottom: 4px;
+  /*margin-bottom: 4px;*/
   display: none; 
   
@@ -54,5 +54,5 @@
 
 
-#file-to-upload, #file-to-upload2, #file-to-normal{
+#file-to-upload, #file-sign-ft_Vble, #file-to-normal{
   display: none;
 }
Index: ototipo/static/js/cropper.js
===================================================================
--- prototipo/static/js/cropper.js	(revision 747e7448464b2d95ba77b1f93b72e66e5b34c2ce)
+++ 	(revision )
@@ -1,1633 +1,0 @@
-(function (factory) {
-  if (typeof define === "function" && define.amd) {
-    // AMD. Register as anonymous module.
-    define(["jquery"], factory);
-  } else if (typeof exports === "object") {
-    // Node / CommonJS
-    factory(require("jquery"));
-  } else {
-    // Browser globals.
-    factory(jQuery);
-  }
-})(function ($) {
-
-  "use strict";
-
-  var $window = $(window),
-      $document = $(document),
-      location = window.location,
-
-      // Constants
-      TRUE = true,
-      FALSE = false,
-      NULL = null,
-      NAN = NaN,
-      INFINITY = Infinity,
-      STRING_UNDEFINED = "undefined",
-      STRING_DIRECTIVE = "directive",
-      CROPPER_NAMESPACE = ".cropper",
-
-      // RegExps
-      REGEXP_DIRECTIVES = /^(e|n|w|s|ne|nw|sw|se|all|crop|move|zoom)$/,
-      REGEXP_OPTIONS = /^(x|y|width|height)$/,
-      REGEXP_PROPERTIES = /^(naturalWidth|naturalHeight|width|height|aspectRatio|ratio|rotate)$/,
-
-      // Classes
-      CLASS_MODAL = "cropper-modal",
-      CLASS_HIDDEN = "cropper-hidden",
-      CLASS_INVISIBLE = "cropper-invisible",
-      CLASS_MOVE = "cropper-move",
-      CLASS_CROP = "cropper-crop",
-      CLASS_DISABLED = "cropper-disabled",
-
-      // Events
-      EVENT_MOUSE_DOWN = "mousedown touchstart",
-      EVENT_MOUSE_MOVE = "mousemove touchmove",
-      EVENT_MOUSE_UP = "mouseup mouseleave touchend touchleave touchcancel",
-      EVENT_WHEEL = "wheel mousewheel DOMMouseScroll",
-      EVENT_RESIZE = "resize" + CROPPER_NAMESPACE, // Bind to window with namespace
-      EVENT_DBLCLICK = "dblclick",
-      EVENT_BUILD = "build" + CROPPER_NAMESPACE,
-      EVENT_BUILT = "built" + CROPPER_NAMESPACE,
-      EVENT_DRAG_START = "dragstart" + CROPPER_NAMESPACE,
-      EVENT_DRAG_MOVE = "dragmove" + CROPPER_NAMESPACE,
-      EVENT_DRAG_END = "dragend" + CROPPER_NAMESPACE,
-
-      // Functions
-      isNumber = function (n) {
-        return typeof n === "number";
-      },
-
-      toArray = function (obj, offset) {
-        var args = [];
-
-        if (isNumber(offset)) { // It's necessary for IE8
-          args.push(offset);
-        }
-
-        return args.slice.apply(obj, args);
-      },
-
-      // Custom proxy to avoid jQuery's guid
-      proxy = function (fn, context) {
-        var args = toArray(arguments, 2);
-
-        return function () {
-          return fn.apply(context, args.concat(toArray(arguments)));
-        };
-      },
-
-      addTimestamp = function (url) {
-        var timestamp = "timestamp=" + (new Date()).getTime();
-
-        return (url + (url.indexOf("?") === -1 ? "?" : "&") + timestamp);
-      },
-
-      // Constructor
-      Cropper = function (element, options) {
-        this.element = element;
-        this.$element = $(element);
-        this.defaults = $.extend({}, Cropper.DEFAULTS, $.isPlainObject(options) ? options : {});
-        this.$original = NULL;
-        this.ready = FALSE;
-        this.built = FALSE;
-        this.cropped = FALSE;
-        this.rotated = FALSE;
-        this.disabled = FALSE;
-        this.replaced = FALSE;
-        this.init();
-      },
-
-      // Others
-      sqrt = Math.sqrt,
-      min = Math.min,
-      max = Math.max,
-      abs = Math.abs,
-      sin = Math.sin,
-      cos = Math.cos,
-      num = parseFloat;
-
-  Cropper.prototype = {
-    constructor: Cropper,
-
-    support: {
-      canvas: $.isFunction($("<canvas>")[0].getContext)
-    },
-
-    init: function () {
-      var defaults = this.defaults;
-
-      $.each(defaults, function (i, n) {
-        switch (i) {
-          case "aspectRatio":
-            defaults[i] = abs(num(n)) || NAN; // 0 -> NaN
-            break;
-
-          case "autoCropArea":
-            defaults[i] = abs(num(n)) || 0.8; // 0 | NaN -> 0.8
-            break;
-
-          case "minWidth":
-          case "minHeight":
-            defaults[i] = abs(num(n)) || 0; // NaN -> 0
-            break;
-
-          case "maxWidth":
-          case "maxHeight":
-            defaults[i] = abs(num(n)) || INFINITY; // 0 | NaN -> Infinity
-            break;
-
-          // No default
-        }
-      });
-
-      // Set default image data
-      this.image = {
-        rotate: 0
-      };
-
-      this.load();
-    },
-
-    load: function () {
-      var _this = this,
-          $this = this.$element,
-          element = this.element,
-          image = this.image,
-          crossOrigin = "",
-          $clone,
-          url;
-
-      if ($this.is("img")) {
-        url = $this.prop("src");
-      } else if ($this.is("canvas") && this.support.canvas) {
-        url = element.toDataURL();
-      }
-
-      if (!url) {
-        return;
-      }
-
-      // Reset image rotate degree
-      if (this.replaced) {
-        image.rotate = 0;
-      }
-
-      if (this.defaults.checkImageOrigin && this.isCrossOriginURL(url)) {
-        crossOrigin = " crossOrigin";
-        url = addTimestamp(url); // Bust cache (#119, #148)
-      }
-
-      this.$clone = ($clone = $("<img" + crossOrigin + ' src="' + url + '">'));
-
-      $clone.one("load", function () {
-        image.naturalWidth = this.naturalWidth || $clone.width();
-        image.naturalHeight = this.naturalHeight || $clone.height();
-        image.aspectRatio = image.naturalWidth / image.naturalHeight;
-
-        _this.url = url;
-        _this.ready = TRUE;
-        _this.build();
-      });
-
-      // Hide and prepend the clone iamge to the document body (Don't append to).
-      $clone.addClass(CLASS_INVISIBLE).prependTo("body");
-    },
-
-    isCrossOriginURL: function (url) {
-      var parts = url.match(/^(https?:)\/\/([^\:\/\?#]+):?(\d*)/i);
-
-      if (parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port)) {
-        return TRUE;
-      }
-
-      return FALSE;
-    },
-
-    build: function () {
-      var $this = this.$element,
-          defaults = this.defaults,
-          buildEvent,
-          $cropper;
-
-      if (!this.ready) {
-        return;
-      }
-
-      if (this.built) {
-        this.unbuild();
-      }
-
-      $this.one(EVENT_BUILD, defaults.build); // Only trigger once
-      buildEvent = $.Event(EVENT_BUILD);
-      $this.trigger(buildEvent);
-
-      if (buildEvent.isDefaultPrevented()) {
-        return;
-      }
-
-      // Create cropper elements
-      this.$cropper = ($cropper = $(Cropper.TEMPLATE));
-
-      // Hide the original image
-      $this.addClass(CLASS_HIDDEN);
-
-      // Show and prepend the clone iamge to the cropper
-      this.$clone.removeClass(CLASS_INVISIBLE).prependTo($cropper);
-
-      // Save original image for rotation
-      if (!this.rotated) {
-        this.$original = this.$clone.clone();
-
-        // Append the image to document to avoid "NS_ERROR_NOT_AVAILABLE" error on Firefox when call the "drawImage" method.
-        this.$original.addClass(CLASS_HIDDEN).prependTo(this.$cropper);
-
-        this.originalImage = $.extend({}, this.image);
-      }
-
-      this.$container = $this.parent();
-      this.$container.append($cropper);
-
-      this.$canvas = $cropper.find(".cropper-canvas");
-      this.$dragger = $cropper.find(".cropper-dragger");
-      this.$viewer = $cropper.find(".cropper-viewer");
-
-      defaults.autoCrop ? (this.cropped = TRUE) : this.$dragger.addClass(CLASS_HIDDEN);
-      defaults.modal && this.$canvas.addClass(CLASS_MODAL);
-      !defaults.dashed && this.$dragger.find(".cropper-dashed").addClass(CLASS_HIDDEN);
-      !defaults.movable && this.$dragger.find(".cropper-face").data(STRING_DIRECTIVE, "move");
-      !defaults.resizable && this.$dragger.find(".cropper-line, .cropper-point").addClass(CLASS_HIDDEN);
-
-      this.addListeners();
-      this.initPreview();
-
-      this.built = TRUE; // Set `true` before update
-      defaults.dragCrop && this.setDragMode("crop"); // Set after built
-      this.update();
-      this.replaced = FALSE; // Reset to `false` after update
-
-      $this.one(EVENT_BUILT, defaults.built); // Only trigger once
-      $this.trigger(EVENT_BUILT);
-    },
-
-    unbuild: function () {
-      if (!this.built) {
-        return;
-      }
-
-      this.built = FALSE;
-      this.removeListeners();
-
-      this.$preview.empty();
-      this.$preview = NULL;
-
-      this.$dragger = NULL;
-      this.$canvas = NULL;
-      this.$container = NULL;
-
-      this.$cropper.remove();
-      this.$cropper = NULL;
-    },
-
-    update: function (data) {
-      this.initContainer();
-      this.initCropper();
-      this.initImage();
-      this.initDragger();
-
-      if (data) {
-        this.setData(data, TRUE);
-        this.setDragMode("crop");
-      } else {
-        this.setData(this.defaults.data);
-      }
-    },
-
-    resize: function () {
-      clearTimeout(this.resizing);
-      this.resizing = setTimeout($.proxy(this.update, this, this.getData()), 200);
-    },
-
-    preview: function () {
-      var image = this.image,
-          dragger = this.dragger,
-          width = image.width,
-          height = image.height,
-          left = dragger.left - image.left,
-          top = dragger.top - image.top;
-
-      this.$viewer.find("img").css({
-        width: width,
-        height: height,
-        marginLeft: -left,
-        marginTop: -top
-      });
-
-      this.$preview.each(function () {
-        var $this = $(this),
-            data = $this.data(),
-            ratio = data.width / dragger.width,
-            newWidth = data.width,
-            newHeight = dragger.height * ratio;
-
-        if (newHeight > data.height) {
-          ratio = data.height / dragger.height,
-          newWidth = dragger.width * ratio;
-          newHeight = data.height;
-        }
-
-        $this.width(newWidth).height(newHeight).find("img").css({
-          width: width * ratio,
-          height: height * ratio,
-          marginLeft: -left * ratio,
-          marginTop: -top * ratio
-        });
-      });
-    },
-
-    addListeners: function () {
-      var defaults = this.defaults;
-
-      this.$element.on(EVENT_DRAG_START, defaults.dragstart).on(EVENT_DRAG_MOVE, defaults.dragmove).on(EVENT_DRAG_END, defaults.dragend);
-      this.$cropper.on(EVENT_MOUSE_DOWN, $.proxy(this.dragstart, this)).on(EVENT_DBLCLICK, $.proxy(this.dblclick, this));
-
-      if (defaults.zoomable) {
-        this.$cropper.on(EVENT_WHEEL, $.proxy(this.wheel, this));
-      }
-
-      if (defaults.multiple) {
-        this.$cropper.on(EVENT_MOUSE_MOVE, $.proxy(this.dragmove, this)).on(EVENT_MOUSE_UP, $.proxy(this.dragend, this));
-      } else {
-        $document.on(EVENT_MOUSE_MOVE, (this._dragmove = proxy(this.dragmove, this))).on(EVENT_MOUSE_UP, (this._dragend = proxy(this.dragend, this)));
-      }
-
-      $window.on(EVENT_RESIZE, (this._resize = proxy(this.resize, this)));
-    },
-
-    removeListeners: function () {
-      var defaults = this.defaults;
-
-      this.$element.off(EVENT_DRAG_START, defaults.dragstart).off(EVENT_DRAG_MOVE, defaults.dragmove).off(EVENT_DRAG_END, defaults.dragend);
-      this.$cropper.off(EVENT_MOUSE_DOWN, this.dragstart).off(EVENT_DBLCLICK, this.dblclick);
-
-      if (defaults.zoomable) {
-        this.$cropper.off(EVENT_WHEEL, this.wheel);
-      }
-
-      if (defaults.multiple) {
-        this.$cropper.off(EVENT_MOUSE_MOVE, this.dragmove).off(EVENT_MOUSE_UP, this.dragend);
-      } else {
-        $document.off(EVENT_MOUSE_MOVE, this._dragmove).off(EVENT_MOUSE_UP, this._dragend);
-      }
-
-      $window.off(EVENT_RESIZE, this._resize);
-    },
-
-    initPreview: function () {
-      var url = this.url;
-
-      this.$preview = $(this.defaults.preview);
-      this.$viewer.html('<img src="' + url + '">');
-
-      this.$preview.each(function () {
-        var $this = $(this);
-
-        $this.data({
-          width: $this.width(),
-          height: $this.height()
-        }).html('<img src="' + url + '" style="display:block;width:100%;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;">');
-      });
-    },
-
-    initContainer: function () {
-      var $this = this.$element,
-          $container = this.$container,
-          $cropper = this.$cropper,
-          defaults = this.defaults;
-
-      $cropper.addClass(CLASS_HIDDEN);
-      $this.removeClass(CLASS_HIDDEN);
-
-      this.container = {
-        width: max($container.width(), defaults.minContainerWidth),
-        height: max($container.height(), defaults.minContainerHeight)
-      };
-
-      $this.addClass(CLASS_HIDDEN);
-      $cropper.removeClass(CLASS_HIDDEN);
-    },
-
-    initCropper: function () {
-      var container = this.container,
-          image = this.image,
-          cropper;
-
-      if (((image.naturalWidth * container.height / image.naturalHeight) - container.width) >= 0) {
-        cropper = {
-          width: container.width,
-          height: container.width / image.aspectRatio,
-          left: 0
-        };
-
-        cropper.top = (container.height - cropper.height) / 2;
-      } else {
-        cropper = {
-          width: container.height * image.aspectRatio,
-          height: container.height,
-          top: 0
-        };
-
-        cropper.left = (container.width - cropper.width) / 2;
-      }
-
-      this.$cropper.css({
-        width: cropper.width,
-        height: cropper.height,
-        left: cropper.left,
-        top: cropper.top
-      });
-
-      this.cropper = cropper;
-    },
-
-    initImage: function () {
-      var image = this.image,
-          cropper = this.cropper,
-          defaultImage = {
-            _width: cropper.width,
-            _height: cropper.height,
-            width: cropper.width,
-            height: cropper.height,
-            left: 0,
-            top: 0,
-            ratio: cropper.width / image.naturalWidth
-          };
-
-      this.defaultImage = $.extend({}, image, defaultImage);
-
-      if (image._width !== cropper.width || image._height !== cropper.height) {
-        $.extend(image, defaultImage);
-      } else {
-        image = $.extend({}, defaultImage, image);
-
-        // Reset image ratio
-        if (this.replaced) {
-          image.ratio = defaultImage.ratio;
-        }
-      }
-
-      this.image = image;
-      this.renderImage();
-    },
-
-    renderImage: function (mode) {
-      var image = this.image;
-
-      if (mode === "zoom") {
-        image.left -= (image.width - image.oldWidth) / 2;
-        image.top -= (image.height - image.oldHeight) / 2;
-      }
-
-      image.left = min(max(image.left, image._width - image.width), 0);
-      image.top = min(max(image.top, image._height - image.height), 0);
-
-      this.$clone.css({
-        width: image.width,
-        height: image.height,
-        marginLeft: image.left,
-        marginTop: image.top
-      });
-
-      if (mode) {
-        this.defaults.done(this.getData());
-        this.preview();
-      }
-    },
-
-    initDragger: function () {
-      var defaults = this.defaults,
-          cropper = this.cropper,
-          // If not set, use the original aspect ratio of the image.
-          aspectRatio = defaults.aspectRatio || this.image.aspectRatio,
-          ratio = this.image.ratio,
-          autoCropDragger,
-          dragger;
-
-      if (((cropper.height * aspectRatio) - cropper.width) >= 0) {
-        dragger = {
-          height: cropper.width / aspectRatio,
-          width: cropper.width,
-          left: 0,
-          top: (cropper.height - (cropper.width / aspectRatio)) / 2,
-          maxWidth: cropper.width,
-          maxHeight: cropper.width / aspectRatio
-        };
-      } else {
-        dragger = {
-          height: cropper.height,
-          width: cropper.height * aspectRatio,
-          left: (cropper.width - (cropper.height * aspectRatio)) / 2,
-          top: 0,
-          maxWidth: cropper.height * aspectRatio,
-          maxHeight: cropper.height
-        };
-      }
-
-      dragger.minWidth = 0;
-      dragger.minHeight = 0;
-
-      if (defaults.aspectRatio) {
-        if (isFinite(defaults.maxWidth)) {
-          dragger.maxWidth = min(dragger.maxWidth, defaults.maxWidth * ratio);
-          dragger.maxHeight = dragger.maxWidth / aspectRatio;
-        } else if (isFinite(defaults.maxHeight)) {
-          dragger.maxHeight = min(dragger.maxHeight, defaults.maxHeight * ratio);
-          dragger.maxWidth = dragger.maxHeight * aspectRatio;
-        }
-
-        if (defaults.minWidth > 0) {
-          dragger.minWidth = max(0, defaults.minWidth * ratio);
-          dragger.minHeight = dragger.minWidth / aspectRatio;
-        } else if (defaults.minHeight > 0) {
-          dragger.minHeight = max(0, defaults.minHeight * ratio);
-          dragger.minWidth = dragger.minHeight * aspectRatio;
-        }
-      } else {
-        dragger.maxWidth = min(dragger.maxWidth, defaults.maxWidth * ratio);
-        dragger.maxHeight = min(dragger.maxHeight, defaults.maxHeight * ratio);
-        dragger.minWidth = max(0, defaults.minWidth * ratio);
-        dragger.minHeight = max(0, defaults.minHeight * ratio);
-      }
-
-      // minWidth can't be greater than maxWidth, and minHeight too.
-      dragger.minWidth = min(dragger.maxWidth, dragger.minWidth);
-      dragger.minHeight = min(dragger.maxHeight, dragger.minHeight);
-
-      // Center the dragger by default
-      autoCropDragger = $.extend({}, dragger);
-
-      // The width of auto crop area must large than minWidth, and the height too. (#164)
-      autoCropDragger.width = max(dragger.minWidth, dragger.width * defaults.autoCropArea);
-      autoCropDragger.height = max(dragger.minHeight, dragger.height * defaults.autoCropArea);
-      autoCropDragger.left = (cropper.width - autoCropDragger.width) / 2;
-      autoCropDragger.top = (cropper.height - autoCropDragger.height) / 2;
-
-      autoCropDragger.oldLeft = dragger.oldLeft = dragger.left;
-      autoCropDragger.oldTop = dragger.oldTop = dragger.top;
-
-      this.autoCropDragger = autoCropDragger;
-      this.defaultDragger = $.extend({}, dragger);
-      this.dragger = dragger;
-    },
-
-    renderDragger: function () {
-      var dragger = this.dragger,
-          cropper = this.cropper;
-
-      if (dragger.width > dragger.maxWidth) {
-        dragger.width = dragger.maxWidth;
-        dragger.left = dragger.oldLeft;
-      } else if (dragger.width < dragger.minWidth) {
-        dragger.width = dragger.minWidth;
-        dragger.left = dragger.oldLeft;
-      }
-
-      if (dragger.height > dragger.maxHeight) {
-        dragger.height = dragger.maxHeight;
-        dragger.top = dragger.oldTop;
-      } else if (dragger.height < dragger.minHeight) {
-        dragger.height = dragger.minHeight;
-        dragger.top = dragger.oldTop;
-      }
-
-      dragger.left = min(max(dragger.left, 0), cropper.width - dragger.width);
-      dragger.top = min(max(dragger.top, 0), cropper.height - dragger.height);
-      dragger.oldLeft = dragger.left;
-      dragger.oldTop = dragger.top;
-
-      // Re-render the dragger
-      this.dragger = dragger;
-
-      // #186
-      if (this.defaults.movable) {
-        this.$dragger.find(".cropper-face").data(STRING_DIRECTIVE, (dragger.width === cropper.width && dragger.height === cropper.height) ? "move" : "all");
-      }
-
-      if (!this.disabled) {
-        this.defaults.done(this.getData());
-      }
-
-      this.$dragger.css({
-        width: dragger.width,
-        height: dragger.height,
-        left: dragger.left,
-        top: dragger.top
-      });
-
-      this.preview();
-    },
-
-    reset: function (deep) {
-      if (!this.cropped || this.disabled) {
-        return;
-      }
-
-      if (deep) {
-        this.defaults.data = {};
-      }
-
-      this.image = $.extend({}, this.defaultImage);
-      this.renderImage();
-      this.dragger = $.extend({}, this.defaultDragger);
-      this.setData(this.defaults.data);
-    },
-
-    clear: function () {
-      if (!this.cropped || this.disabled) {
-        return;
-      }
-
-      this.cropped = FALSE;
-
-      this.setData({
-        x: 0,
-        y: 0,
-        width: 0,
-        height: 0
-      });
-
-      this.$canvas.removeClass(CLASS_MODAL);
-      this.$dragger.addClass(CLASS_HIDDEN);
-    },
-
-    destroy: function () {
-      var $this = this.$element;
-
-      if (!this.ready) {
-        this.$clone.off("load").remove();
-      }
-
-      this.unbuild();
-      $this.removeClass(CLASS_HIDDEN).removeData("cropper");
-
-      if (this.rotated) {
-        $this.attr("src", this.$original.attr("src"));
-      }
-    },
-
-    replace: function (url, /*INTERNAL*/ rotated) {
-      var _this = this,
-          $this = this.$element,
-          element = this.element,
-          context;
-
-      if (!this.disabled && url && url !== this.url && url !== $this.attr("src")) {
-        if (!rotated) {
-          this.rotated = FALSE;
-          this.replaced = TRUE;
-        }
-
-        if ($this.is("img")) {
-          $this.attr("src", url);
-          this.load();
-        } else if ($this.is("canvas") && this.support.canvas) {
-          context = element.getContext("2d");
-
-          $('<img src="' + url + '">').one("load", function () {
-            element.width = this.width;
-            element.height = this.height;
-            context.clearRect(0, 0, element.width, element.height);
-            context.drawImage(this, 0, 0);
-            _this.load();
-          });
-        }
-      }
-    },
-
-    setData: function (data, /*INTERNAL*/ once) {
-      var cropper = this.cropper,
-          dragger = this.dragger,
-          image = this.image,
-          aspectRatio = this.defaults.aspectRatio;
-
-      if (!this.built || this.disabled || typeof data === STRING_UNDEFINED) {
-        return;
-      }
-
-      if (data === NULL || $.isEmptyObject(data)) {
-        dragger = $.extend({}, this.autoCropDragger);
-      }
-
-      if ($.isPlainObject(data) && !$.isEmptyObject(data)) {
-
-        if (!once) {
-          this.defaults.data = data;
-        }
-
-        data = this.transformData(data);
-
-        if (isNumber(data.x) && data.x <= cropper.width - image.left) {
-          dragger.left = data.x + image.left;
-        }
-
-        if (isNumber(data.y) && data.y <= cropper.height - image.top) {
-          dragger.top = data.y + image.top;
-        }
-
-        if (aspectRatio) {
-          if (isNumber(data.width) && data.width <= dragger.maxWidth && data.width >= dragger.minWidth) {
-            dragger.width = data.width;
-            dragger.height = dragger.width / aspectRatio;
-          } else if (isNumber(data.height) && data.height <= dragger.maxHeight && data.height >= dragger.minHeight) {
-            dragger.height = data.height;
-            dragger.width = dragger.height * aspectRatio;
-          }
-        } else {
-          if (isNumber(data.width) && data.width <= dragger.maxWidth && data.width >= dragger.minWidth) {
-            dragger.width = data.width;
-          }
-
-          if (isNumber(data.height) && data.height <= dragger.maxHeight && data.height >= dragger.minHeight) {
-            dragger.height = data.height;
-          }
-        }
-      }
-
-      this.dragger = dragger;
-      this.renderDragger();
-    },
-
-    getData: function (rounded) {
-      var dragger = this.dragger,
-          image = this.image,
-          data = {};
-
-      if (this.built) {
-        data = {
-          x: dragger.left - image.left,
-          y: dragger.top - image.top,
-          width: dragger.width,
-          height: dragger.height
-        };
-
-        data = this.transformData(data, TRUE, rounded);
-      }
-
-      return data;
-    },
-
-    transformData: function (data, reversed, rounded) {
-      var ratio = this.image.ratio,
-          result = {};
-
-      $.each(data, function (i, n) {
-        n = num(n);
-
-        if (REGEXP_OPTIONS.test(i) && !isNaN(n)) {
-          result[i] = reversed ? (rounded ? Math.round(n / ratio) : n / ratio) : n * ratio;
-        }
-      });
-
-      return result;
-    },
-
-    setAspectRatio: function (aspectRatio) {
-      var freeRatio = aspectRatio === "auto";
-
-      if (this.disabled) {
-        return;
-      }
-
-      aspectRatio = num(aspectRatio);
-
-      if (freeRatio || (!isNaN(aspectRatio) && aspectRatio > 0)) {
-        this.defaults.aspectRatio = freeRatio ? NAN : aspectRatio;
-
-        if (this.built) {
-          this.initDragger();
-          this.renderDragger();
-          this.setData(this.defaults.data); // Reset to initial state
-        }
-      }
-    },
-
-    getImageData: function () {
-      var data = {};
-
-      if (this.ready) {
-        $.each(this.image, function (name, value) {
-          if (REGEXP_PROPERTIES.test(name)) {
-            data[name] = value;
-          }
-        });
-      }
-
-      return data;
-    },
-
-    getDataURL: function (options, type, quality) {
-      var canvas = $("<canvas>")[0],
-          data = this.getData(),
-          dataURL = "",
-          context;
-
-      if (!$.isPlainObject(options)) {
-        quality = type;
-        type = options;
-        options = {};
-      }
-
-      options = $.extend({
-        width: data.width,
-        height: data.height
-      }, options);
-
-      if (this.cropped && this.support.canvas) {
-        canvas.width = options.width;
-        canvas.height = options.height;
-        context = canvas.getContext("2d");
-
-        if (type === "image/jpeg") {
-          context.fillStyle = "#fff";
-          context.fillRect(0, 0, options.width, options.height);
-        }
-
-        context.drawImage(this.$clone[0], data.x, data.y, data.width, data.height, 0, 0, options.width, options.height);
-        dataURL = canvas.toDataURL(type, quality);
-      }
-
-      return dataURL;
-    },
-
-    setDragMode: function (mode) {
-      var $canvas = this.$canvas,
-          defaults = this.defaults,
-          cropable = FALSE,
-          movable = FALSE;
-
-      if (!this.built || this.disabled) {
-        return;
-      }
-
-      switch (mode) {
-        case "crop":
-          if (defaults.dragCrop) {
-            cropable = TRUE;
-            $canvas.data(STRING_DIRECTIVE, mode);
-          }
-
-          break;
-
-        case "move":
-          movable = TRUE;
-          $canvas.data(STRING_DIRECTIVE, mode);
-
-          break;
-
-        default:
-          $canvas.removeData(STRING_DIRECTIVE);
-      }
-
-      $canvas.toggleClass(CLASS_CROP, cropable).toggleClass(CLASS_MOVE, movable);
-    },
-
-    enable: function () {
-      if (this.built) {
-        this.disabled = FALSE;
-        this.$cropper.removeClass(CLASS_DISABLED);
-      }
-    },
-
-    disable: function () {
-      if (this.built) {
-        this.disabled = TRUE;
-        this.$cropper.addClass(CLASS_DISABLED);
-      }
-    },
-
-    rotate: function (degree) {
-      var image = this.image;
-
-      degree = num(degree) || 0;
-
-      if (!this.built || degree === 0 || this.disabled || !this.defaults.rotatable || !this.support.canvas) {
-        return;
-      }
-
-      this.rotated = TRUE;
-      degree = (image.rotate = (image.rotate + degree) % 360);
-
-       // replace with "true" to prevent to override the original image
-      this.replace(this.getRotatedDataURL(degree), true);
-    },
-
-    getRotatedDataURL: function (degree) {
-      var canvas = $("<canvas>")[0],
-          context = canvas.getContext("2d"),
-          originalImage = this.originalImage,
-          naturalWidth = originalImage.naturalWidth,
-          naturalHeight = originalImage.naturalHeight,
-          deg = abs(degree) % 180,
-          arc = (deg > 90 ? (180 - deg) : deg) * Math.PI / 180,
-          width = naturalWidth * cos(arc) + naturalHeight * sin(arc),
-          height = naturalWidth * sin(arc) + naturalHeight * cos(arc);
-
-      canvas.width = width;
-      canvas.height = height;
-      context.save();
-      context.translate(width / 2, height / 2);
-      context.rotate(degree * Math.PI / 180);
-      context.drawImage(this.$original[0], -naturalWidth / 2, -naturalHeight / 2, naturalWidth, naturalHeight);
-      context.restore();
-
-      return canvas.toDataURL();
-    },
-
-    zoom: function (delta) {
-      var image = this.image,
-          width,
-          height,
-          range;
-
-      delta = num(delta);
-
-      if (!this.built || !delta || this.disabled || !this.defaults.zoomable) {
-        return;
-      }
-
-      width = image.width * (1 + delta);
-      height = image.height * (1 + delta);
-      range = width / image._width;
-
-      if (range > 10) {
-        return;
-      }
-
-      if (range < 1) {
-        width = image._width;
-        height = image._height;
-      }
-
-      if (range <= 1) {
-        this.setDragMode("crop");
-      } else {
-        this.setDragMode("move");
-      }
-
-      image.oldWidth = image.width;
-      image.oldHeight = image.height;
-
-      image.width = width;
-      image.height = height;
-      image.ratio = image.width / image.naturalWidth;
-
-      this.renderImage("zoom");
-    },
-
-    dblclick: function () {
-      if (this.disabled) {
-        return;
-      }
-
-      if (this.$canvas.hasClass(CLASS_CROP)) {
-        this.setDragMode("move");
-      } else {
-        this.setDragMode("crop");
-      }
-    },
-
-    wheel: function (event) {
-      var e = event.originalEvent,
-          delta = 1;
-
-      if (this.disabled) {
-        return;
-      }
-
-      event.preventDefault();
-
-      if (e.deltaY) {
-        delta = e.deltaY > 0 ? 1 : -1;
-      } else if (e.wheelDelta) {
-        delta = -e.wheelDelta / 120;
-      } else if (e.detail) {
-        delta = e.detail > 0 ? 1 : -1;
-      }
-
-      this.zoom(delta * 0.1);
-    },
-
-    dragstart: function (event) {
-      var touches = event.originalEvent.touches,
-          e = event,
-          directive,
-          dragStartEvent,
-          touchesLength;
-
-      if (this.disabled) {
-        return;
-      }
-
-      if (touches) {
-        touchesLength = touches.length;
-
-        if (touchesLength > 1) {
-          if (this.defaults.zoomable && touchesLength === 2) {
-            e = touches[1];
-            this.startX2 = e.pageX;
-            this.startY2 = e.pageY;
-            directive = "zoom";
-          } else {
-            return;
-          }
-        }
-
-        e = touches[0];
-      }
-
-      directive = directive || $(e.target).data(STRING_DIRECTIVE);
-
-      if (REGEXP_DIRECTIVES.test(directive)) {
-        event.preventDefault();
-
-        dragStartEvent = $.Event(EVENT_DRAG_START);
-        this.$element.trigger(dragStartEvent);
-
-        if (dragStartEvent.isDefaultPrevented()) {
-          return;
-        }
-
-        this.directive = directive;
-        this.cropping = FALSE;
-        this.startX = e.pageX;
-        this.startY = e.pageY;
-
-        if (directive === "crop") {
-          this.cropping = TRUE;
-          this.$canvas.addClass(CLASS_MODAL);
-        }
-      }
-    },
-
-    dragmove: function (event) {
-      var touches = event.originalEvent.touches,
-          e = event,
-          dragMoveEvent,
-          touchesLength;
-
-      if (this.disabled) {
-        return;
-      }
-
-      if (touches) {
-        touchesLength = touches.length;
-
-        if (touchesLength > 1) {
-          if (this.defaults.zoomable && touchesLength === 2) {
-            e = touches[1];
-            this.endX2 = e.pageX;
-            this.endY2 = e.pageY;
-          } else {
-            return;
-          }
-        }
-
-        e = touches[0];
-      }
-
-      if (this.directive) {
-        event.preventDefault();
-
-        dragMoveEvent = $.Event(EVENT_DRAG_MOVE);
-        this.$element.trigger(dragMoveEvent);
-
-        if (dragMoveEvent.isDefaultPrevented()) {
-          return;
-        }
-
-        this.endX = e.pageX;
-        this.endY = e.pageY;
-
-        this.dragging();
-      }
-    },
-
-    dragend: function (event) {
-      var dragEndEvent;
-
-      if (this.disabled) {
-        return;
-      }
-
-      if (this.directive) {
-        event.preventDefault();
-
-        dragEndEvent = $.Event(EVENT_DRAG_END);
-        this.$element.trigger(dragEndEvent);
-
-        if (dragEndEvent.isDefaultPrevented()) {
-          return;
-        }
-
-        if (this.cropping) {
-          this.cropping = FALSE;
-          this.$canvas.toggleClass(CLASS_MODAL, this.cropped && this.defaults.modal);
-        }
-
-        this.directive = "";
-      }
-    },
-
-    dragging: function () {
-      var directive = this.directive,
-          image = this.image,
-          cropper = this.cropper,
-          maxWidth = cropper.width,
-          maxHeight = cropper.height,
-          dragger = this.dragger,
-          width = dragger.width,
-          height = dragger.height,
-          left = dragger.left,
-          top = dragger.top,
-          right = left + width,
-          bottom = top + height,
-          renderable = TRUE,
-          aspectRatio = this.defaults.aspectRatio,
-          range = {
-            x: this.endX - this.startX,
-            y: this.endY - this.startY
-          },
-          offset;
-
-      if (aspectRatio) {
-        range.X = range.y * aspectRatio;
-        range.Y = range.x / aspectRatio;
-      }
-
-      switch (directive) {
-        // Move dragger
-        case "all":
-          left += range.x;
-          top += range.y;
-
-          break;
-
-        // Resize dragger
-        case "e":
-          if (range.x >= 0 && (right >= maxWidth || aspectRatio && (top <= 0 || bottom >= maxHeight))) {
-            renderable = FALSE;
-            break;
-          }
-
-          width += range.x;
-
-          if (aspectRatio) {
-            height = width / aspectRatio;
-            top -= range.Y / 2;
-          }
-
-          if (width < 0) {
-            directive = "w";
-            width = 0;
-          }
-
-          break;
-
-        case "n":
-          if (range.y <= 0 && (top <= 0 || aspectRatio && (left <= 0 || right >= maxWidth))) {
-            renderable = FALSE;
-            break;
-          }
-
-          height -= range.y;
-          top += range.y;
-
-          if (aspectRatio) {
-            width = height * aspectRatio;
-            left += range.X / 2;
-          }
-
-          if (height < 0) {
-            directive = "s";
-            height = 0;
-          }
-
-          break;
-
-        case "w":
-          if (range.x <= 0 && (left <= 0 || aspectRatio && (top <= 0 || bottom >= maxHeight))) {
-            renderable = FALSE;
-            break;
-          }
-
-          width -= range.x;
-          left += range.x;
-
-          if (aspectRatio) {
-            height = width / aspectRatio;
-            top += range.Y / 2;
-          }
-
-          if (width < 0) {
-            directive = "e";
-            width = 0;
-          }
-
-          break;
-
-        case "s":
-          if (range.y >= 0 && (bottom >= maxHeight || aspectRatio && (left <= 0 || right >= maxWidth))) {
-            renderable = FALSE;
-            break;
-          }
-
-          height += range.y;
-
-          if (aspectRatio) {
-            width = height * aspectRatio;
-            left -= range.X / 2;
-          }
-
-          if (height < 0) {
-            directive = "n";
-            height = 0;
-          }
-
-          break;
-
-        case "ne":
-          if (aspectRatio) {
-            if (range.y <= 0 && (top <= 0 || right >= maxWidth)) {
-              renderable = FALSE;
-              break;
-            }
-
-            height -= range.y;
-            top += range.y;
-            width = height * aspectRatio;
-          } else {
-            if (range.x >= 0) {
-              if (right < maxWidth) {
-                width += range.x;
-              } else if (range.y <= 0 && top <= 0) {
-                renderable = FALSE;
-              }
-            } else {
-              width += range.x;
-            }
-
-            if (range.y <= 0) {
-              if (top > 0) {
-                height -= range.y;
-                top += range.y;
-              }
-            } else {
-              height -= range.y;
-              top += range.y;
-            }
-          }
-
-          if (width < 0 && height < 0) {
-            directive = "sw";
-            height = 0;
-            width = 0;
-          } else if (width < 0) {
-            directive = "nw";
-            width = 0;
-          } else if (height < 0) {
-            directive = "se";
-            height = 0;
-          }
-
-          break;
-
-        case "nw":
-          if (aspectRatio) {
-            if (range.y <= 0 && (top <= 0 || left <= 0)) {
-              renderable = FALSE;
-              break;
-            }
-
-            height -= range.y;
-            top += range.y;
-            width = height * aspectRatio;
-            left += range.X;
-          } else {
-            if (range.x <= 0) {
-              if (left > 0) {
-                width -= range.x;
-                left += range.x;
-              } else if (range.y <= 0 && top <= 0) {
-                renderable = FALSE;
-              }
-            } else {
-              width -= range.x;
-              left += range.x;
-            }
-
-            if (range.y <= 0) {
-              if (top > 0) {
-                height -= range.y;
-                top += range.y;
-              }
-            } else {
-              height -= range.y;
-              top += range.y;
-            }
-          }
-
-          if (width < 0 && height < 0) {
-            directive = "se";
-            height = 0;
-            width = 0;
-          } else if (width < 0) {
-            directive = "ne";
-            width = 0;
-          } else if (height < 0) {
-            directive = "sw";
-            height = 0;
-          }
-
-          break;
-
-        case "sw":
-          if (aspectRatio) {
-            if (range.x <= 0 && (left <= 0 || bottom >= maxHeight)) {
-              renderable = FALSE;
-              break;
-            }
-
-            width -= range.x;
-            left += range.x;
-            height = width / aspectRatio;
-          } else {
-            if (range.x <= 0) {
-              if (left > 0) {
-                width -= range.x;
-                left += range.x;
-              } else if (range.y >= 0 && bottom >= maxHeight) {
-                renderable = FALSE;
-              }
-            } else {
-              width -= range.x;
-              left += range.x;
-            }
-
-            if (range.y >= 0) {
-              if (bottom < maxHeight) {
-                height += range.y;
-              }
-            } else {
-              height += range.y;
-            }
-          }
-
-          if (width < 0 && height < 0) {
-            directive = "ne";
-            height = 0;
-            width = 0;
-          } else if (width < 0) {
-            directive = "se";
-            width = 0;
-          } else if (height < 0) {
-            directive = "nw";
-            height = 0;
-          }
-
-          break;
-
-        case "se":
-          if (aspectRatio) {
-            if (range.x >= 0 && (right >= maxWidth || bottom >= maxHeight)) {
-              renderable = FALSE;
-              break;
-            }
-
-            width += range.x;
-            height = width / aspectRatio;
-          } else {
-            if (range.x >= 0) {
-              if (right < maxWidth) {
-                width += range.x;
-              } else if (range.y >= 0 && bottom >= maxHeight) {
-                renderable = FALSE;
-              }
-            } else {
-              width += range.x;
-            }
-
-            if (range.y >= 0) {
-              if (bottom < maxHeight) {
-                height += range.y;
-              }
-            } else {
-              height += range.y;
-            }
-          }
-
-          if (width < 0 && height < 0) {
-            directive = "nw";
-            height = 0;
-            width = 0;
-          } else if (width < 0) {
-            directive = "sw";
-            width = 0;
-          } else if (height < 0) {
-            directive = "ne";
-            height = 0;
-          }
-
-          break;
-
-        // Move image
-        case "move":
-          image.left += range.x;
-          image.top += range.y;
-          this.renderImage("move");
-          renderable = FALSE;
-          break;
-
-        // Scale image
-        case "zoom":
-          this.zoom(function (x, y, x1, y1, x2, y2) {
-            return (sqrt(x2 * x2 + y2 * y2) - sqrt(x1 * x1 + y1 * y1)) / sqrt(x * x + y * y);
-          }(
-            image.width,
-            image.height,
-            abs(this.startX - this.startX2),
-            abs(this.startY - this.startY2),
-            abs(this.endX - this.endX2),
-            abs(this.endY - this.endY2)
-          ));
-
-          this.endX2 = this.startX2;
-          this.endY2 = this.startY2;
-          renderable = FALSE;
-          break;
-
-        // Crop image
-        case "crop":
-          if (range.x && range.y) {
-            offset = this.$cropper.offset();
-            left = this.startX - offset.left;
-            top = this.startY - offset.top;
-            width = dragger.minWidth;
-            height = dragger.minHeight;
-
-            if (range.x > 0) {
-              if (range.y > 0) {
-                directive = "se";
-              } else {
-                directive = "ne";
-                top -= height;
-              }
-            } else {
-              if (range.y > 0) {
-                directive = "sw";
-                left -= width;
-              } else {
-                directive = "nw";
-                left -= width;
-                top -= height;
-              }
-            }
-
-            // Show the dragger if is hidden
-            if (!this.cropped) {
-              this.cropped = TRUE;
-              this.$dragger.removeClass(CLASS_HIDDEN);
-            }
-          }
-
-          break;
-
-        // No default
-      }
-
-      if (renderable) {
-        dragger.width = width;
-        dragger.height = height;
-        dragger.left = left;
-        dragger.top = top;
-        this.directive = directive;
-
-        this.renderDragger();
-      }
-
-      // Override
-      this.startX = this.endX;
-      this.startY = this.endY;
-    }
-  };
-
-  // Use the string compressor: Strmin (https://github.com/fengyuanchen/strmin)
-  Cropper.TEMPLATE = (function (source, words) {
-    words = words.split(",");
-    return source.replace(/\d+/g, function (i) {
-      return words[i];
-    });
-  })('<0 6="5-container"><0 6="5-canvas"></0><0 6="5-dragger"><1 6="5-viewer"></1><1 6="5-8 8-h"></1><1 6="5-8 8-v"></1><1 6="5-face" 3-2="all"></1><1 6="5-7 7-e" 3-2="e"></1><1 6="5-7 7-n" 3-2="n"></1><1 6="5-7 7-w" 3-2="w"></1><1 6="5-7 7-s" 3-2="s"></1><1 6="5-4 4-e" 3-2="e"></1><1 6="5-4 4-n" 3-2="n"></1><1 6="5-4 4-w" 3-2="w"></1><1 6="5-4 4-s" 3-2="s"></1><1 6="5-4 4-ne" 3-2="ne"></1><1 6="5-4 4-nw" 3-2="nw"></1><1 6="5-4 4-sw" 3-2="sw"></1><1 6="5-4 4-se" 3-2="se"></1></0></0>', "div,span,directive,data,point,cropper,class,line,dashed");
-
-  /* Template source:
-  <div class="cropper-container">
-    <div class="cropper-canvas"></div>
-    <div class="cropper-dragger">
-      <span class="cropper-viewer"></span>
-      <span class="cropper-dashed dashed-h"></span>
-      <span class="cropper-dashed dashed-v"></span>
-      <span class="cropper-face" data-directive="all"></span>
-      <span class="cropper-line line-e" data-directive="e"></span>
-      <span class="cropper-line line-n" data-directive="n"></span>
-      <span class="cropper-line line-w" data-directive="w"></span>
-      <span class="cropper-line line-s" data-directive="s"></span>
-      <span class="cropper-point point-e" data-directive="e"></span>
-      <span class="cropper-point point-n" data-directive="n"></span>
-      <span class="cropper-point point-w" data-directive="w"></span>
-      <span class="cropper-point point-s" data-directive="s"></span>
-      <span class="cropper-point point-ne" data-directive="ne"></span>
-      <span class="cropper-point point-nw" data-directive="nw"></span>
-      <span class="cropper-point point-sw" data-directive="sw"></span>
-      <span class="cropper-point point-se" data-directive="se"></span>
-    </div>
-  </div>
-  */
-
-  Cropper.DEFAULTS = {
-    // Basic
-    aspectRatio: "auto",
-    autoCropArea: 0.8, // 80%
-    data: {
-       x: 18,
-       y: 30,
-       width: 150,
-       height: 85
-    },
-    done: $.noop,
-    preview: "",
-
-    // Toggles
-    multiple: FALSE,
-    autoCrop: TRUE,
-    dragCrop: TRUE,
-    dashed: TRUE,
-    modal: FALSE,
-    movable: TRUE,
-    resizable: TRUE,
-    zoomable: FALSE,
-    rotatable: TRUE,
-    checkImageOrigin: TRUE,
-
-    // Dimensions
-    minWidth: 0,
-    minHeight: 0,
-    maxWidth: INFINITY,
-    maxHeight: INFINITY,
-    minContainerWidth: 300,
-    minContainerHeight: 150,
-
-    // Events
-    build: NULL,
-    built: NULL,
-    dragstart: NULL,
-    dragmove: NULL,
-    dragend: NULL
-  };
-
-  Cropper.setDefaults = function (options) {
-    $.extend(Cropper.DEFAULTS, options);
-  };
-
-  // Save the other cropper
-  Cropper.other = $.fn.cropper;
-
-  // Register as jQuery plugin
-  $.fn.cropper = function (options) {
-    var args = toArray(arguments, 1),
-        result;
-
-    this.each(function () {
-      var $this = $(this),
-          data = $this.data("cropper"),
-          fn;
-
-      if (!data) {
-        $this.data("cropper", (data = new Cropper(this, options)));
-      }
-
-      if (typeof options === "string" && $.isFunction((fn = data[options]))) {
-        result = fn.apply(data, args);
-      }
-    });
-
-    return (typeof result !== STRING_UNDEFINED ? result : this);
-  };
-
-  $.fn.cropper.Constructor = Cropper;
-  $.fn.cropper.setDefaults = Cropper.setDefaults;
-
-  // No conflict
-  $.fn.cropper.noConflict = function () {
-    $.fn.cropper = Cropper.other;
-    return this;
-  };
-});
Index: ototipo/static/js/docs.js
===================================================================
--- prototipo/static/js/docs.js	(revision 747e7448464b2d95ba77b1f93b72e66e5b34c2ce)
+++ 	(revision )
@@ -1,174 +1,0 @@
-
-var __PDF_DOC,
-  __CURRENT_PAGE,
-  __TOTAL_PAGES,
-  __PAGE_RENDERING_IN_PROGRESS = 0,
-  __CANVAS = $('#pdf-canvas').get(0),
-  __CANVAS_CTX = __CANVAS.getContext('2d'),
-  __id = "",
-  __NUMBER = 0;
-
-
-function cropperrr(){
-    console.log("siiiiiiiiiiiiiiiiii");
-      $("#img-1").cropper({
-        aspectRatio: 16 / 9,
-        done: function (data) {
-          console.log(data);
-          $('#dataX').val(parseInt(data['x']));
-          $('#dataY').val(parseInt(data['y']));
-          $('#dataWidth').val(parseInt(data['width']));
-          $('#dataHeight').val(parseInt(data['height']));
-        },
-
-      });
-
-
-          return true
-      }
-
-
-function file(){
-  if ($("#file-to-upload").get(0).files[0]=== undefined ){
-    console.log("siiiiiiiiiiifdfdsfds");
-    __NUMBER += 1;
-
-  }else{
-    console.log("noooo");
-  }
-  return __NUMBER;
-}
-  
-
-
- $("#pdf-canvas").hide();
-
-
-function showPDF(pdf_url) {
-  $("#pdf-loader").show();
-
-  PDFJS.getDocument({ url: pdf_url }).then(function(pdf_doc) {
-    __PDF_DOC = pdf_doc;
-    __TOTAL_PAGES = __PDF_DOC.numPages;
-    
-    // Hide the pdf loader and show pdf container in HTML
-    $("#pdf-loader").hide();
-    $("#pdf-contents").show();
-    $("#pdf-total-pages").text(__TOTAL_PAGES);
-
-    // Show the 
-      showPage(1);
-  
-  }).catch(function(error) {
-    // If error re-show the upload button
-    $("#pdf-loader").hide();
-    $("#upload-button").show();
-    
-    alert(error.message);
-  });;
-}
-
-function showPage(page_no) {
-  __PAGE_RENDERING_IN_PROGRESS = 1;
-  __CURRENT_PAGE = page_no;
-
-  // Disable Prev & Next buttons while page is being loaded
-  $("#pdf-next, #pdf-prev").attr('disabled', 'disabled');
-
-  // While page is being rendered hide the canvas and show a loading message
-  $("#pdf-canvas").hide();
-  $("#page-loader").show();
-
-  // Update current page in HTML
-  $("#pdf-current-page").text(page_no);
-  $("#pagepdf").val(page_no);
-  
-  // Fetch the page
-  __PDF_DOC.getPage(page_no).then(function(page) {
-    // As the canvas is of a fixed width we need to set the scale of the viewport accordingly
-
-
-    var scale_required = __CANVAS.width / page.getViewport(1).width;
-
-    // Get viewport of the page at required scale
-    var viewport = page.getViewport(scale_required);
-
-    // Set canvas height
-
-    __CANVAS.height = viewport.height;
-
-
-    var renderContext = {
-      canvasContext: __CANVAS_CTX,
-      viewport: viewport
-    };
-
-
-    // Render the page contents in the canvas
-    page.render(renderContext).then(function() {
-      __PAGE_RENDERING_IN_PROGRESS = 0;
-
-      // Re-enable Prev & Next buttons
-      $("#pdf-next, #pdf-prev").removeAttr('disabled');
-
-      // Show the canvas and hide the page loader
-      $("#pdf-canvas").hide();
-      $("#page-loader").hide();
-      __id = __CANVAS.toDataURL()
-      $("#img-1").attr('src', __id);
-    
-      cropperrr();
-
-      $('.cropper-container img').attr('src', __id)[0];
-
-      $('.cropper-container img').attr('src', __id)[1];
-
-    });
-  });
-
-
-}
-
-// Upon click this should should trigger click on the #file-to-upload file input element
-// This is better than showing the not-good-looking file input element
-$("#upload-button").on('click', function() {
-  //$("#img").removeAttr('src');
-  //$("#img").removeAttr('class');
-  //$(".cropper-container").remove();
-  $("#file-to-upload").trigger('click');
-
-});
-
-// When user chooses a PDF file
-$("#file-to-upload").on('change', function() {
-
-  var a = file();
-  console.log(a);
-  // Validate whether PDF
-    if(['application/pdf'].indexOf($("#file-to-upload").get(0).files[0].type) == -1) {
-        alert('Error : Not a PDF');
-        return;
-    }
-
-
-
-  // Send the object url of the pdf
-  showPDF(URL.createObjectURL($("#file-to-upload").get(0).files[0]));
-
-});
-
-// Previous page of the PDF
-$("#pdf-prev").on('click', function() {
-  if(__CURRENT_PAGE != 1)
-    showPage(--__CURRENT_PAGE);
-});
-
-// Next page of the PDF
-$("#pdf-next").on('click', function() {
-    
-
-  if(__CURRENT_PAGE != __TOTAL_PAGES)
-    
-    showPage(++__CURRENT_PAGE);
-
-});
Index: prototipo/static/js/docsDraggable.js
===================================================================
--- prototipo/static/js/docsDraggable.js	(revision 0500480bf9d3ee826bcc58cebd95f0cf8a2ba024)
+++ prototipo/static/js/docsDraggable.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -49,5 +49,6 @@
   // Update current page in HTML
   $("#pdf-current-page2").text(page_no);
-  $("#pagepdf").val(page_no);
+  
+  VALOR_PAGE = page_no;
   
   // Fetch the page
@@ -84,6 +85,5 @@
         __id = __CANVAS.toDataURL()
        
-      var viewdimen = page.getViewport(1);
-      console.log( "Width: " + viewdimen.width + ", Height: " + viewdimen.height);      
+      var viewdimen = page.getViewport(1);  
 
       $("#container1").attr("style", "background-image: url('"+__id+"');background-size: cover; background-repeat: no-repeat;  height:"+viewdimen.height+"px; width:"+viewdimen.width+"px");      
@@ -105,13 +105,13 @@
   $("#pdf-main-container").show(); 
 
-  $("#file-to-upload2").trigger('click');
+  $("#file-sign-ft_Vble").trigger('click');
 
 });
 
 // When user chooses a PDF file
-$("#file-to-upload2").on('change', function() {
+$("#file-sign-ft_Vble").on('change', function() {
 
   // Validate whether PDF
-    if(['application/pdf'].indexOf($("#file-to-upload2").get(0).files[0].type) == -1) {
+    if(['application/pdf'].indexOf($("#file-sign-ft_Vble").get(0).files[0].type) == -1) {
         alert('Error : Not a PDF');
         return;
@@ -119,5 +119,5 @@
 
   // Send the object url of the pdf
-  showPDF2(URL.createObjectURL($("#file-to-upload2").get(0).files[0]));
+  showPDF2(URL.createObjectURL($("#file-sign-ft_Vble").get(0).files[0]));
 
   if (__CLICK == 0){
Index: prototipo/static/js/functions/DraggableSortable.js
===================================================================
--- prototipo/static/js/functions/DraggableSortable.js	(revision 0500480bf9d3ee826bcc58cebd95f0cf8a2ba024)
+++ prototipo/static/js/functions/DraggableSortable.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -28,9 +28,9 @@
         if (num == 1){
           $("#firma_visible #Formato_Visible .text").hide();
-          $('#dataX').val(0);
-          $('#dataY').val(0);
+          VALOR_X = 0;
+          VALOR_Y = 0;
         }else{
-          $('#dataX').val(ui.position['left']);
-          $('#dataY').val(ui.position['top']);
+          VALOR_X = parseInt(ui.position['left']);
+          VALOR_Y = parseInt(ui.position['top']);
         }
         
Index: prototipo/static/js/functions/firmarDocumentoPdf.js
===================================================================
--- prototipo/static/js/functions/firmarDocumentoPdf.js	(revision 8d3737919347062d9f5f586dcb1a406e20ff35af)
+++ prototipo/static/js/functions/firmarDocumentoPdf.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -1,13 +1,7 @@
-
-$("#form").on('submit', function() {
-
+$("#Form-Format-Visible").on('submit', function() {
 	//var formData = new FormData(document.getElementById("form"));
 	var formData = new FormData();
-   
-    
-    formData.append("upload", $("#file-to-upload2")[0].files[0] );
-
-    console.log(formData);
-    console.log($(this));
+  
+    formData.append("upload", $("#file-sign-ft_Vble")[0].files[0]);
 
     $.ajax({
@@ -22,134 +16,120 @@
 		headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
 		success: function(response) {
-				//alert(JSON.stringify(response));
-				var html = manejoJsonPDF(JSON.stringify(response));
-				//alert(html);
-				//alert("ver respuesta")
-				document.getElementById("respuesta").innerHTML = html;
+			//alert(JSON.stringify(response));
+			var html = manejoJsonPDF(JSON.stringify(response));
+			document.getElementById("respuesta").innerHTML = html;
+			
+			// identificador del archivo en el servidor
+			var fileId = response.fileId.toString();
+			var cert;
+
+			window.hwcrypto.getCertificate({lang: "en"}).then(function(response) {
+		  		var cert = response;
 				
-				// identificador del archivo en el servidor
-				var fileId = response.fileId.toString();
+				var parameters = JSON.stringify({
+					"fileId":fileId,
+					"certificate":cert.hex,
+					"reason":"Certificado",
+					"location":"CENDITEL",
+					"contact":"582746574336",
+					"signatureVisible":"true",
+					"page": VALOR_PAGE,
+					"coord_x": VALOR_X,
+					"coord_y": VALOR_Y
+					});
+				
+				// ahora llamar al ajax de obtener la resena del pdf
+				$.ajax({
+					type: 'POST',
+					contentType: 'application/json',				
+					//url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs",
+					url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs",
+					dataType: "json",
+					data: parameters,		
+					headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
+					success: function(data, textStatus, jqXHR){
+						var json_x = data;
+						var hash = json_x['hash']; 
+						//alert("hash recibido del servidor "+hash);
+						
+						var hashtype = "SHA-256";
+						var lang = "eng";
+						
+						window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang}).then(function(signature) {
+										        		
+			        		$.ajax({
+								type: 'POST',
+								contentType: 'application/json',
+								//url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas",
+								url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas",
+								dataType: 'json',
+								data: JSON.stringify({"signature":signature.hex}),
+								headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
+								success: function(data, textStatus, jqXHR){
 
+									alert('Archivo firmado correctamente: ' + data['signedFileId']);
+									
+									var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";
+									//alert(linkToDownload);
+									document.getElementById("respuesta").innerHTML = linkToDownload;  														
+									
+								},
+								error: function(jqXHR, textStatus, errorThrown){
+									alert('error en pdfs/resenas: ' + textStatus);
+									$("#respuesta").html("error en pdfs/resenas: " + textStatus);
+								}
+							});
+			        					        		
+			      			}, function(err) {
+				        		log_text("sign() failed: " + err);
 
-				var cert;
-				window.hwcrypto.getCertificate({lang: "en"}).then(function(response) {
-			  		var cert = response;
+								var error;
+                                log_text("sign() failed: " + err);
+                                if(err == "Error: user_cancel") {
+                                    alert("sign() failed: El usuario cancelo la operación");
+                                    error = "El usuario cancelo la operación"; 
+                                 }      
+                                 else if(err == "Error: no_certificates") {
+                                     alert("sign() failed: No hay certificado disponible");
+                                     error = "No hay certificado disponible";
+                                 }
+                                 else if(err == "Error: no_implementation") {
+                                     alert("sign() failed: No hay soporte para el manejo del certificado");
+                                     error = "No hay soporte para el manejo del certificado";
+                                 }
 
+				        		//alert("sign() failed: " + err);
+				        		$("#respuesta").html("sign() failed: " + error);
+			    	  	});
+						
+					},								
+					error: function(jqXHR, textStatus, errorThrown){
+						//alert('error: ' + textStatus);
+						//var responseText = jQuery.parseJSON(jqXHR.responseText);
+						alert('ajax error function: ' + jqXHR.responseText);
+						$("#respuesta").html("error function: " + jqXHR.responseText);
+					}
+					
+				});
+				
+			}, function(err) {
+	      			log_text("getCertificate() failed: " + err);
+                    var error;
+                    if(err == "Error: user_cancel") {
+                        alert("getCertificate() failed: El usuario cancelo la operación"    );
+                        error = "El usuario cancelo la operación"; 
+                     }      
+                     else if(err == "Error: no_certificates") {
+                         alert("getCertificate() failed: No hay certificado disponible")    ;
+                         error = "No hay certificado disponible";
+                     }
+                     else if(err == "Error: no_implementation") {
+                         alert("getCertificate() failed: No hay soporte para el manejo del certificado");
+                         error = "No hay soporte para el manejo del certificado";
+					}
+	      			//alert("getCertificate() failed: " + err);
+	      			$("#respuesta").html("getCertificate() failed: " + error);
+	    		});
 
-					
-					var parameters = JSON.stringify({
-						"fileId":fileId,
-						"certificate":cert.hex,
-						"reason":"Certificado",
-						"location":"CENDITEL",
-						"contact":"582746574336",
-						"signatureVisible":"true"
-						// agregar aqui los parametros x,y,pagina
-						});
-					
-					// ahora llamar al ajax de obtener la resena del pdf
-					$.ajax({
-						type: 'POST',
-						contentType: 'application/json',				
-						//url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs",
-						url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs",
-						dataType: "json",
-						data: parameters,		
-						headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
-						success: function(data, textStatus, jqXHR){
-							var json_x = data;
-							var hash = json_x['hash']; 
-							//alert("hash recibido del servidor "+hash);
-							
-							var hashtype = "SHA-256";
-							var lang = "eng";
-							
-							window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang}).then(function(signature) {
-								
-
-
-				        		
-				        		$.ajax({
-									type: 'POST',
-									contentType: 'application/json',
-									//url:"https://192.168.12.125:8443/Murachi/0.1/archivos/pdfs/resenas",
-									url:"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/pdfs/resenas",
-									dataType: 'json',
-									data: JSON.stringify({"signature":signature.hex}),
-									headers: {"Authorization":"Basic YWRtaW46YWRtaW4="},
-									success: function(data, textStatus, jqXHR){
-
-										alert('Archivo firmado correctamente: ' + data['signedFileId']);
-										
-										
-										var linkToDownload = "<a href=\"https://murachi.cenditel.gob.ve/Murachi/0.1/archivos/descargas/" + data['signedFileId'] +"\">descargar archivo firmado</a>";
-										//alert(linkToDownload);
-										document.getElementById("respuesta").innerHTML = linkToDownload;  
-										
-
-																						
-										
-									},
-									error: function(jqXHR, textStatus, errorThrown){
-										alert('error en pdfs/resenas: ' + textStatus);
-										$("#respuesta").html("error en pdfs/resenas: " + textStatus);
-									}
-								});
-				        					        		
-				      			}, function(err) {
-					        		log_text("sign() failed: " + err);
-
-									var error;
-                                    log_text("sign() failed: " + err);
-                                    if(err == "Error: user_cancel") {
-                                        alert("sign() failed: El usuario cancelo la operación");
-                                        error = "El usuario cancelo la operación"; 
-                                     }      
-                                     else if(err == "Error: no_certificates") {
-                                         alert("sign() failed: No hay certificado disponible");
-                                         error = "No hay certificado disponible";
-                                     }
-                                     else if(err == "Error: no_implementation") {
-                                         alert("sign() failed: No hay soporte para el manejo del certificado");
-                                         error = "No hay soporte para el manejo del certificado";
-                                     }
-
-					        		//alert("sign() failed: " + err);
-					        		$("#respuesta").html("sign() failed: " + error);
-				    	  	});
-							
-						},								
-						error: function(jqXHR, textStatus, errorThrown){
-							//alert('error: ' + textStatus);
-							//var responseText = jQuery.parseJSON(jqXHR.responseText);
-							alert('ajax error function: ' + jqXHR.responseText);
-							$("#respuesta").html("error function: " + jqXHR.responseText);
-						}
-						
-				
-					});
-					
-					
-					
-				}, function(err) {
-		      			log_text("getCertificate() failed: " + err);
-                        var error;
-                        if(err == "Error: user_cancel") {
-                            alert("getCertificate() failed: El usuario cancelo la operación"    );
-                            error = "El usuario cancelo la operación"; 
-                         }      
-                         else if(err == "Error: no_certificates") {
-                             alert("getCertificate() failed: No hay certificado disponible")    ;
-                             error = "No hay certificado disponible";
-                         }
-                         else if(err == "Error: no_implementation") {
-                             alert("getCertificate() failed: No hay soporte para el manejo del certificado");
-                             error = "No hay soporte para el manejo del certificado";
-						}
-		      			//alert("getCertificate() failed: " + err);
-		      			$("#respuesta").html("getCertificate() failed: " + error);
-		    		});
-				
-				
     	    },
      		error: function(response) {
@@ -159,9 +139,4 @@
 			}
     });
-	
-
-
-
-
 
 });
Index: prototipo/static/js/functions/manejoJsonPDF.js
===================================================================
--- prototipo/static/js/functions/manejoJsonPDF.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/functions/manejoJsonPDF.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,92 @@
+function manejoJsonPDF(json) {
+	
+	var fielJsonEs = {fileId: "Identificador único del archivo en el servidor", fileExist:"El archivo se cargó exitosamente en el servidor", mimeType:"Tipo MIME del archivo verificado", error:"Extension not supported. En caso de que el archivo sea diferente de PDF y BDOC", numberOfSignatures:"Número de firmas existentes en el archivo", signatures:"Lista de firmas", signatureType:"Tipo de firma de archivo PDF", signedOn:"Fecha en que se realiza la firma", integrityCheck:"Chequea la integridad de la firma", timeStamp:"Estampilla de tiempo", reason:"Razón de la firma", location:"Ubicación donde se realiza la firma", alternativeNameOfTheSigner:"Nombre alternativo del firmante", signerCertificateValidFrom:"Fecha de inicio de validez del certificado", signerCertificateStillValid:"El certificado todavía está válido", signerCertificateHasExpired:"El certificado expiró", signatureCoversWholeDocument:"La firma abarca todo el documento PDF", filterSubtype:"Tipo de subfiltro: /adbe.pkcs7.sha1, /adbe.pkcs7.detached", signerCertificateSubject:"Sujeto firmante", signerCertificateValidAtTimeOfSigning:"El certificado es válido en el momento de la firma", encryptionAlgorithm:"Algoritmo de cifrado", timeStampService:"Servicio de estampillado de tiempo", digestAlgorithm:"Algoritmo hash (reseña)", certificatesVerifiedAgainstTheKeyStore:"Certificado verificado contra el repositorio de certificados confiables", documentRevision:"Número de revisión del documento PDF", nameOfTheSigner:"Nombre del firmante", totalDocumentRevisions:"Número total de revisiones del documento PDF", contactInfo:"Información de contacto del firmante", timeStampVerified:"Estampilla de tiempo verificada", signerCertificateIssuer:"Emisor del certificado firmante", signerCertificateValidTo:"Fecha de fin de validez del certificado", signerCertificateSerial:"BDOC: Serial del certificado del firmante", signatureProfile:"BDOC: Perfil de la firma", signatureMethod:"BDOC: Algoritmo de firma utilizado", signatureId:"BDOC: identificador de la firma", signatureSigningTime:"Fecha en que se realiza la firma", signerCertificateIsValid:"El certificado todavía está válido", signatureValidationException:"BDOC: Exepciones de la validación de la firma", isValid:"BDOC: Firma electrónica válida", signerCertificateSubjectName:"Nombre del firmante", containerValidation:"BDOC: Especifica si el contenedor posee una estructura válida", numberOfDataFiles:"BDOC: Cantidad de archivos incluidos en el contenedor BDOC", dataFiles:"BDOC: Lista de archivos incluidos en el contenedor", name:"BDOC: Nombre del archivo incluido en el contenedor", dataFileSize:"BDOC: Tamaño del archivo incluido en el contenedor", filename:"BDOC: Nombre del archivo incluido en el contenedor", mediaType:"BDOC: Tipo MIME del archivo incluido en el contenedor"};
+	var objVarVerifique = JSON.parse(json);
+	var signatures = ''; //variable que maneja las firmas
+	var fields = ''; //variable que maneja los campos de la firma
+	var title = '<h2> Información de la firma electronica </h2> \n ';
+	var head = '<div class=\'container\'> \n <table id=\' \' class=\'display table table-striped table-bordered\' cellspacing=\'0\' width=\'100%\' > \n <thead> \n <tr>\n <th>#</th>\n <th>Campo</th>\n <th>Descripción</th> \n </tr>\n </thead>\n <tbody> \n';
+	var footer = '</tbody> \n </table> \n </div> \n </div>';
+	var html = title;
+	var numsign = 0; 
+    var htmltemp = '';
+    var objxEsp = '';
+
+	$.each(objVarVerifique, function(idx, obj) {
+		
+		if(idx == "error") {
+			html = '<h4> Extensión no soportada, verifique el archivo </h4>';       
+            return(html);
+        }
+            
+		if(idx == "numberOfSignatures"){
+			numsign = obj;
+			html += '<h4>' + fielJsonEs[idx] + ': ' + obj +' </h4>\n <br><br>';
+		}
+			
+		if(idx == "signatures") { 
+			signatures = obj; //se almacena la(s) cabecera(s) de las firmas
+		}
+	});
+				
+	var contsing = 1; // variable que indica la firma donde esta posicionado 
+				
+	<!-- recorre las firmas signatures -->
+
+	$.each(signatures, function(idx, obj) {	
+		html += '<h4> Información de la firma: '+contsing+'<h4> \n';
+		html += head;
+		var contfiels = 8; // variable que indica el campo de la firma -- arranca en el campo 6 porque necesitamos que muestre de primero las 5 campos requeridos
+		fields = obj; // variable que almacena los campos de la firma
+		$.each(fields, function(id, objx) {
+
+			<!-- Recorreo los campos de la firma -->
+	        //alert('entro firma: ' + fielJsonEs[id]);
+	        if(fielJsonEs[id]=='Nombre del firmante') {
+	            //alert('entro campos de firma');
+				html += '<tr>\n<td>'+'1'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objx +' </td>\n</tr>\n';
+				//contfiels++;
+			}
+            else if(fielJsonEs[id]=='Fecha en que se realiza la firma') {
+                //alert('entro campos de firma');
+                html += '<tr>\n<td>'+'2'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objx +'     </td>\n</tr>\n';
+                //contfiels++;
+            }
+			else if(fielJsonEs[id]=='Chequea la integridad de la firma') {
+			    //alert('entro campos de firma');
+			    if(objx == 'true') { objxEsp = 'verdadero';}                                                                                                  else {objxEsp='falso';}
+			    html += '<tr>\n<td>'+'3'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objxEsp +'         </td>\n</tr>\n';
+				//contfiels++;
+			}
+			else if(fielJsonEs[id]=='El certificado todavía está válido') {
+			     if(objx == 'true') { objxEsp = 'verdadero';}                                                                                                  else {objxEsp='falso';}
+			     html += '<tr>\n<td>'+'4'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objxEsp +'             </td>\n</tr>\n';
+			     //contfiels++;
+			}  
+			else if(fielJsonEs[id]=='Fecha de inicio de validez del certificado') {
+			     html += '<tr>\n<td>'+'5'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objx +'             </td>\n</tr>\n';
+			     //contfiels++;
+			}  	
+			else if(fielJsonEs[id]=='Fecha de fin de validez del certificado') {
+			     html += '<tr>\n<td>'+'6'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objx +'             </td>\n</tr>\n';
+			     //contfiels++;
+			} 
+			else if(fielJsonEs[id]=='El certificado es válido en el momento de la firma') {
+			     if(objx == 'true') { objxEsp = 'verdadero';}                                                                                                  else {objxEsp='falso';}
+			     html += '<tr>\n<td>'+'7'+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objxEsp +'             </td>\n</tr>\n';
+			     //contfiels++;
+			}  
+	        else { if(objx == 'true' ) { htmltemp += '<tr>\n<td>'+contfiels+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td    >' + 'verdadero' +' </td>\n</tr>\n';}
+	        	else if(objx == 'false')  { htmltemp += '<tr>\n<td>'+contfiels+'</td>\n<td>' + fielJsonEs[id    ] + '</td>\n<td    >' + 'falso' +' </td>\n</tr>\n';}
+	        	else { htmltemp += '<tr>\n<td>'+contfiels+'</td>\n<td>' + fielJsonEs[id] + '</td>\n<td>' + objx +' </td>\n</tr>\n'; }
+				contfiels++;
+			}     
+		});
+		contsing++;	
+        html += htmltemp;
+        htmltemp = '';              
+		html += footer;
+	});
+	
+	return(html);
+}
Index: prototipo/static/js/hwcrypto/gitversion.js
===================================================================
--- prototipo/static/js/hwcrypto/gitversion.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/hwcrypto/gitversion.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,1 @@
+var publishedGitVersion='0.0.10';
Index: prototipo/static/js/hwcrypto/hex2base.js
===================================================================
--- prototipo/static/js/hwcrypto/hex2base.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/hwcrypto/hex2base.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,45 @@
+// FIXME: origin unknown
+if (!window.atob) {
+  var tableStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+  var table = tableStr.split("");
+
+  window.atob = function (base64) {
+    if (/(=[^=]+|={3,})$/.test(base64)) throw new Error("String contains an invalid character");
+    base64 = base64.replace(/=/g, "");
+    var n = base64.length & 3;
+    if (n === 1) throw new Error("String contains an invalid character");
+    for (var i = 0, j = 0, len = base64.length / 4, bin = []; i < len; ++i) {
+      var a = tableStr.indexOf(base64[j++] || "A"), b = tableStr.indexOf(base64[j++] || "A");
+      var c = tableStr.indexOf(base64[j++] || "A"), d = tableStr.indexOf(base64[j++] || "A");
+      if ((a | b | c | d) < 0) throw new Error("String contains an invalid character");
+      bin[bin.length] = ((a << 2) | (b >> 4)) & 255;
+      bin[bin.length] = ((b << 4) | (c >> 2)) & 255;
+      bin[bin.length] = ((c << 6) | d) & 255;
+    };
+    return String.fromCharCode.apply(null, bin).substr(0, bin.length + n - 4);
+  };
+
+  window.btoa = function (bin) {
+    for (var i = 0, j = 0, len = bin.length / 3, base64 = []; i < len; ++i) {
+      var a = bin.charCodeAt(j++), b = bin.charCodeAt(j++), c = bin.charCodeAt(j++);
+      if ((a | b | c) > 255) throw new Error("String contains an invalid character");
+      base64[base64.length] = table[a >> 2] + table[((a << 4) & 63) | (b >> 4)] +
+                              (isNaN(b) ? "=" : table[((b << 2) & 63) | (c >> 6)]) +
+                              (isNaN(b + c) ? "=" : table[c & 63]);
+    }
+    return base64.join("");
+  };
+
+}
+
+function hexToBase64(str) {
+  return btoa(String.fromCharCode.apply(null,
+    str.replace(/\r|\n/g, "").replace(/([\da-fA-F]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))
+  );
+}
+
+function hexToPem(s) {
+   var b = hexToBase64(s);
+   var pem = b.match(/.{1,64}/g).join("\n");
+   return "-----BEGIN CERTIFICATE-----\n" + pem + "\n-----END CERTIFICATE-----"; 
+}
Index: prototipo/static/js/hwcrypto/hwcrypto-legacy.js
===================================================================
--- prototipo/static/js/hwcrypto/hwcrypto-legacy.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/hwcrypto/hwcrypto-legacy.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,2 @@
+/* Legacy dependencies for hwcrypto.js 0.0.10 generated on 2015-04-17 */
+!function(a){"use strict";function b(a){switch(typeof a){case"undefined":return"undefined";case"boolean":return"boolean";case"number":return"number";case"string":return"string";default:return null===a?"null":"object"}}function c(a){return Object.prototype.toString.call(a).replace(/^\[object *|\]$/g,"")}function d(a){return"function"==typeof a}function e(a){if(null===a||a===D)throw TypeError();return Object(a)}function f(a){return a>>0}function g(a){return a>>>0}function h(a){function b(b){Object.defineProperty(a,b,{get:function(){return a._getter(b)},set:function(c){a._setter(b,c)},enumerable:!0,configurable:!1})}if(a.length>E)throw RangeError("Array too large for polyfill");var c;for(c=0;c<a.length;c+=1)b(c)}function i(a,b){var c=32-b;return a<<c>>c}function j(a,b){var c=32-b;return a<<c>>>c}function k(a){return[255&a]}function l(a){return i(a[0],8)}function m(a){return[255&a]}function n(a){return j(a[0],8)}function o(a){return a=M(Number(a)),[0>a?0:a>255?255:255&a]}function p(a){return[a>>8&255,255&a]}function q(a){return i(a[0]<<8|a[1],16)}function r(a){return[a>>8&255,255&a]}function s(a){return j(a[0]<<8|a[1],16)}function t(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]}function u(a){return i(a[0]<<24|a[1]<<16|a[2]<<8|a[3],32)}function v(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]}function w(a){return j(a[0]<<24|a[1]<<16|a[2]<<8|a[3],32)}function x(a,b,c){function d(a){var b=H(a),c=a-b;return.5>c?b:c>.5?b+1:b%2?b+1:b}var e,f,g,h,i,j,k,l=(1<<b-1)-1;for(a!==a?(f=(1<<b)-1,g=L(2,c-1),e=0):a===1/0||a===-(1/0)?(f=(1<<b)-1,g=0,e=0>a?1:0):0===a?(f=0,g=0,e=1/a===-(1/0)?1:0):(e=0>a,a=G(a),a>=L(2,1-l)?(f=K(H(I(a)/F),1023),g=d(a/L(2,f)*L(2,c)),g/L(2,c)>=2&&(f+=1,g=1),f>l?(f=(1<<b)-1,g=0):(f+=l,g-=L(2,c))):(f=0,g=d(a/L(2,1-l-c)))),i=[],h=c;h;h-=1)i.push(g%2?1:0),g=H(g/2);for(h=b;h;h-=1)i.push(f%2?1:0),f=H(f/2);for(i.push(e?1:0),i.reverse(),j=i.join(""),k=[];j.length;)k.push(parseInt(j.substring(0,8),2)),j=j.substring(8);return k}function y(a,b,c){var d,e,f,g,h,i,j,k,l=[];for(d=a.length;d;d-=1)for(f=a[d-1],e=8;e;e-=1)l.push(f%2?1:0),f>>=1;return l.reverse(),g=l.join(""),h=(1<<b-1)-1,i=parseInt(g.substring(0,1),2)?-1:1,j=parseInt(g.substring(1,1+b),2),k=parseInt(g.substring(1+b),2),j===(1<<b)-1?0!==k?0/0:i*(1/0):j>0?i*L(2,j-h)*(1+k/L(2,c)):0!==k?i*L(2,-(h-1))*(k/L(2,c)):0>i?-0:0}function z(a){return y(a,11,52)}function A(a){return x(a,11,52)}function B(a){return y(a,8,23)}function C(a){return x(a,8,23)}var D=void 0,E=1e5,F=Math.LN2,G=Math.abs,H=Math.floor,I=Math.log,J=Math.max,K=Math.min,L=Math.pow,M=Math.round;!function(){var a=Object.defineProperty,b=!function(){try{return Object.defineProperty({},"x",{})}catch(a){return!1}}();(!a||b)&&(Object.defineProperty=function(b,c,d){if(a)try{return a(b,c,d)}catch(e){}if(b!==Object(b))throw TypeError("Object.defineProperty called on non-object");return Object.prototype.__defineGetter__&&"get"in d&&Object.prototype.__defineGetter__.call(b,c,d.get),Object.prototype.__defineSetter__&&"set"in d&&Object.prototype.__defineSetter__.call(b,c,d.set),"value"in d&&(b[c]=d.value),b})}(),function(){function i(a){if(a=f(a),0>a)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:a}),Object.defineProperty(this,"_bytes",{value:Array(a)});for(var b=0;a>b;b+=1)this._bytes[b]=0}function j(){if(!arguments.length||"object"!=typeof arguments[0])return function(a){if(a=f(a),0>a)throw RangeError("length is not a small enough positive integer.");Object.defineProperty(this,"length",{value:a}),Object.defineProperty(this,"byteLength",{value:a*this.BYTES_PER_ELEMENT}),Object.defineProperty(this,"buffer",{value:new i(this.byteLength)}),Object.defineProperty(this,"byteOffset",{value:0})}.apply(this,arguments);if(arguments.length>=1&&"object"===b(arguments[0])&&arguments[0]instanceof j)return function(a){if(this.constructor!==a.constructor)throw TypeError();var b=a.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new i(b)}),Object.defineProperty(this,"byteLength",{value:b}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:a.length});for(var c=0;c<this.length;c+=1)this._setter(c,a._getter(c))}.apply(this,arguments);if(arguments.length>=1&&"object"===b(arguments[0])&&!(arguments[0]instanceof j)&&!(arguments[0]instanceof i||"ArrayBuffer"===c(arguments[0])))return function(a){var b=a.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new i(b)}),Object.defineProperty(this,"byteLength",{value:b}),Object.defineProperty(this,"byteOffset",{value:0}),Object.defineProperty(this,"length",{value:a.length});for(var c=0;c<this.length;c+=1){var d=a[c];this._setter(c,Number(d))}}.apply(this,arguments);if(arguments.length>=1&&"object"===b(arguments[0])&&(arguments[0]instanceof i||"ArrayBuffer"===c(arguments[0])))return function(a,b,c){if(b=g(b),b>a.byteLength)throw RangeError("byteOffset out of range");if(b%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size.");if(c===D){var d=a.byteLength-b;if(d%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");c=d/this.BYTES_PER_ELEMENT}else c=g(c),d=c*this.BYTES_PER_ELEMENT;if(b+d>a.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:a}),Object.defineProperty(this,"byteLength",{value:d}),Object.defineProperty(this,"byteOffset",{value:b}),Object.defineProperty(this,"length",{value:c})}.apply(this,arguments);throw TypeError()}function x(a,b,c){var d=function(){Object.defineProperty(this,"constructor",{value:d}),j.apply(this,arguments),h(this)};"__proto__"in d?d.__proto__=j:(d.from=j.from,d.of=j.of),d.BYTES_PER_ELEMENT=a;var e=function(){};return e.prototype=y,d.prototype=new e,Object.defineProperty(d.prototype,"BYTES_PER_ELEMENT",{value:a}),Object.defineProperty(d.prototype,"_pack",{value:b}),Object.defineProperty(d.prototype,"_unpack",{value:c}),d}a.ArrayBuffer=a.ArrayBuffer||i,Object.defineProperty(j,"from",{value:function(a){return new this(a)}}),Object.defineProperty(j,"of",{value:function(){return new this(arguments)}});var y={};j.prototype=y,Object.defineProperty(j.prototype,"_getter",{value:function(a){if(arguments.length<1)throw SyntaxError("Not enough arguments");if(a=g(a),a>=this.length)return D;var b,c,d=[];for(b=0,c=this.byteOffset+a*this.BYTES_PER_ELEMENT;b<this.BYTES_PER_ELEMENT;b+=1,c+=1)d.push(this.buffer._bytes[c]);return this._unpack(d)}}),Object.defineProperty(j.prototype,"get",{value:j.prototype._getter}),Object.defineProperty(j.prototype,"_setter",{value:function(a,b){if(arguments.length<2)throw SyntaxError("Not enough arguments");if(a=g(a),!(a>=this.length)){var c,d,e=this._pack(b);for(c=0,d=this.byteOffset+a*this.BYTES_PER_ELEMENT;c<this.BYTES_PER_ELEMENT;c+=1,d+=1)this.buffer._bytes[d]=e[c]}}}),Object.defineProperty(j.prototype,"constructor",{value:j}),Object.defineProperty(j.prototype,"copyWithin",{value:function(a,b){var c=arguments[2],d=e(this),h=d.length,i=g(h);i=J(i,0);var j,k=f(a);j=0>k?J(i+k,0):K(k,i);var l,m=f(b);l=0>m?J(i+m,0):K(m,i);var n;n=c===D?i:f(c);var o;o=0>n?J(i+n,0):K(n,i);var p,q=K(o-l,i-j);for(j>l&&l+q>j?(p=-1,l=l+q-1,j=j+q-1):p=1;q>0;)d._setter(j,d._getter(l)),l+=p,j+=p,q-=1;return d}}),Object.defineProperty(j.prototype,"every",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();for(var e=arguments[1],f=0;c>f;f++)if(!a.call(e,b._getter(f),f,b))return!1;return!0}}),Object.defineProperty(j.prototype,"fill",{value:function(a){var b=arguments[1],c=arguments[2],d=e(this),h=d.length,i=g(h);i=J(i,0);var j,k=f(b);j=0>k?J(i+k,0):K(k,i);var l;l=c===D?i:f(c);var m;for(m=0>l?J(i+l,0):K(l,i);m>j;)d._setter(j,a),j+=1;return d}}),Object.defineProperty(j.prototype,"filter",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();for(var e=[],f=arguments[1],h=0;c>h;h++){var i=b._getter(h);a.call(f,i,h,b)&&e.push(i)}return new this.constructor(e)}}),Object.defineProperty(j.prototype,"find",{value:function(a){var b=e(this),c=b.length,f=g(c);if(!d(a))throw TypeError();for(var h=arguments.length>1?arguments[1]:D,i=0;f>i;){var j=b._getter(i),k=a.call(h,j,i,b);if(Boolean(k))return j;++i}return D}}),Object.defineProperty(j.prototype,"findIndex",{value:function(a){var b=e(this),c=b.length,f=g(c);if(!d(a))throw TypeError();for(var h=arguments.length>1?arguments[1]:D,i=0;f>i;){var j=b._getter(i),k=a.call(h,j,i,b);if(Boolean(k))return i;++i}return-1}}),Object.defineProperty(j.prototype,"forEach",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();for(var e=arguments[1],f=0;c>f;f++)a.call(e,b._getter(f),f,b)}}),Object.defineProperty(j.prototype,"indexOf",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(0===c)return-1;var d=0;if(arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*H(G(d)))),d>=c)return-1;for(var e=d>=0?d:J(c-G(d),0);c>e;e++)if(b._getter(e)===a)return e;return-1}}),Object.defineProperty(j.prototype,"join",{value:function(a){if(this===D||null===this)throw TypeError();for(var b=Object(this),c=g(b.length),d=Array(c),e=0;c>e;++e)d[e]=b._getter(e);return d.join(a===D?",":a)}}),Object.defineProperty(j.prototype,"lastIndexOf",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(0===c)return-1;var d=c;arguments.length>1&&(d=Number(arguments[1]),d!==d?d=0:0!==d&&d!==1/0&&d!==-(1/0)&&(d=(d>0||-1)*H(G(d))));for(var e=d>=0?K(d,c-1):c-G(d);e>=0;e--)if(b._getter(e)===a)return e;return-1}}),Object.defineProperty(j.prototype,"map",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();var e=[];e.length=c;for(var f=arguments[1],h=0;c>h;h++)e[h]=a.call(f,b._getter(h),h,b);return new this.constructor(e)}}),Object.defineProperty(j.prototype,"reduce",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();if(0===c&&1===arguments.length)throw TypeError();var e,f=0;for(e=arguments.length>=2?arguments[1]:b._getter(f++);c>f;)e=a.call(D,e,b._getter(f),f,b),f++;return e}}),Object.defineProperty(j.prototype,"reduceRight",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();if(0===c&&1===arguments.length)throw TypeError();var e,f=c-1;for(e=arguments.length>=2?arguments[1]:b._getter(f--);f>=0;)e=a.call(D,e,b._getter(f),f,b),f--;return e}}),Object.defineProperty(j.prototype,"reverse",{value:function(){if(this===D||null===this)throw TypeError();for(var a=Object(this),b=g(a.length),c=H(b/2),d=0,e=b-1;c>d;++d,--e){var f=a._getter(d);a._setter(d,a._getter(e)),a._setter(e,f)}return a}}),Object.defineProperty(j.prototype,"set",{value:function(){if(arguments.length<1)throw SyntaxError("Not enough arguments");var a,b,c,d,e,f,h,i,j,k;if("object"==typeof arguments[0]&&arguments[0].constructor===this.constructor){if(a=arguments[0],c=g(arguments[1]),c+a.length>this.length)throw RangeError("Offset plus length of array is out of range");if(i=this.byteOffset+c*this.BYTES_PER_ELEMENT,j=a.length*this.BYTES_PER_ELEMENT,a.buffer===this.buffer){for(k=[],e=0,f=a.byteOffset;j>e;e+=1,f+=1)k[e]=a.buffer._bytes[f];for(e=0,h=i;j>e;e+=1,h+=1)this.buffer._bytes[h]=k[e]}else for(e=0,f=a.byteOffset,h=i;j>e;e+=1,f+=1,h+=1)this.buffer._bytes[h]=a.buffer._bytes[f]}else{if("object"!=typeof arguments[0]||"undefined"==typeof arguments[0].length)throw TypeError("Unexpected argument type(s)");if(b=arguments[0],d=g(b.length),c=g(arguments[1]),c+d>this.length)throw RangeError("Offset plus length of array is out of range");for(e=0;d>e;e+=1)f=b[e],this._setter(c+e,Number(f))}}}),Object.defineProperty(j.prototype,"slice",{value:function(a,b){for(var c=e(this),d=c.length,h=g(d),i=f(a),j=0>i?J(h+i,0):K(i,h),k=b===D?h:f(b),l=0>k?J(h+k,0):K(k,h),m=l-j,n=c.constructor,o=new n(m),p=0;l>j;){var q=c._getter(j);o._setter(p,q),++j,++p}return o}}),Object.defineProperty(j.prototype,"some",{value:function(a){if(this===D||null===this)throw TypeError();var b=Object(this),c=g(b.length);if(!d(a))throw TypeError();for(var e=arguments[1],f=0;c>f;f++)if(a.call(e,b._getter(f),f,b))return!0;return!1}}),Object.defineProperty(j.prototype,"sort",{value:function(a){if(this===D||null===this)throw TypeError();for(var b=Object(this),c=g(b.length),d=Array(c),e=0;c>e;++e)d[e]=b._getter(e);for(a?d.sort(a):d.sort(),e=0;c>e;++e)b._setter(e,d[e]);return b}}),Object.defineProperty(j.prototype,"subarray",{value:function(a,b){function c(a,b,c){return b>a?b:a>c?c:a}a=f(a),b=f(b),arguments.length<1&&(a=0),arguments.length<2&&(b=this.length),0>a&&(a=this.length+a),0>b&&(b=this.length+b),a=c(a,0,this.length),b=c(b,0,this.length);var d=b-a;return 0>d&&(d=0),new this.constructor(this.buffer,this.byteOffset+a*this.BYTES_PER_ELEMENT,d)}});var E=x(1,k,l),F=x(1,m,n),I=x(1,o,n),L=x(2,p,q),M=x(2,r,s),N=x(4,t,u),O=x(4,v,w),P=x(4,C,B),Q=x(8,A,z);a.Int8Array=a.Int8Array||E,a.Uint8Array=a.Uint8Array||F,a.Uint8ClampedArray=a.Uint8ClampedArray||I,a.Int16Array=a.Int16Array||L,a.Uint16Array=a.Uint16Array||M,a.Int32Array=a.Int32Array||N,a.Uint32Array=a.Uint32Array||O,a.Float32Array=a.Float32Array||P,a.Float64Array=a.Float64Array||Q}(),function(){function b(a,b){return d(a.get)?a.get(b):a[b]}function e(a,b,d){if(!(a instanceof ArrayBuffer||"ArrayBuffer"===c(a)))throw TypeError();if(b=g(b),b>a.byteLength)throw RangeError("byteOffset out of range");if(d=d===D?a.byteLength-b:g(d),b+d>a.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");Object.defineProperty(this,"buffer",{value:a}),Object.defineProperty(this,"byteLength",{value:d}),Object.defineProperty(this,"byteOffset",{value:b})}function f(a){return function(c,d){if(c=g(c),c+a.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");c+=this.byteOffset;for(var e=new Uint8Array(this.buffer,c,a.BYTES_PER_ELEMENT),f=[],h=0;h<a.BYTES_PER_ELEMENT;h+=1)f.push(b(e,h));return Boolean(d)===Boolean(i)&&f.reverse(),b(new a(new Uint8Array(f).buffer),0)}}function h(a){return function(c,d,e){if(c=g(c),c+a.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");var f,h,j=new a([d]),k=new Uint8Array(j.buffer),l=[];for(f=0;f<a.BYTES_PER_ELEMENT;f+=1)l.push(b(k,f));Boolean(e)===Boolean(i)&&l.reverse(),h=new Uint8Array(this.buffer,c,a.BYTES_PER_ELEMENT),h.set(l)}}var i=function(){var a=new Uint16Array([4660]),c=new Uint8Array(a.buffer);return 18===b(c,0)}();Object.defineProperty(e.prototype,"getUint8",{value:f(Uint8Array)}),Object.defineProperty(e.prototype,"getInt8",{value:f(Int8Array)}),Object.defineProperty(e.prototype,"getUint16",{value:f(Uint16Array)}),Object.defineProperty(e.prototype,"getInt16",{value:f(Int16Array)}),Object.defineProperty(e.prototype,"getUint32",{value:f(Uint32Array)}),Object.defineProperty(e.prototype,"getInt32",{value:f(Int32Array)}),Object.defineProperty(e.prototype,"getFloat32",{value:f(Float32Array)}),Object.defineProperty(e.prototype,"getFloat64",{value:f(Float64Array)}),Object.defineProperty(e.prototype,"setUint8",{value:h(Uint8Array)}),Object.defineProperty(e.prototype,"setInt8",{value:h(Int8Array)}),Object.defineProperty(e.prototype,"setUint16",{value:h(Uint16Array)}),Object.defineProperty(e.prototype,"setInt16",{value:h(Int16Array)}),Object.defineProperty(e.prototype,"setUint32",{value:h(Uint32Array)}),Object.defineProperty(e.prototype,"setInt32",{value:h(Int32Array)}),Object.defineProperty(e.prototype,"setFloat32",{value:h(Float32Array)}),Object.defineProperty(e.prototype,"setFloat64",{value:h(Float64Array)}),a.DataView=a.DataView||e}()}(this),function(a,b,c){b[a]=b[a]||c(),"undefined"!=typeof module&&module.exports?module.exports=b[a]:"function"==typeof define&&define.amd&&define(function(){return b[a]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function a(a,b){m.add(a,b),l||(l=o(m.drain))}function b(a){var b,c=typeof a;return null==a||"object"!=c&&"function"!=c||(b=a.then),"function"==typeof b?b:!1}function c(){for(var a=0;a<this.chain.length;a++)d(this,1===this.state?this.chain[a].success:this.chain[a].failure,this.chain[a]);this.chain.length=0}function d(a,c,d){var e,f;try{c===!1?d.reject(a.msg):(e=c===!0?a.msg:c.call(void 0,a.msg),e===d.promise?d.reject(TypeError("Promise-chain cycle")):(f=b(e))?f.call(e,d.resolve,d.reject):d.resolve(e))}catch(g){d.reject(g)}}function e(d){var g,i,j=this;if(!j.triggered){j.triggered=!0,j.def&&(j=j.def);try{(g=b(d))?(i=new h(j),g.call(d,function(){e.apply(i,arguments)},function(){f.apply(i,arguments)})):(j.msg=d,j.state=1,j.chain.length>0&&a(c,j))}catch(k){f.call(i||new h(j),k)}}}function f(b){var d=this;d.triggered||(d.triggered=!0,d.def&&(d=d.def),d.msg=b,d.state=2,d.chain.length>0&&a(c,d))}function g(a,b,c,d){for(var e=0;e<b.length;e++)!function(e){a.resolve(b[e]).then(function(a){c(e,a)},d)}(e)}function h(a){this.def=a,this.triggered=!1}function i(a){this.promise=a,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function j(b){if("function"!=typeof b)throw TypeError("Not a function");if(0!==this.__NPO__)throw TypeError("Not a promise");this.__NPO__=1;var d=new i(this);this.then=function(b,e){var f={success:"function"==typeof b?b:!0,failure:"function"==typeof e?e:!1};return f.promise=new this.constructor(function(a,b){if("function"!=typeof a||"function"!=typeof b)throw TypeError("Not a function");f.resolve=a,f.reject=b}),d.chain.push(f),0!==d.state&&a(c,d),f.promise},this["catch"]=function(a){return this.then(void 0,a)};try{b.call(void 0,function(a){e.call(d,a)},function(a){f.call(d,a)})}catch(g){f.call(d,g)}}var k,l,m,n=Object.prototype.toString,o="undefined"!=typeof setImmediate?function(a){return setImmediate(a)}:setTimeout;try{Object.defineProperty({},"x",{}),k=function(a,b,c,d){return Object.defineProperty(a,b,{value:c,writable:!0,configurable:d!==!1})}}catch(p){k=function(a,b,c){return a[b]=c,a}}m=function(){function a(a,b){this.fn=a,this.self=b,this.next=void 0}var b,c,d;return{add:function(e,f){d=new a(e,f),c?c.next=d:b=d,c=d,d=void 0},drain:function(){var a=b;for(b=c=l=void 0;a;)a.fn.call(a.self),a=a.next}}}();var q=k({},"constructor",j,!1);return k(j,"prototype",q,!1),k(q,"__NPO__",0,!1),k(j,"resolve",function(a){var b=this;return a&&"object"==typeof a&&1===a.__NPO__?a:new b(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");b(a)})}),k(j,"reject",function(a){return new this(function(b,c){if("function"!=typeof b||"function"!=typeof c)throw TypeError("Not a function");c(a)})}),k(j,"all",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):0===a.length?b.resolve([]):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");var e=a.length,f=Array(e),h=0;g(b,a,function(a,b){f[a]=b,++h===e&&c(f)},d)})}),k(j,"race",function(a){var b=this;return"[object Array]"!=n.call(a)?b.reject(TypeError("Not an array")):new b(function(c,d){if("function"!=typeof c||"function"!=typeof d)throw TypeError("Not a function");g(b,a,function(a,b){c(b)},d)})}),j});
Index: prototipo/static/js/hwcrypto/hwcrypto.js
===================================================================
--- prototipo/static/js/hwcrypto/hwcrypto.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/hwcrypto/hwcrypto.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,325 @@
+/*! This is hwcrypto.js 0.0.10 generated on 2015-04-17 */
+/* DO NOT EDIT (use src/hwcrypto.js) */
+var hwcrypto = function hwcrypto() {
+    "use strict";
+    var _debug = function(x) {};
+    _debug("hwcrypto.js activated");
+    window.addEventListener = window.addEventListener || window.attachEvent;
+    function hasPluginFor(mime) {
+        if (navigator.mimeTypes && mime in navigator.mimeTypes) {
+            return true;
+        }
+        return false;
+    }
+    function hasExtensionFor(cls) {
+        if (typeof window[cls] === "function") return true;
+        return false;
+    }
+    function _hex2array(str) {
+        if (typeof str == "string") {
+            var len = Math.floor(str.length / 2);
+            var ret = new Uint8Array(len);
+            for (var i = 0; i < len; i++) {
+                ret[i] = parseInt(str.substr(i * 2, 2), 16);
+            }
+            return ret;
+        }
+    }
+    function _array2hex(args) {
+        var ret = "";
+        for (var i = 0; i < args.length; i++) ret += (args[i] < 16 ? "0" : "") + args[i].toString(16);
+        return ret.toLowerCase();
+    }
+    function _mimeid(mime) {
+        return "hwc" + mime.replace("/", "").replace("-", "");
+    }
+    function loadPluginFor(mime) {
+        var element = _mimeid(mime);
+        if (document.getElementById(element)) {
+            _debug("Plugin element already loaded");
+            return document.getElementById(element);
+        }
+        _debug("Loading plugin for " + mime + " into " + element);
+        var objectTag = '<object id="' + element + '" type="' + mime + '" style="width: 1px; height: 1px; position: absolute; visibility: hidden;"></object>';
+        var div = document.createElement("div");
+        div.setAttribute("id", "pluginLocation" + element);
+        document.body.appendChild(div);
+        document.getElementById("pluginLocation" + element).innerHTML = objectTag;
+        return document.getElementById(element);
+    }
+    var digidoc_mime = "application/x-digidoc";
+    var digidoc_chrome = "TokenSigning";
+    var USER_CANCEL = "user_cancel";
+    var NO_CERTIFICATES = "no_certificates";
+    var INVALID_ARGUMENT = "invalid_argument";
+    var TECHNICAL_ERROR = "technical_error";
+    var NO_IMPLEMENTATION = "no_implementation";
+    var NOT_ALLOWED = "not_allowed";
+    function probe() {
+        var msg = "probe() detected ";
+        if (hasExtensionFor(digidoc_chrome)) {
+            _debug(msg + digidoc_chrome);
+        }
+        if (hasPluginFor(digidoc_mime)) {
+            _debug(msg + digidoc_mime);
+        }
+    }
+    window.addEventListener("load", function(event) {
+        probe();
+    });
+    function DigiDocPlugin() {
+        this._name = "NPAPI/BHO for application/x-digidoc";
+        var p = loadPluginFor(digidoc_mime);
+        var certificate_ids = {};
+        function code2str(err) {
+            _debug("Error: " + err + " with: " + p.errorMessage);
+            switch (parseInt(err)) {
+              case 1:
+                return USER_CANCEL;
+
+              case 2:
+                return INVALID_ARGUMENT;
+
+              case 17:
+                return INVALID_ARGUMENT;
+
+              case 19:
+                return NOT_ALLOWED;
+
+              default:
+                _debug("Unknown error: " + err + " with: " + p.errorMessage);
+                return TECHNICAL_ERROR;
+            }
+        }
+        function code2err(err) {
+            return new Error(code2str(err));
+        }
+        this.check = function() {
+            return new Promise(function(resolve, reject) {
+                setTimeout(function() {
+                    resolve(typeof p.version !== "undefined");
+                }, 0);
+            });
+        };
+        this.getVersion = function() {
+            return new Promise(function(resolve, reject) {
+                var v = p.version;
+                resolve(v);
+            });
+        };
+        this.getCertificate = function(options) {
+            if (options && options.lang) {
+                p.pluginLanguage = options.lang;
+            }
+            return new Promise(function(resolve, reject) {
+                try {
+                    var v = p.getCertificate();
+                    if (parseInt(p.errorCode) !== 0) {
+                        reject(code2err(p.errorCode));
+                    } else {
+                        certificate_ids[v.cert] = v.id;
+                        resolve({
+                            hex: v.cert
+                        });
+                    }
+                } catch (ex) {
+                    _debug(ex);
+                    reject(code2err(p.errorCode));
+                }
+            });
+        };
+        this.sign = function(cert, hash, options) {
+            return new Promise(function(resolve, reject) {
+                var cid = certificate_ids[cert.hex];
+                if (cid) {
+                    try {
+                        var language = options.lang || "en";
+                        var v = p.sign(cid, hash.hex, language);
+                        resolve({
+                            hex: v
+                        });
+                    } catch (ex) {
+                        _debug(JSON.stringify(ex));
+                        reject(code2err(p.errorCode));
+                    }
+                } else {
+                    _debug("invalid certificate: " + cert);
+                    reject(new Error(INVALID_ARGUMENT));
+                }
+            });
+        };
+    }
+    function DigiDocExtension() {
+        this._name = "Chrome native messaging extension";
+        var p = null;
+        this.check = function() {
+            return new Promise(function(resolve, reject) {
+                if (!hasExtensionFor(digidoc_chrome)) {
+                    return resolve(false);
+                }
+                p = new window[digidoc_chrome]();
+                if (p) {
+                    resolve(true);
+                } else {
+                    resolve(false);
+                }
+            });
+        };
+        this.getVersion = function() {
+            return p.getVersion();
+        };
+        this.getCertificate = function(options) {
+            return p.getCertificate(options);
+        };
+        this.sign = function(cert, hash, options) {
+            return p.sign(cert, hash, options);
+        };
+    }
+    function NoBackend() {
+        this._name = "No implementation";
+        this.check = function() {
+            return new Promise(function(resolve, reject) {
+                resolve(true);
+            });
+        };
+        this.getVersion = function() {
+            return Promise.reject(new Error(NO_IMPLEMENTATION));
+        };
+        this.getCertificate = function() {
+            return Promise.reject(new Error(NO_IMPLEMENTATION));
+        };
+        this.sign = function() {
+            return Promise.reject(new Error(NO_IMPLEMENTATION));
+        };
+    }
+    var _backend = null;
+    var fields = {};
+    function _testAndUse(Backend) {
+        return new Promise(function(resolve, reject) {
+            var b = new Backend();
+            b.check().then(function(isLoaded) {
+                if (isLoaded) {
+                    _debug("Using backend: " + b._name);
+                    _backend = b;
+                    resolve(true);
+                } else {
+                    _debug(b._name + " check() failed");
+                    resolve(false);
+                }
+            });
+        });
+    }
+    function _autodetect(force) {
+        return new Promise(function(resolve, reject) {
+            _debug("Autodetecting best backend");
+            if (typeof force === "undefined") {
+                force = false;
+            }
+            if (_backend !== null && !force) {
+                return resolve(true);
+            }
+            function tryDigiDocPlugin() {
+                _testAndUse(DigiDocPlugin).then(function(result) {
+                    if (result) {
+                        resolve(true);
+                    } else {
+                        resolve(_testAndUse(NoBackend));
+                    }
+                });
+            }
+            if (navigator.userAgent.indexOf("MSIE") != -1 || navigator.userAgent.indexOf("Trident") != -1) {
+                _debug("Assuming IE BHO, testing");
+                return tryDigiDocPlugin();
+            }
+            if (navigator.userAgent.indexOf("Chrome") != -1 && hasExtensionFor(digidoc_chrome)) {
+                _testAndUse(DigiDocExtension).then(function(result) {
+                    if (result) {
+                        resolve(true);
+                    } else {
+                        tryDigiDocPlugin();
+                    }
+                });
+                return;
+            }
+            if (hasPluginFor(digidoc_mime)) {
+                return tryDigiDocPlugin();
+            }
+            resolve(_testAndUse(NoBackend));
+        });
+    }
+    fields.use = function(backend) {
+        return new Promise(function(resolve, reject) {
+            if (typeof backend === "undefined" || backend === "auto") {
+                _autodetect().then(function(result) {
+                    resolve(result);
+                });
+            } else {
+                if (backend === "chrome") {
+                    resolve(_testAndUse(DigiDocExtension));
+                } else if (backend === "npapi") {
+                    resolve(_testAndUse(DigiDocPlugin));
+                } else {
+                    resolve(false);
+                }
+            }
+        });
+    };
+    fields.debug = function() {
+        return new Promise(function(resolve, reject) {
+            var hwversion = "hwcrypto.js 0.0.10";
+            _autodetect().then(function(result) {
+                _backend.getVersion().then(function(version) {
+                    resolve(hwversion + " with " + _backend._name + " " + version);
+                }, function(error) {
+                    resolve(hwversion + " with failing backend " + _backend._name);
+                });
+            });
+        });
+    };
+    fields.getCertificate = function(options) {
+        if (typeof options !== "object") {
+            _debug("getCertificate options parameter must be an object");
+            return Promise.reject(new Error(INVALID_ARGUMENT));
+        }
+        if (options && !options.lang) {
+            options.lang = "en";
+        }
+        return _autodetect().then(function(result) {
+            if (location.protocol !== "https:" && location.protocol !== "file:") {
+                return Promise.reject(new Error(NOT_ALLOWED));
+            }
+            return _backend.getCertificate(options).then(function(certificate) {
+                if (certificate.hex && !certificate.encoded) certificate.encoded = _hex2array(certificate.hex);
+                return certificate;
+            });
+        });
+    };
+    fields.sign = function(cert, hash, options) {
+        if (arguments.length < 2) return Promise.reject(new Error(INVALID_ARGUMENT));
+        if (options && !options.lang) {
+            options.lang = "en";
+        }
+        if (!hash.type || !hash.value && !hash.hex) return Promise.reject(new Error(INVALID_ARGUMENT));
+        if (hash.hex && !hash.value) {
+            _debug("DEPRECATED: hash.hex as argument to sign() is deprecated, use hash.value instead");
+            hash.value = _hex2array(hash.hex);
+        }
+        if (hash.value && !hash.hex) hash.hex = _array2hex(hash.value);
+        return _autodetect().then(function(result) {
+            if (location.protocol !== "https:" && location.protocol !== "file:") {
+                return Promise.reject(new Error(NOT_ALLOWED));
+            }
+            return _backend.sign(cert, hash, options).then(function(signature) {
+                if (signature.hex && !signature.value) signature.value = _hex2array(signature.hex);
+                return signature;
+            });
+        });
+    };
+    fields.NO_IMPLEMENTATION = NO_IMPLEMENTATION;
+    fields.USER_CANCEL = USER_CANCEL;
+    fields.NOT_ALLOWED = NOT_ALLOWED;
+    fields.NO_CERTIFICATES = NO_CERTIFICATES;
+    fields.TECHNICAL_ERROR = TECHNICAL_ERROR;
+    fields.INVALID_ARGUMENT = INVALID_ARGUMENT;
+    return fields;
+}();
Index: prototipo/static/js/variables.js
===================================================================
--- prototipo/static/js/variables.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
+++ prototipo/static/js/variables.js	(revision 327fd70136b3c8788c1162cbc241aff5115f23a9)
@@ -0,0 +1,3 @@
+var VALOR_PAGE = 0;
+var VALOR_X = 0;
+var VALOR_Y = 0;
