text: /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */
  var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return new Blob([String.fromCharCode(65279),e],{type:e.type})}return e},v=function(t,u,d){if(!d){t=p(t)}var v=this,w=t.type,m=w===s,y,h=function(){l(v,"writestart progress write writeend".split(" "))},S=function(){if((f||m&&i)&&e.FileReader){var r=new FileReader;r.onloadend=function(){var t=f?r.result:r.result.replace(/^data:[^;]*;/,"data:attachment/file;");var n=e.open(t,"_blank");if(!n)e.location.href=t;t=undefined;v.readyState=v.DONE;h()};r.readAsDataURL(t);v.readyState=v.INIT;return}if(!y){y=n().createObjectURL(t)}if(m){e.location.href=y}else{var o=e.open(y,"_blank");if(!o){e.location.href=y}}v.readyState=v.DONE;h();c(y)};v.readyState=v.INIT;if(o){y=n().createObjectURL(t);setTimeout(function(){r.href=y;r.download=u;a(r);h();c(y);v.readyState=v.DONE});return}S()},w=v.prototype,m=function(e,t,n){return new v(e,t||e.name||"download",n)};if(typeof navigator!=="undefined"&&navigator.msSaveOrOpenBlob){return function(e,t,n){t=t||e.name||"download";if(!n){e=p(e)}return navigator.msSaveOrOpenBlob(e,t)}}w.abort=function(){};w.readyState=w.INIT=0;w.WRITING=1;w.DONE=2;w.error=w.onwritestart=w.onprogress=w.onwrite=w.onabort=w.onerror=w.onwriteend=null;return m}(typeof self!=="undefined"&&self||typeof window!=="undefined"&&window||this.content);if(typeof module!=="undefined"&&module.exports){module.exports.saveAs=saveAs}else if(typeof define!=="undefined"&&define!==null&&define.amd!==null){define("FileSaver.js",function(){return saveAs})}
  
  
  
  // jQuery html to word plugin function
   if (typeof jQuery !== "undefined" && typeof saveAs !== "undefined") {
      (function($) {
          $.fn.wordExport = function(fileName) {
              fileName = typeof fileName !== 'undefined' ? fileName : "jQuery-Word-Export";
              var static = {
                  mhtml: {
                      top: "Mime-Version: 1.0\nContent-Base: " + location.href + "\nContent-Type: Multipart/related; boundary=\"NEXT.ITEM-BOUNDARY\";type=\"text/html\"\n\n--NEXT.ITEM-BOUNDARY\nContent-Type: text/html; charset=\"utf-8\"\nContent-Location: " + location.href + "\n",
                      start:'\<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">\"',
                      head: "<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n<style>\n_styles_\n</style>\n</head>\n",
                      body: "<body lang=VI-vn style='tab- interval: .5in'>_body_</body>",
                      end: '\</html>'
                  }
              };
              var options = {
                  maxWidth: 624
              };
              // Clone selected element before manipulating it
              var markup = $(this).clone();
  
              // Remove hidden elements from the output
              markup.each(function() {
                  var self = $(this);
                  if (self.is(':hidden') || self.hasClass("mrc-controls"))
                      self.hide().remove();
              });
  
              // Embed all images using Data URLs
              var images = Array();
              var img = markup.find('img');
              for (var i = 0; i < img.length; i++) {
                  // Calculate dimensions of output image
                  var w = Math.min(img[i].width, options.maxWidth);
                  var h = img[i].height * (w / img[i].width);
                  // Create canvas for converting image to data URL
                  var canvas = document.createElement("CANVAS");
                  canvas.width = w;
                  canvas.height = h;
                  // Draw image to canvas
                  var context = canvas.getContext('2d');
                  context.drawImage(img[i], 0, 0, w, h);
                  // Get data URL encoding of image
                  var uri = canvas.toDataURL("image/png");
                  $(img[i]).attr("src", img[i].src);
                  img[i].width = w;
                  img[i].height = h;
                  // Save encoded image to array
                  images[i] = {
                      type: uri.substring(uri.indexOf(":") + 1, uri.indexOf(";")),
                      encoding: uri.substring(uri.indexOf(";") + 1, uri.indexOf(",")),
                      location: $(img[i]).attr("src"),
                      data: uri.substring(uri.indexOf(",") + 1)
                  };
              }
  
              // Prepare bottom of mhtml file with image data
              var mhtmlBottom = "\n";
              for (var i = 0; i < images.length; i++) {
                  mhtmlBottom += "--NEXT.ITEM-BOUNDARY\n";
                  mhtmlBottom += "Content-Location: " + images[i].location + "\n";
                  mhtmlBottom += "Content-Type: " + images[i].type + "\n";
                  mhtmlBottom += "Content-Transfer-Encoding: " + images[i].encoding + "\n\n";
                  mhtmlBottom += images[i].data + "\n\n";
              }
              mhtmlBottom += "--NEXT.ITEM-BOUNDARY--";
  
              //TODO: load css from included stylesheet
             
              var css = (
                  '<style>' +
                  '@page copy-button{display: none!important;}' +
                  '.copy-button {page: copy-button;}' +
                  '</style>'
              );
              // Aggregate parts of the file together
              var fileContent = static.mhtml.start + static.mhtml.top + static.mhtml.head.replace("_styles_", css) + static.mhtml.body.replace("_body_", markup.html()) + mhtmlBottom + static.mhtml.end;
  
              // Create a Blob with the file contents
              var blob = new Blob(['\ufeff',fileContent], {
                  type: "application/msword;charset=utf-8"
              });
            
              saveAs(blob, fileName + ".doc");
          };
      })(jQuery);
  } else {
      if (typeof jQuery === "undefined") {
          console.error("jQuery Word Export: missing dependency (jQuery)");
      }
      if (typeof saveAs === "undefined") {
          console.error("jQuery Word Export: missing dependency (FileSaver.js)");
      }
  }
  