!function(n,t){var i=function(){var n={};return t.apply(n,arguments),n.moxie};"function"==typeof define&&define.amd?define("moxie",[],i):"object"==typeof module&&module.exports?module.exports=i():n.moxie=i()}(this||window,function(){!function(n,t){"use strict";function f(n,t){for(var r,f=[],i=0;i<n.length;++i){if(r=u[n[i]]||e(n[i]),!r)throw"module definition dependecy not found: "+n[i];f.push(r)}t.apply(null,f)}function i(n,i,r){if("string"!=typeof n)throw"invalid module definition, module id must be defined and be a string";if(i===t)throw"invalid module definition, dependencies must be specified";if(r===t)throw"invalid module definition, definition function must be specified";f(i,function(){u[n]=r.apply(null,arguments)})}function r(n){return!!u[n]}function e(t){for(var i=n,u=t.split(/[.\/]/),r=0;r<u.length;++r){if(!i[u[r]])return;i=i[u[r]]}return i}function o(i){for(var o=0;o<i.length;o++){for(var f=n,s=i[o],r=s.split(/[.\/]/),e=0;e<r.length-1;++e)f[r[e]]===t&&(f[r[e]]={}),f=f[r[e]];f[r[r.length-1]]=u[s]}}var u={};i("moxie/core/utils/Basic",[],function(){function n(n){var t;return n===t?"undefined":null===n?"null":n.nodeType?"node":{}.toString.call(n).match(/\s([a-z|A-Z]+)/)[1].toLowerCase()}function u(){return t(!1,!1,arguments)}function f(){return t(!0,!1,arguments)}function e(){return t(!1,!0,arguments)}function o(){return t(!0,!0,arguments)}function s(i){switch(n(i)){case"array":return t(!1,!0,[[],i]);case"object":return t(!1,!0,[{},i]);default:return i}}function h(t){switch(n(t)){case"array":return Array.prototype.slice.call(t);case"object":return u({},t)}return t}function t(u,f,e){var s,o=e[0];return i(e,function(e,c){c>0&&i(e,function(i,e){var c=-1!==r(n(i),["array","object"]);return i===s||u&&o[e]===s?!0:(c&&f&&(i=h(i)),n(o[e])===n(i)&&c?t(u,f,[o[e],i]):o[e]=i,void 0)})}),o}function c(n,t){function r(){this.constructor=n}for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i]);return r.prototype=t.prototype,n.prototype=new r,n.parent=t.prototype,n}function i(n,t){var i,u,r,f;if(n){try{i=n.length}catch(e){i=f}if(i===f||"number"!=typeof i){for(u in n)if(n.hasOwnProperty(u)&&t(n[u],u)===!1)return}else for(r=0;i>r;r++)if(t(n[r],r)===!1)return}}function l(t){var i;if(!t||"object"!==n(t))return!0;for(i in t)return!1;return!0}function a(t,i){function r(f){"function"===n(t[f])&&t[f](function(n){++f<u&&!n?r(f):i(n)})}var u=t.length;"function"!==n(i)&&(i=function(){});t&&t.length||i();r(0)}function v(n,t){var u=0,f=n.length,r=new Array(f);i(n,function(n,i){n(function(n){if(n)return t(n);var e=[].slice.call(arguments);e.shift();r[i]=e;u++;u===f&&(r.unshift(null),t.apply(this,r))})})}function r(n,t){if(t){if(Array.prototype.indexOf)return Array.prototype.indexOf.call(t,n);for(var i=0,r=t.length;r>i;i++)if(t[i]===n)return i}return-1}function y(t,i){var u=[],f;"array"!==n(t)&&(t=[t]);"array"!==n(i)&&(i=[i]);for(f in t)-1===r(t[f],i)&&u.push(t[f]);return u.length?u:!1}function p(n,t){var u=[];return i(n,function(n){-1!==r(n,t)&&u.push(n)}),u.length?u:null}function w(n){for(var i=[],t=0;t<n.length;t++)i[t]=n[t];return i}function b(n){return n?String.prototype.trim?String.prototype.trim.call(n):n.toString().replace(/^\s*/,"").replace(/\s*$/,""):n}function k(n){if("string"!=typeof n)return n;var t,i={t:1099511627776,g:1073741824,m:1048576,k:1024};return n=/^([0-9\.]+)([tmgk]?)$/.exec(n.toLowerCase().replace(/[^0-9\.tmkg]/g,"")),t=n[2],n=+n[1],i.hasOwnProperty(t)&&(n*=i[t]),Math.floor(n)}function d(n){var t=[].slice.call(arguments,1);return n.replace(/%([a-z])/g,function(n,i){var r=t.shift();switch(i){case"s":return r+"";case"d":return parseInt(r,10);case"f":return parseFloat(r);case"c":return"";default:return r}})}function g(n,t){var i=this;setTimeout(function(){n.call(i)},t||1)}var nt=function(){var n=0;return function(t){for(var r=(new Date).getTime().toString(32),i=0;5>i;i++)r+=Math.floor(65535*Math.random()).toString(32);return(t||"o_")+r+(n++).toString(32)}}();return{guid:nt,typeOf:n,extend:u,extendIf:f,extendImmutable:e,extendImmutableIf:o,clone:s,inherit:c,each:i,isEmptyObj:l,inSeries:a,inParallel:v,inArray:r,arrayDiff:y,arrayIntersect:p,toArray:w,trim:b,sprintf:d,parseSizeStr:k,delay:g}});i("moxie/core/utils/Encode",[],function(){var t=function(n){return unescape(encodeURIComponent(n))},n=function(n){return decodeURIComponent(escape(n))},i=function(t,i){if("function"==typeof atob)return i?n(window.atob(t)):window.atob(t);var u,o,l,a,v,s,h,f,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=0,p=0,c="",y=[];if(!t)return t;t+="";do a=e.indexOf(t.charAt(r++)),v=e.indexOf(t.charAt(r++)),s=e.indexOf(t.charAt(r++)),h=e.indexOf(t.charAt(r++)),f=a<<18|v<<12|s<<6|h,u=255&f>>16,o=255&f>>8,l=255&f,y[p++]=64==s?String.fromCharCode(u):64==h?String.fromCharCode(u,o):String.fromCharCode(u,o,l);while(r<t.length);return c=y.join(""),i?n(c):c},r=function(n,i){var e;if(i&&(n=t(n)),"function"==typeof btoa)return window.btoa(n);var s,h,c,l,a,v,y,r,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,w=0,o="",p=[];if(!n)return n;do s=n.charCodeAt(f++),h=n.charCodeAt(f++),c=n.charCodeAt(f++),r=s<<16|h<<8|c,l=63&r>>18,a=63&r>>12,v=63&r>>6,y=63&r,p[w++]=u.charAt(l)+u.charAt(a)+u.charAt(v)+u.charAt(y);while(f<n.length);return o=p.join(""),e=n.length%3,(e?o.slice(0,e-3):o)+"===".slice(e||3)};return{utf8_encode:t,utf8_decode:n,atob:i,btoa:r}});i("moxie/core/utils/Env",["moxie/core/utils/Basic"],function(n){function f(n,t,i){var r=0,f=0,u=0,s={dev:-6,alpha:-5,a:-5,beta:-4,b:-4,RC:-3,rc:-3,"#":-2,p:1,pl:1},e=function(n){return n=(""+n).replace(/[_\-+]/g,"."),n=n.replace(/([^.\d]+)/g,".$1.").replace(/\.{2,}/g,"."),n.length?n.split("."):[-8]},o=function(n){return n?isNaN(n)?s[n]||-7:parseInt(n,10):0};for(n=e(n),t=e(t),f=Math.max(n.length,t.length),r=0;f>r;r++)if(n[r]!=t[r]){if(n[r]=o(n[r]),t[r]=o(t[r]),n[r]<t[r]){u=-1;break}if(n[r]>t[r]){u=1;break}}if(!i)return u;switch(i){case">":case"gt":return u>0;case">=":case"ge":return u>=0;case"<=":case"le":return 0>=u;case"==":case"=":case"eq":return 0===u;case"<>":case"!=":case"ne":return 0!==u;case"":case"<":case"lt":return 0>u;default:return null}}var u=function(n){var c="",o="?",s="function",l="undefined",u="object",t="name",i="version",h={has:function(n,t){return-1!==t.toLowerCase().indexOf(n.toLowerCase())},lowerize:function(n){return n.toLowerCase()}},r={rgx:function(){for(var r,h,y,f,t,a,i,v,o,e=0,c=arguments;e<c.length;e+=2){if(v=c[e],o=c[e+1],typeof r===l){r={};for(f in o)t=o[f],typeof t===u?r[t[0]]=n:r[t]=n}for(h=y=0;h<v.length;h++)if(a=v[h].exec(this.getUA())){for(f=0;f<o.length;f++)i=a[++y],t=o[f],typeof t===u&&t.length>0?2==t.length?r[t[0]]=typeof t[1]==s?t[1].call(this,i):t[1]:3==t.length?r[t[0]]=typeof t[1]!==s||t[1].exec&&t[1].test?i?i.replace(t[1],t[2]):n:i?t[1].call(this,i,t[2]):n:4==t.length&&(r[t[0]]=i?t[3].call(this,i.replace(t[1],t[2])):n):r[t]=i?i:n;break}if(a)break}return r},str:function(t,i){var r,f;for(r in i)if(typeof i[r]===u&&i[r].length>0){for(f=0;f<i[r].length;f++)if(h.has(i[r][f],t))return r===o?n:r}else if(h.has(i[r],t))return r===o?n:r;return t}},f={browser:{oldsafari:{major:{1:["/8","/1","/3"],2:"/4","?":"/"},version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",RT:"ARM"}}}},e={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[t,i],[/\s(opr)\/([\w\.]+)/i],[[t,"Opera"],i],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?([\w\.]*)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi)\/([\w\.-]+)/i],[t,i],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[t,"IE"],i],[/(edge)\/((\d+)?[\w\.]+)/i],[t,i],[/(yabrowser)\/([\w\.]+)/i],[[t,"Yandex"],i],[/(comodo_dragon)\/([\w\.]+)/i],[[t,/_/g," "],i],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i,/(uc\s?browser|qqbrowser)[\/\s]?([\w\.]+)/i],[t,i],[/(dolfin)\/([\w\.]+)/i],[[t,"Dolphin"],i],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[[t,"Chrome"],i],[/XiaoMi\/MiuiBrowser\/([\w\.]+)/i],[i,[t,"MIUI Browser"]],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)/i],[i,[t,"Android Browser"]],[/FBAV\/([\w\.]+);/i],[i,[t,"Facebook"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[i,[t,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[i,t],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[t,[i,r.str,f.browser.oldsafari.version]],[/(konqueror)\/([\w\.]+)/i,/(webkit|khtml)\/([\w\.]+)/i],[t,i],[/(navigator|netscape)\/([\w\.-]+)/i],[[t,"Netscape"],i],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]+)*/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[t,i]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[i,[t,"EdgeHTML"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[t,i],[/rv\:([\w\.]+).*(gecko)/i],[i,t]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[t,i],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[t,[i,r.str,f.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[t,"Windows"],[i,r.str,f.os.windows.version]],[/\((bb)(10);/i],[[t,"BlackBerry"],i],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)[\/\s]([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i,/linux;.+(sailfish);/i],[t,i],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[[t,"Symbian"],i],[/\((series40);/i],[t],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[t,"Firefox OS"],i],[/(nintendo|playstation)\s([wids3portablevu]+)/i,/(mint)[\/\s\(]?(\w+)*/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],[t,i],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[t,"Chromium OS"],i],[/(sunos)\s?([\w\.]+\d)*/i],[[t,"Solaris"],i],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],[t,i],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[[t,"iOS"],[i,/_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i,/(macintosh|mac(?=_powerpc)\s)/i],[[t,"Mac OS"],[i,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i,/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i,/(unix)\s?([\w\.]+)*/i],[t,i]]};return function(n){var t=n||(window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:c);this.getBrowser=function(){return r.rgx.apply(this,e.browser)};this.getEngine=function(){return r.rgx.apply(this,e.engine)};this.getOS=function(){return r.rgx.apply(this,e.os)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS()}};this.getUA=function(){return t};this.setUA=function(n){return t=n,this};this.setUA(t)}}(),e=function(){var r={access_global_ns:function(){return!!window.moxie},define_property:function(){return!1}(),create_canvas:function(){var n=document.createElement("canvas"),t=!(!n.getContext||!n.getContext("2d"));return r.create_canvas=t,t},return_response_type:function(t){try{if(-1!==n.inArray(t,["","text","document"]))return!0;if(window.XMLHttpRequest){var i=new XMLHttpRequest;if(i.open("get","/"),"responseType"in i)return i.responseType=t,i.responseType!==t?!1:!0}}catch(r){}return!1},use_blob_uri:function(){var n=window.URL;return r.use_blob_uri=n&&"createObjectURL"in n&&"revokeObjectURL"in n&&("IE"!==i.browser||i.verComp(i.version,"11.0.46",">=")),r.use_blob_uri},use_data_uri:function(){var n=new Image;return n.onload=function(){r.use_data_uri=1===n.width&&1===n.height},setTimeout(function(){n.src="data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="},1),!1}(),use_data_uri_over32kb:function(){return r.use_data_uri&&("IE"!==i.browser||i.version>=9)},use_data_uri_of:function(n){return r.use_data_uri&&33e3>n||r.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var n=document.createElement("input");return n.setAttribute("type","file"),r.use_fileinput=!n.disabled},use_webgl:function(){var i,u=document.createElement("canvas"),n=null;try{n=u.getContext("webgl")||u.getContext("experimental-webgl")}catch(f){}return n||(n=null),i=!!n,r.use_webgl=i,u=t,i}};return function(t){var i=[].slice.call(arguments);return i.shift(),"function"===n.typeOf(r[t])?r[t].apply(this,i):!!r[t]}}(),r=(new u).getResult(),i={can:e,uaParser:u,browser:r.browser.name,version:r.browser.version,os:r.os.name,osVersion:r.os.version,verComp:f,swf_url:"../flash/Moxie.swf",xap_url:"../silverlight/Moxie.xap",global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return i.OS=i.os,i});i("moxie/core/Exceptions",["moxie/core/utils/Basic"],function(n){function t(n,t){for(var i in n)if(n[i]===t)return i;return null}return{RuntimeError:function(){function i(n,i){this.code=n;this.name=t(r,n);this.message=this.name+(i||": RuntimeError "+this.code)}var r={NOT_INIT_ERR:1,EXCEPTION_ERR:3,NOT_SUPPORTED_ERR:9,JS_ERR:4};return n.extend(i,r),i.prototype=Error.prototype,i}(),OperationNotAllowedException:function(){function t(n){this.code=n;this.name="OperationNotAllowedException"}return n.extend(t,{NOT_ALLOWED_ERR:1}),t.prototype=Error.prototype,t}(),ImageError:function(){function i(n){this.code=n;this.name=t(r,n);this.message=this.name+": ImageError "+this.code}var r={WRONG_FORMAT:1,MAX_RESOLUTION_ERR:2,INVALID_META_ERR:3};return n.extend(i,r),i.prototype=Error.prototype,i}(),FileException:function(){function i(n){this.code=n;this.name=t(r,n);this.message=this.name+": FileException "+this.code}var r={NOT_FOUND_ERR:1,SECURITY_ERR:2,ABORT_ERR:3,NOT_READABLE_ERR:4,ENCODING_ERR:5,NO_MODIFICATION_ALLOWED_ERR:6,INVALID_STATE_ERR:7,SYNTAX_ERR:8};return n.extend(i,r),i.prototype=Error.prototype,i}(),DOMException:function(){function i(n){this.code=n;this.name=t(r,n);this.message=this.name+": DOMException "+this.code}var r={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};return n.extend(i,r),i.prototype=Error.prototype,i}(),EventException:function(){function t(n){this.code=n;this.name="EventException"}return n.extend(t,{UNSPECIFIED_EVENT_TYPE_ERR:0}),t.prototype=Error.prototype,t}()}});i("moxie/core/utils/Dom",["moxie/core/utils/Env"],function(n){var i=function(n){return"string"!=typeof n?n:document.getElementById(n)},t=function(n,t){if(!n.className)return!1;var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");return i.test(n.className)},r=function(n,i){t(n,i)||(n.className=n.className?n.className.replace(/\s+$/,"")+" "+i:i)},u=function(n,t){if(n.className){var i=new RegExp("(^|\\s+)"+t+"(\\s+|$)");n.className=n.className.replace(i,function(n,t,i){return" "===t&&" "===i?" ":""})}},f=function(n,t){return n.currentStyle?n.currentStyle[t]:window.getComputedStyle?window.getComputedStyle(n,null)[t]:void 0},e=function(t,i){function h(n){var t,i,r=0,f=0;return n&&(i=n.getBoundingClientRect(),t="CSS1Compat"===u.compatMode?u.documentElement:u.body,r=i.left+t.scrollLeft,f=i.top+t.scrollTop),{x:r,y:f}}var r,f,e,o=0,s=0,u=document;if(t=t,i=i||u.body,t&&t.getBoundingClientRect&&"IE"===n.browser&&(!u.documentMode||u.documentMode<8))return f=h(t),e=h(i),{x:f.x-e.x,y:f.y-e.y};for(r=t;r&&r!=i&&r.nodeType;)o+=r.offsetLeft||0,s+=r.offsetTop||0,r=r.offsetParent;for(r=t.parentNode;r&&r!=i&&r.nodeType;)o-=r.scrollLeft||0,s-=r.scrollTop||0,r=r.parentNode;return{x:o,y:s}},o=function(n){return{w:n.offsetWidth||n.clientWidth,h:n.offsetHeight||n.clientHeight}};return{get:i,hasClass:t,addClass:r,removeClass:u,getStyle:f,getPos:e,getSize:o}});i("moxie/core/EventTarget",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic"],function(n,t,i){function u(){this.uid=i.guid()}var r={};return i.extend(u.prototype,{init:function(){this.uid||(this.uid=i.guid("uid_"))},addEventListener:function(n,t,u,f){var e,o=this;return this.hasOwnProperty("uid")||(this.uid=i.guid("uid_")),n=i.trim(n),/\s/.test(n)?(i.each(n.split(/\s+/),function(n){o.addEventListener(n,t,u,f)}),void 0):(n=n.toLowerCase(),u=parseInt(u,10)||0,e=r[this.uid]&&r[this.uid][n]||[],e.push({fn:t,priority:u,scope:f||this}),r[this.uid]||(r[this.uid]={}),r[this.uid][n]=e,void 0)},hasEventListener:function(n){var t;return n?(n=n.toLowerCase(),t=r[this.uid]&&r[this.uid][n]):t=r[this.uid],t?t:!1},removeEventListener:function(n,t){var u,f,e=this;if(n=n.toLowerCase(),/\s/.test(n))return i.each(n.split(/\s+/),function(n){e.removeEventListener(n,t)}),void 0;if(u=r[this.uid]&&r[this.uid][n]){if(t){for(f=u.length-1;f>=0;f--)if(u[f].fn===t){u.splice(f,1);break}}else u=[];u.length||(delete r[this.uid][n],i.isEmptyObj(r[this.uid])&&delete r[this.uid])}},removeAllEventListeners:function(){r[this.uid]&&delete r[this.uid]},dispatchEvent:function(n){var s,h,f,u,c,e={},l=!0,o;if("string"!==i.typeOf(n)){if(u=n,"string"!==i.typeOf(u.type))throw new t.EventException(t.EventException.UNSPECIFIED_EVENT_TYPE_ERR);n=u.type;u.total!==c&&u.loaded!==c&&(e.total=u.total,e.loaded=u.loaded);e.async=u.async||!1}return(-1!==n.indexOf("::")?function(t){s=t[0];n=t[1]}(n.split("::")):s=this.uid,n=n.toLowerCase(),h=r[s]&&r[s][n])&&(h.sort(function(n,t){return t.priority-n.priority}),f=[].slice.call(arguments),f.shift(),e.type=n,f.unshift(e),o=[],i.each(h,function(n){f[0].target=n.scope;e.async?o.push(function(t){setTimeout(function(){t(n.fn.apply(n.scope,f)===!1)},1)}):o.push(function(t){t(n.fn.apply(n.scope,f)===!1)})}),o.length&&i.inSeries(o,function(n){l=!n})),l},bindOnce:function(n,t,i,r){var u=this;u.bind.call(this,n,function f(){return u.unbind(n,f),t.apply(this,arguments)},i,r)},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(n){var t=this;this.bind(n.join(" "),function(n){var t="on"+n.type.toLowerCase();"function"===i.typeOf(this[t])&&this[t].apply(this,arguments)});i.each(n,function(n){n="on"+n.toLowerCase(n);"undefined"===i.typeOf(t[n])&&(t[n]=null)})}}),u.instance=new u,u});i("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(n,t,i,r){function u(n,r,e,o,s){var h,c=this,l=t.guid(r+"_"),a=s||"browser";n=n||{};f[l]=this;e=t.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},e);n.preferred_caps&&(a=u.getMode(o,n.preferred_caps,a));h=function(){var n={};return{exec:function(t,i,r,u){if(h[i]&&(n[t]||(n[t]={context:this,instance:new h[i]}),n[t].instance[r]))return n[t].instance[r].apply(this,u)},removeInstance:function(t){delete n[t]},removeAllInstances:function(){var i=this;t.each(n,function(n,r){"function"===t.typeOf(n.instance.destroy)&&n.instance.destroy.call(n.context);i.removeInstance(r)})}}}();t.extend(this,{initialized:!1,uid:l,type:r,mode:u.getMode(o,n.required_caps,a),shimid:l+"_container",clients:0,options:n,can:function(n,i){var r=arguments[2]||e,f;if("string"===t.typeOf(n)&&"undefined"===t.typeOf(i)&&(n=u.parseCaps(n)),"object"===t.typeOf(n)){for(f in n)if(!this.can(f,n[f],r))return!1;return!0}return"function"===t.typeOf(r[n])?r[n].call(this,i):i===r[n]},getShimContainer:function(){var r,n=i.get(this.shimid);return n||(r=i.get(this.options.container)||document.body,n=document.createElement("div"),n.id=this.shimid,n.className="moxie-shim moxie-shim-"+this.type,t.extend(n.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),r.appendChild(n),r=null),n},getShim:function(){return h},shimExec:function(n,t){var i=[].slice.call(arguments,2);return c.getShim().exec.call(this,this.uid,n,t,i)},exec:function(n,t){var i=[].slice.call(arguments,2);return c[n]&&c[n][t]?c[n][t].apply(this,i):c.shimExec.apply(this,arguments)},destroy:function(){if(c){var n=i.get(this.shimid);n&&n.parentNode.removeChild(n);h&&h.removeAllInstances();this.unbindAll();delete f[this.uid];this.uid=null;l=c=h=n=null}}});this.mode&&n.required_caps&&!this.can(n.required_caps)&&(this.mode=!1)}var e={},f={};return u.order="html5,flash,silverlight,html4",u.getRuntime=function(n){return f[n]?f[n]:!1},u.addConstructor=function(n,t){t.prototype=r.instance;e[n]=t},u.getConstructor=function(n){return e[n]||null},u.getInfo=function(n){var t=u.getRuntime(n);return t?{uid:t.uid,type:t.type,mode:t.mode,can:function(){return t.can.apply(t,arguments)}}:null},u.parseCaps=function(n){var i={};return"string"!==t.typeOf(n)?n||{}:(t.each(n.split(","),function(n){i[n]=!0}),i)},u.can=function(n,t){var i,r,f=u.getConstructor(n);return f?(i=new f({required_caps:t}),r=i.mode,i.destroy(),!!r):!1},u.thatCan=function(n,t){var i=(t||u.order).split(/\s*,\s*/);for(var r in i)if(u.can(i[r],n))return i[r];return null},u.getMode=function(n,i,r){var u=null;if("undefined"===t.typeOf(r)&&(r="browser"),i&&!t.isEmptyObj(n)){if(t.each(i,function(i,r){if(n.hasOwnProperty(r)){var f=n[r](i);if("string"==typeof f&&(f=[f]),u){if(!(u=t.arrayIntersect(u,f)))return u=!1}else u=f}}),u)return-1!==t.inArray(r,u)?r:u[0];if(u===!1)return!1}return r},u.getGlobalEventTarget=function(){if(/^moxie\./.test(n.global_event_dispatcher)&&!n.can("access_global_ns")){var i=t.guid("moxie_event_target_");window[i]=function(n,t){r.instance.dispatchEvent(n,t)};n.global_event_dispatcher=i}return n.global_event_dispatcher},u.capTrue=function(){return!0},u.capFalse=function(){return!1},u.capTest=function(n){return function(){return!!n}},u});i("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(n,t,i,r){return function(){var n;i.extend(this,{connectRuntime:function(u){function o(i){var f,s;return i.length?(f=i.shift().toLowerCase(),(s=r.getConstructor(f))?(n=new s(u),n.bind("Init",function(){n.initialized=!0;setTimeout(function(){n.clients++;e.ruid=n.uid;e.trigger("RuntimeInit",n)},1)}),n.bind("Error",function(){n.destroy();o(i)}),n.bind("Exception",function(n,i){var r=i.name+"(#"+i.code+")"+(i.message?", from: "+i.message:"");e.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.EXCEPTION_ERR,r))}),n.mode?(n.init(),void 0):(n.trigger("Error"),void 0)):(o(i),void 0)):(e.trigger("RuntimeError",new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR)),n=null,void 0)}var f,e=this;if("string"===i.typeOf(u)?f=u:"string"===i.typeOf(u.ruid)&&(f=u.ruid),f){if(n=r.getRuntime(f))return e.ruid=f,n.clients++,n;throw new t.RuntimeError(t.RuntimeError.NOT_INIT_ERR);}o((u.runtime_order||r.order).split(/\s*,\s*/))},disconnectRuntime:function(){n&&--n.clients<=0&&n.destroy();n=null},getRuntime:function(){return n&&n.uid?n:n=null},exec:function(){return n?n.exec.apply(this,arguments):null},can:function(t){return n?n.can(t):!1}})}});i("moxie/file/Blob",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient"],function(n,t,i){function u(f,e){function o(t,i,f){var e,o=r[this.uid];return"string"===n.typeOf(o)&&o.length?(e=new u(null,{type:f,size:i-t}),e.detach(o.substr(t,e.size)),e):null}i.call(this);f&&this.connectRuntime(f);e?"string"===n.typeOf(e)&&(e={data:e}):e={};n.extend(this,{uid:e.uid||n.guid("uid_"),ruid:f,size:e.size||0,type:e.type||"",slice:function(n,t,i){return this.isDetached()?o.apply(this,arguments):this.getRuntime().exec.call(this,"Blob","slice",this.getSource(),n,t,i)},getSource:function(){return r[this.uid]?r[this.uid]:null},detach:function(n){if(this.ruid&&(this.getRuntime().exec.call(this,"Blob","destroy"),this.disconnectRuntime(),this.ruid=null),n=n||"","data:"==n.substr(0,5)){var i=n.indexOf(";base64,");this.type=n.substring(5,i);n=t.atob(n.substring(i+8))}this.size=n.length;r[this.uid]=n},isDetached:function(){return!this.ruid&&"string"===n.typeOf(r[this.uid])},destroy:function(){this.detach();delete r[this.uid]}});e.data?this.detach(e.data):r[this.uid]=e}var r={};return u});i("moxie/core/I18n",["moxie/core/utils/Basic"],function(n){var t={};return{addI18n:function(i){return n.extend(t,i)},translate:function(n){return t[n]||n},_:function(n){return this.translate(n)},sprintf:function(t){var i=[].slice.call(arguments,1);return t.replace(/%[a-z]/g,function(){var t=i.shift();return"undefined"!==n.typeOf(t)?t:""})}}});i("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(n,t){var r={},i={},u=function(n){for(var u,f,e=n.split(/,/),t=0;t<e.length;t+=2){for(f=e[t+1].split(/ /),u=0;u<f.length;u++)r[f[u]]=e[t];i[e[t]]=f}},o=function(t,i){for(var u,r,f,e=[],o=0;o<t.length;o++)for(u=t[o].extensions.toLowerCase().split(/\s*,\s*/),r=0;r<u.length;r++){if("*"===u[r])return[];if(f=e[u[r]],i&&/^\w+$/.test(u[r]))e.push("."+u[r]);else if(f&&-1===n.inArray(f,e))e.push(f);else if(!f)return[]}return e},f=function(t){var r=[];return n.each(t,function(t){if(t=t.toLowerCase(),"*"===t)return r=[],!1;var u=t.match(/^(\w+)\/(\*|\w+)$/);u&&("*"===u[2]?n.each(i,function(n,t){new RegExp("^"+u[1]+"/").test(t)&&[].push.apply(r,i[t])}):i[t]&&[].push.apply(r,i[t]))}),r},s=function(i){var u=[],r=[];return"string"===n.typeOf(i)&&(i=n.trim(i).split(/\s*,\s*/)),r=f(i),u.push({title:t.translate("Files"),extensions:r.length?r.join(","):"*"}),u},e=function(n){var t=n&&n.match(/\.([^.]+)$/);return t?t[1].toLowerCase():""},h=function(n){return r[e(n)]||""};return u("application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb xlt xla,application/vnd.ms-powerpoint,ppt pps pot ppa,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe"),{mimes:r,extensions:i,addMimeType:u,extList2mimes:o,mimes2exts:f,mimes2extList:s,getFileExtension:e,getFileMime:h}});i("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(n,t,i,r,u,f,e,o,s){function h(t){var f,h,l;if(-1!==n.inArray(n.typeOf(t),["string","node"])&&(t={browse_button:t}),h=r.get(t.browse_button),!h)throw new u.DOMException(u.DOMException.NOT_FOUND_ERR);l={accept:[{title:e.translate("All Files"),extensions:"*"}],multiple:!1,required_caps:!1,container:h.parentNode||document.body};t=n.extend({},l,t);"string"==typeof t.required_caps&&(t.required_caps=o.parseCaps(t.required_caps));"string"==typeof t.accept&&(t.accept=i.mimes2extList(t.accept));f=r.get(t.container);f||(f=document.body);"static"===r.getStyle(f,"position")&&(f.style.position="relative");f=h=null;s.call(this);n.extend(this,{uid:n.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){var i=this;i.bind("RuntimeInit",function(u,f){i.ruid=f.uid;i.shimid=f.shimid;i.bind("Ready",function(){i.trigger("Refresh")},999);i.bind("Refresh",function(){var e,o,i,u,s;i=r.get(t.browse_button);u=r.get(f.shimid);i&&(e=r.getPos(i,r.get(t.container)),o=r.getSize(i),s=parseInt(r.getStyle(i,"z-index"),10)||0,u&&n.extend(u.style,{top:e.y+"px",left:e.x+"px",width:o.w+"px",height:o.h+"px",zIndex:s+1}));u=i=null});f.exec.call(i,"FileInput","init",t)});i.connectRuntime(n.extend({},t,{required_caps:{select_file:!0}}))},getOption:function(n){return t[n]},setOption:function(n,r){if(t.hasOwnProperty(n)){var f=t[n];switch(n){case"accept":"string"==typeof r&&(r=i.mimes2extList(r));break;case"container":case"required_caps":throw new u.FileException(u.FileException.NO_MODIFICATION_ALLOWED_ERR);}t[n]=r;this.exec("FileInput","setOption",n,r);this.trigger("OptionChanged",n,r,f)}},disable:function(t){var i=this.getRuntime();i&&this.exec("FileInput","disable","undefined"===n.typeOf(t)?!0:t)},refresh:function(){this.trigger("Refresh")},destroy:function(){var t=this.getRuntime();t&&(t.exec.call(this,"FileInput","destroy"),this.disconnectRuntime());"array"===n.typeOf(this.files)&&n.each(this.files,function(n){n.destroy()});this.files=null;this.unbindAll()}});this.handleEventProps(c)}var c=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return h.prototype=f.instance,h});i("moxie/file/File",["moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/file/Blob"],function(n,t,i){function r(r,u){var f,e;u||(u={});i.apply(this,arguments);this.type||(this.type=t.getFileMime(u.name));u.name?(f=u.name.replace(/\\/g,"/"),f=f.substr(f.lastIndexOf("/")+1)):this.type&&(e=this.type.split("/")[0],f=n.guid((""!==e?e:"file")+"_"),t.extensions[this.type]&&(f+="."+t.extensions[this.type][0]));n.extend(this,{name:f||n.guid("file_"),relativePath:"",lastModifiedDate:u.lastModifiedDate||(new Date).toLocaleString()})}return r.prototype=i.prototype,r});i("moxie/file/FileDrop",["moxie/core/I18n","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/core/utils/Env","moxie/file/File","moxie/runtime/RuntimeClient","moxie/core/EventTarget","moxie/core/utils/Mime"],function(n,t,i,r,u,f,e,o,s){function h(i){var f,u=this;"string"==typeof i&&(i={drop_zone:i});f={accept:[{title:n.translate("All Files"),extensions:"*"}],required_caps:{drag_and_drop:!0}};i="object"==typeof i?r.extend({},f,i):f;i.container=t.get(i.drop_zone)||document.body;"static"===t.getStyle(i.container,"position")&&(i.container.style.position="relative");"string"==typeof i.accept&&(i.accept=s.mimes2extList(i.accept));e.call(u);r.extend(u,{uid:r.guid("uid_"),ruid:null,files:null,init:function(){u.bind("RuntimeInit",function(n,t){u.ruid=t.uid;t.exec.call(u,"FileDrop","init",i);u.dispatchEvent("ready")});u.connectRuntime(i)},destroy:function(){var n=this.getRuntime();n&&(n.exec.call(this,"FileDrop","destroy"),this.disconnectRuntime());this.files=null;this.unbindAll()}});this.handleEventProps(c)}var c=["ready","dragenter","dragleave","drop","error"];return h.prototype=o.instance,h});i("moxie/file/FileReader",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/Exceptions","moxie/core/EventTarget","moxie/file/Blob","moxie/runtime/RuntimeClient"],function(n,t,i,r,u,f){function e(){function r(n,r){if(this.trigger("loadstart"),this.readyState===e.LOADING)return this.trigger("error",new i.DOMException(i.DOMException.INVALID_STATE_ERR)),this.trigger("loadend"),void 0;if(!(r instanceof u))return this.trigger("error",new i.DOMException(i.DOMException.NOT_FOUND_ERR)),this.trigger("loadend"),void 0;if(this.result=null,this.readyState=e.LOADING,r.isDetached()){var f=r.getSource();switch(n){case"readAsText":case"readAsBinaryString":this.result=f;break;case"readAsDataURL":this.result="data:"+r.type+";base64,"+t.btoa(f)}this.readyState=e.DONE;this.trigger("load");this.trigger("loadend")}else this.connectRuntime(r.ruid),this.exec("FileReader","read",n,r)}f.call(this);n.extend(this,{uid:n.guid("uid_"),readyState:e.EMPTY,result:null,error:null,readAsBinaryString:function(n){r.call(this,"readAsBinaryString",n)},readAsDataURL:function(n){r.call(this,"readAsDataURL",n)},readAsText:function(n){r.call(this,"readAsText",n)},abort:function(){this.result=null;-1===n.inArray(this.readyState,[e.EMPTY,e.DONE])&&(this.readyState===e.LOADING&&(this.readyState=e.DONE),this.exec("FileReader","abort"),this.trigger("abort"),this.trigger("loadend"))},destroy:function(){this.abort();this.exec("FileReader","destroy");this.disconnectRuntime();this.unbindAll()}});this.handleEventProps(o);this.bind("Error",function(n,t){this.readyState=e.DONE;this.error=t},999);this.bind("Load",function(){this.readyState=e.DONE},999)}var o=["loadstart","progress","load","abort","error","loadend"];return e.EMPTY=0,e.LOADING=1,e.DONE=2,e.prototype=r.instance,e});i("moxie/core/utils/Url",["moxie/core/utils/Basic"],function(n){var t=function(i,r){var o,s=["source","scheme","authority","userInfo","user","pass","host","port","relative","path","directory","file","query","fragment"],e=s.length,u={},h=/^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@\/]*):?([^:@\/]*))?@)?(\[[\da-fA-F:]+\]|[^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/.exec(i||""),c=/^\/\/\w/.test(i),f;switch(n.typeOf(r)){case"undefined":r=t(document.location.href,!1);break;case"string":r=t(r,!1)}for(;e--;)h[e]&&(u[s[e]]=h[e]);return(o=!c&&!u.scheme,(c||o)&&(u.scheme=r.scheme),o)&&(u.host=r.host,u.port=r.port,f="",/^[^\/]/.test(u.path)&&(f=r.path,f=/\/[^\/]*\.[^\/]*$/.test(f)?f.replace(/\/[^\/]+$/,"/"):f.replace(/\/?$/,"/")),u.path=f+(u.path||"")),u.port||(u.port={http:80,https:443}[u.scheme]||80),u.port=parseInt(u.port,10),u.path||(u.path="/"),delete u.source,u},i=function(n){var i="object"==typeof n?n:t(n);return i.scheme+"://"+i.host+(i.port!=={http:80,https:443}[i.scheme]?":"+i.port:"")+i.path+(i.query?i.query:"")},r=function(n){function i(n){return[n.scheme,n.host,n.port].join("/")}return"string"==typeof n&&(n=t(n)),i(t())===i(n)};return{parseUrl:t,resolveUrl:i,hasSameOrigin:r}});i("moxie/runtime/RuntimeTarget",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(n,t,i){function r(){this.uid=n.guid("uid_");t.call(this);this.destroy=function(){this.disconnectRuntime();this.unbindAll()}}return r.prototype=i.instance,r});i("moxie/file/FileReaderSync",["moxie/core/utils/Basic","moxie/runtime/RuntimeClient","moxie/core/utils/Encode"],function(n,t,i){return function(){function r(n,t){var f,r;if(!t.isDetached())return f=this.connectRuntime(t.ruid).exec.call(this,"FileReaderSync","read",n,t),this.disconnectRuntime(),f;r=t.getSource();switch(n){case"readAsBinaryString":return r;case"readAsDataURL":return"data:"+t.type+";base64,"+i.btoa(r);case"readAsText":for(var e="",u=0,o=r.length;o>u;u++)e+=String.fromCharCode(r[u]);return e}}t.call(this);n.extend(this,{uid:n.guid("uid_"),readAsBinaryString:function(n){return r.call(this,"readAsBinaryString",n)},readAsDataURL:function(n){return r.call(this,"readAsDataURL",n)},readAsText:function(n){return r.call(this,"readAsText",n)}})}});i("moxie/xhr/FormData",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/file/Blob"],function(n,t,i){function r(){var n,r=[];t.extend(this,{append:function(u,f){var o=this,e=t.typeOf(f);f instanceof i?n={name:u,value:f}:"array"===e?(u+="[]",t.each(f,function(n){o.append(u,n)})):"object"===e?t.each(f,function(n,t){o.append(u+"["+t+"]",n)}):"null"===e||"undefined"===e||"number"===e&&isNaN(f)?o.append(u,"false"):r.push({name:u,value:f.toString()})},hasBlob:function(){return!!this.getBlob()},getBlob:function(){return n&&n.value||null},getBlobName:function(){return n&&n.name||null},each:function(i){t.each(r,function(n){i(n.value,n.name)});n&&i(n.value,n.name)},destroy:function(){n=null;r=[]}})}return r});i("moxie/xhr/XMLHttpRequest",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/core/utils/Url","moxie/runtime/Runtime","moxie/runtime/RuntimeTarget","moxie/file/Blob","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/core/utils/Env","moxie/core/utils/Mime"],function(n,t,i,r,u,f,e,o,s,h,c,l){function y(){this.uid=n.guid("uid_")}function a(){function i(n,t){if(tt.hasOwnProperty(n))return 1===arguments.length?c.can("define_property")?tt[n]:vt[n]:(c.can("define_property")?tt[n]=t:vt[n]=t,void 0)}function pt(t){function u(){s&&(s.destroy(),s=null);r.dispatchEvent("loadend");r=null}function o(f){s.bind("LoadStart",function(n){i("readyState",a.LOADING);r.dispatchEvent("readystatechange");r.dispatchEvent(n);ft&&r.upload.dispatchEvent(n)});s.bind("Progress",function(n){i("readyState")!==a.LOADING&&(i("readyState",a.LOADING),r.dispatchEvent("readystatechange"));r.dispatchEvent(n)});s.bind("UploadProgress",function(n){ft&&r.upload.dispatchEvent({type:"progress",lengthComputable:!1,total:n.total,loaded:n.loaded})});s.bind("Load",function(t){i("readyState",a.DONE);i("status",Number(f.exec.call(s,"XMLHttpRequest","getStatus")||0));i("statusText",p[i("status")]||"");i("response",f.exec.call(s,"XMLHttpRequest","getResponse",i("responseType")));~n.inArray(i("responseType"),["text",""])?i("responseText",i("response")):"document"===i("responseType")&&i("responseXML",i("response"));nt=f.exec.call(s,"XMLHttpRequest","getAllResponseHeaders");r.dispatchEvent("readystatechange");i("status")>0?(ft&&r.upload.dispatchEvent(t),r.dispatchEvent(t)):(g=!0,r.dispatchEvent("error"));u()});s.bind("Abort",function(n){r.dispatchEvent(n);u()});s.bind("Error",function(n){g=!0;i("readyState",a.DONE);r.dispatchEvent("readystatechange");et=!0;r.dispatchEvent(n);u()});f.exec.call(s,"XMLHttpRequest","send",{url:ht,method:st,async:it,user:ct,password:lt,headers:b,mimeType:rt,encoding:yt,responseType:r.responseType,withCredentials:r.withCredentials,options:w},t)}var r=this;at=(new Date).getTime();s=new e;"string"==typeof w.required_caps&&(w.required_caps=f.parseCaps(w.required_caps));w.required_caps=n.extend({},w.required_caps,{return_response_type:r.responseType});t instanceof h&&(w.required_caps.send_multipart=!0);n.isEmptyObj(b)||(w.required_caps.send_custom_headers=!0);ot||(w.required_caps.do_cors=!0);w.ruid?o(s.connectRuntime(w)):(s.bind("RuntimeInit",function(n,t){o(t)}),s.bind("RuntimeError",function(n,t){r.dispatchEvent("RuntimeError",t)}),s.connectRuntime(w))}function wt(){i("responseText","");i("responseXML",null);i("response",null);i("status",0);i("statusText","");at=bt=null}var ht,st,ct,lt,at,bt,s,k,vt=this,tt={timeout:0,readyState:a.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},it=!0,b={},yt=null,rt=null,ut=!1,d=!1,ft=!1,et=!1,g=!1,ot=!1,kt=null,dt=null,w={},nt="";n.extend(this,tt,{uid:n.guid("uid_"),upload:new y,open:function(f,e,o,s,h){var c;if(!f||!e)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(f)||r.utf8_encode(f)!==f)throw new t.DOMException(t.DOMException.SYNTAX_ERR);if(~n.inArray(f.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(st=f.toUpperCase()),~n.inArray(st,["CONNECT","TRACE","TRACK"]))throw new t.DOMException(t.DOMException.SECURITY_ERR);if(e=r.utf8_encode(e),c=u.parseUrl(e),ot=u.hasSameOrigin(c),ht=u.resolveUrl(e),(s||h)&&!ot)throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);if(ct=s||c.user,lt=h||c.pass,it=o||!0,it===!1&&(i("timeout")||i("withCredentials")||""!==i("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);ut=!it;d=!1;b={};wt.call(this);i("readyState",a.OPENED);this.dispatchEvent("readystatechange")},setRequestHeader:function(u,f){if(i("readyState")!==a.OPENED||d)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(u)||r.utf8_encode(u)!==u)throw new t.DOMException(t.DOMException.SYNTAX_ERR);return u=n.trim(u).toLowerCase(),~n.inArray(u,["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"])||/^(proxy\-|sec\-)/.test(u)?!1:(b[u]?b[u]+=", "+f:b[u]=f,!0)},hasRequestHeader:function(n){return n&&b[n.toLowerCase()]||!1},getAllResponseHeaders:function(){return nt||""},getResponseHeader:function(t){return t=t.toLowerCase(),g||~n.inArray(t,["set-cookie","set-cookie2"])?null:nt&&""!==nt&&(k||(k={},n.each(nt.split(/\r\n/),function(t){var i=t.split(/:\s+/);2===i.length&&(i[0]=n.trim(i[0]),k[i[0].toLowerCase()]={header:i[0],value:n.trim(i[1])})})),k.hasOwnProperty(t))?k[t].header+": "+k[t].value:null},overrideMimeType:function(r){var u,f;if(~n.inArray(i("readyState"),[a.LOADING,a.DONE]))throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(r=n.trim(r.toLowerCase()),/;/.test(r)&&(u=r.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(r=u[1],u[2]&&(f=u[2])),!l.mimes[r])throw new t.DOMException(t.DOMException.SYNTAX_ERR);kt=r;dt=f},send:function(i,u){if(w="string"===n.typeOf(u)?{ruid:u}:u?u:{},this.readyState!==a.OPENED||d)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);if(i instanceof o)w.ruid=i.ruid,rt=i.type||"application/octet-stream";else if(i instanceof h){if(i.hasBlob()){var f=i.getBlob();w.ruid=f.ruid;rt=f.type||"application/octet-stream"}}else"string"==typeof i&&(yt="UTF-8",rt="text/plain;charset=UTF-8",i=r.utf8_encode(i));this.withCredentials||(this.withCredentials=w.required_caps&&w.required_caps.send_browser_cookies&&!ot);ft=!ut&&this.upload.hasEventListener();g=!1;et=!i;ut||(d=!0);pt.call(this,i)},abort:function(){if(g=!0,ut=!1,~n.inArray(i("readyState"),[a.UNSENT,a.OPENED,a.DONE]))i("readyState",a.UNSENT);else{if(i("readyState",a.DONE),d=!1,!s)throw new t.DOMException(t.DOMException.INVALID_STATE_ERR);s.getRuntime().exec.call(s,"XMLHttpRequest","abort",et);et=!0}},destroy:function(){s&&("function"===n.typeOf(s.destroy)&&s.destroy(),s=null);this.unbindAll();this.upload&&(this.upload.unbindAll(),this.upload=null)}});this.handleEventProps(v.concat(["readystatechange"]));this.upload.handleEventProps(v)}var p={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"},v;return y.prototype=i.instance,v=["loadstart","progress","abort","error","load","timeout","loadend"],a.UNSENT=0,a.OPENED=1,a.HEADERS_RECEIVED=2,a.LOADING=3,a.DONE=4,a.prototype=i.instance,a});i("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(n,t,i,r){function u(){function h(){f=e=0;o=this.result=null}function c(t,i){var s=this;r=i;s.bind("TransportingProgress",function(t){e=t.loaded;f>e&&-1===n.inArray(s.state,[u.IDLE,u.DONE])&&l.call(s)},999);s.bind("TransportingComplete",function(){e=f;s.state=u.DONE;o=null;s.result=r.exec.call(s,"Transporter","getAsBlob",t||"")},999);s.state=u.BUSY;s.trigger("TransportingStarted");l.call(s)}function l(){var n,u=this,i=f-e;s>i&&(s=i);n=t.btoa(o.substr(e,s));r.exec.call(u,"Transporter","receive",n,f)}var a,r,o,f,e,s;i.call(this);n.extend(this,{uid:n.guid("uid_"),state:u.IDLE,result:null,transport:function(t,i,r){var u=this,e;(r=n.extend({chunk_size:204798},r),(a=r.chunk_size%3)&&(r.chunk_size+=3-a),s=r.chunk_size,h.call(this),o=t,f=t.length,"string"===n.typeOf(r)||r.ruid)?c.call(u,i,this.connectRuntime(r)):(e=function(n,t){u.unbind("RuntimeInit",e);c.call(u,i,t)},this.bind("RuntimeInit",e),this.connectRuntime(r))},abort:function(){var n=this;n.state=u.IDLE;r&&(r.exec.call(n,"Transporter","clear"),n.trigger("TransportingAborted"));h.call(n)},destroy:function(){this.unbindAll();r=null;this.disconnectRuntime();h.call(this)}})}return u.IDLE=0,u.BUSY=1,u.DONE=2,u.prototype=r.instance,u});i("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(n,t,i,r,u,f,e,o,s,h,c,l,a){function v(){function p(n){try{return n||(n=this.exec("Image","getInfo")),this.size=n.size,this.width=n.width,this.height=n.height,this.type=n.type,this.meta=n.meta,""===this.name&&(this.name=n.name),!0}catch(t){return this.trigger("error",t.code),!1}}function r(t){var u=n.typeOf(t);try{if(t instanceof v){if(!t.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);w.apply(this,arguments)}else if(t instanceof c){if(!~n.inArray(t.type,["image/jpeg","image/png"]))throw new i.ImageError(i.ImageError.WRONG_FORMAT);h.apply(this,arguments)}else if(-1!==n.inArray(u,["blob","file"]))r.call(this,new l(null,t),arguments[1]);else if("string"===u)"data:"===t.substr(0,5)?r.call(this,new c(null,{data:t}),arguments[1]):b.apply(this,arguments);else{if("node"!==u||"img"!==t.nodeName.toLowerCase())throw new i.DOMException(i.DOMException.TYPE_MISMATCH_ERR);r.call(this,t.src,arguments[1])}}catch(f){this.trigger("error",f.code)}}function w(t,i){var r=this.connectRuntime(t.ruid);this.ruid=r.uid;r.exec.call(this,"Image","loadFromImage",t,"undefined"===n.typeOf(i)?!0:i)}function h(t,i){function u(n){r.ruid=n.uid;n.exec.call(r,"Image","loadFromBlob",t)}var r=this;r.name=t.name||"";t.isDetached()?(this.bind("RuntimeInit",function(n,t){u(t)}),i&&"string"==typeof i.required_caps&&(i.required_caps=f.parseCaps(i.required_caps)),this.connectRuntime(n.extend({required_caps:{access_image_binary:!0,resize_image:!0}},i))):u(this.connectRuntime(t.ruid))}function b(n,t){var i,r=this;i=new u;i.open("get",n);i.responseType="blob";i.onprogress=function(n){r.trigger(n)};i.onload=function(){h.call(r,i.response,!0)};i.onerror=function(n){r.trigger(n)};i.onloadend=function(){i.destroy()};i.bind("RuntimeError",function(n,t){r.trigger("RuntimeError",t)});i.send(null,t)}e.call(this);n.extend(this,{uid:n.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){r.apply(this,arguments)},resize:function(t){var o,e,u=this,r={x:0,y:0,width:u.width,height:u.height},f=n.extendIf({width:u.width,height:u.height,type:u.type||"image/jpeg",quality:90,crop:!1,fit:!0,preserveHeaders:!0,resample:"default",multipass:!0},t),s;try{if(!u.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);if(u.width>v.MAX_RESIZE_WIDTH||u.height>v.MAX_RESIZE_HEIGHT)throw new i.ImageError(i.ImageError.MAX_RESOLUTION_ERR);if((o=u.meta&&u.meta.tiff&&u.meta.tiff.Orientation||1,-1!==n.inArray(o,[5,6,7,8]))&&(s=f.width,f.width=f.height,f.height=s),f.crop){switch(e=Math.max(f.width/u.width,f.height/u.height),t.fit?(r.width=Math.min(Math.ceil(f.width/e),u.width),r.height=Math.min(Math.ceil(f.height/e),u.height),e=f.width/r.width):(r.width=Math.min(f.width,u.width),r.height=Math.min(f.height,u.height),e=1),"boolean"==typeof f.crop&&(f.crop="cc"),f.crop.toLowerCase().replace(/_/,"-")){case"rb":case"right-bottom":r.x=u.width-r.width;r.y=u.height-r.height;break;case"cb":case"center-bottom":r.x=Math.floor((u.width-r.width)/2);r.y=u.height-r.height;break;case"lb":case"left-bottom":r.x=0;r.y=u.height-r.height;break;case"lt":case"left-top":r.x=0;r.y=0;break;case"ct":case"center-top":r.x=Math.floor((u.width-r.width)/2);r.y=0;break;case"rt":case"right-top":r.x=u.width-r.width;r.y=0;break;case"rc":case"right-center":case"right-middle":r.x=u.width-r.width;r.y=Math.floor((u.height-r.height)/2);break;case"lc":case"left-center":case"left-middle":r.x=0;r.y=Math.floor((u.height-r.height)/2);break;case"cc":case"center-center":case"center-middle":default:r.x=Math.floor((u.width-r.width)/2);r.y=Math.floor((u.height-r.height)/2)}r.x=Math.max(r.x,0);r.y=Math.max(r.y,0)}else e=Math.min(f.width/u.width,f.height/u.height),e>1&&!f.fit&&(e=1);this.exec("Image","resize",r,e,f)}catch(h){u.trigger("error",h.code)}},downsize:function(t){var i,r={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,fit:!1,preserveHeaders:!0,resample:"default"};i="object"==typeof t?n.extend(r,t):n.extend(r,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]});this.resize(i)},crop:function(n,t,i){this.downsize(n,t,!0,i)},getAsCanvas:function(){if(!s.can("create_canvas"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return this.exec("Image","getAsCanvas")},getAsBlob:function(n,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",n||"image/jpeg",t||90)},getAsDataURL:function(n,t){if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",n||"image/jpeg",t||90)},getAsBinaryString:function(n,t){var i=this.getAsDataURL(n,t);return a.atob(i.substring(i.indexOf("base64,")+7))},embed:function(r,u){function l(t,u){var f=this,l,h,v;if(s.can("create_canvas")&&(l=f.getAsCanvas(),l))return r.appendChild(l),l=null,f.destroy(),e.trigger("embedded"),void 0;if(h=f.getAsDataURL(t,u),!h)throw new i.ImageError(i.ImageError.WRONG_FORMAT);s.can("use_data_uri_of",h.length)?(r.innerHTML='<img src="'+h+'" width="'+f.width+'" height="'+f.height+'" alt="" />',f.destroy(),e.trigger("embedded")):(v=new o,v.bind("TransportingComplete",function(){c=e.connectRuntime(this.result.ruid);e.bind("Embedded",function(){n.extend(c.getShimContainer().style,{top:"0px",left:"0px",width:f.width+"px",height:f.height+"px"});c=null},999);c.exec.call(e,"ImageView","display",this.result.uid,width,height);f.destroy()}),v.transport(a.atob(h.substring(h.indexOf("base64,")+7)),t,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:r}))}var c,e=this,h=n.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,fit:!0,resample:"nearest"},u),f;try{if(!(r=t.get(r)))throw new i.DOMException(i.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new i.DOMException(i.DOMException.INVALID_STATE_ERR);return this.width>v.MAX_RESIZE_WIDTH||this.height>v.MAX_RESIZE_HEIGHT,f=new v,f.bind("Resize",function(){l.call(this,h.type,h.quality)}),f.bind("Load",function(){this.downsize(h)}),this.meta.thumb&&this.meta.thumb.width>=h.width&&this.meta.thumb.height>=h.height?f.load(this.meta.thumb.data):f.clone(this,!1),f}catch(y){this.trigger("error",y.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime());this.meta&&this.meta.thumb&&this.meta.thumb.data.destroy();this.unbindAll()}});this.handleEventProps(y);this.bind("Load Resize",function(){return p.call(this)},999)}var y=["progress","load","error","resize","embedded"];return v.MAX_RESIZE_WIDTH=8192,v.MAX_RESIZE_HEIGHT=8192,v.prototype=h.instance,v});i("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(n,t,i,u){function o(t){var o=this,s=i.capTest,h=i.capTrue,c=n.extend({access_binary:s(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return o.can("access_binary")&&!!f.Image},display_media:s((u.can("create_canvas")||u.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:s(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:s(function(){var n=document.createElement("div");return("draggable"in n||"ondragstart"in n&&"ondrop"in n)&&("IE"!==u.browser||u.verComp(u.version,9,">"))}()),filter_by_extension:s(function(){return!("Chrome"===u.browser&&u.verComp(u.version,28,"<")||"IE"===u.browser&&u.verComp(u.version,10,"<")||"Safari"===u.browser&&u.verComp(u.version,7,"<")||"Firefox"===u.browser&&u.verComp(u.version,37,"<"))}()),return_response_headers:h,return_response_type:function(n){return"json"===n&&window.JSON?!0:u.can("return_response_type",n)},return_status_code:h,report_upload_progress:s(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return o.can("access_binary")&&u.can("create_canvas")},select_file:function(){return u.can("use_fileinput")&&window.File},select_folder:function(){return o.can("select_file")&&("Chrome"===u.browser&&u.verComp(u.version,21,">=")||"Firefox"===u.browser&&u.verComp(u.version,42,">="))},select_multiple:function(){return!(!o.can("select_file")||"Safari"===u.browser&&"Windows"===u.os||"iOS"===u.os&&u.verComp(u.osVersion,"7.0.0",">")&&u.verComp(u.osVersion,"8.0.0","<"))},send_binary_string:s(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:s(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||o.can("send_binary_string")},slice_blob:s(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return o.can("slice_blob")&&o.can("send_multipart")},summon_file_dialog:function(){return o.can("select_file")&&!("Firefox"===u.browser&&u.verComp(u.version,4,"<")||"Opera"===u.browser&&u.verComp(u.version,12,"<")||"IE"===u.browser&&u.verComp(u.version,10,"<"))},upload_filesize:h,use_http_method:h},arguments[2]);i.call(this,t,arguments[1]||e,c);n.extend(this,{init:function(){this.trigger("Init")},destroy:function(n){return function(){n.call(o);n=o=null}}(this.destroy)});n.extend(this.getShim(),f)}var e="html5",f={};return i.addConstructor(e,o),f});i("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(n,t){function i(){function n(n,t,i){var r;if(!window.File.prototype.slice)return(r=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?r.call(n,t,i):null;try{return n.slice(),n.slice(t,i)}catch(u){return n.slice(t,i-t)}}this.slice=function(){return new t(this.getRuntime().uid,n.apply(this,arguments))};this.destroy=function(){this.getRuntime().getShim().removeInstance(this.uid)}}return n.Blob=i});i("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(n){function u(){this.returnValue=!1}function f(){this.cancelBubble=!0}var i={},t="moxie_"+n.guid(),e=function(r,e,o,s){var h,c;e=e.toLowerCase();r.addEventListener?(h=o,r.addEventListener(e,h,!1)):r.attachEvent&&(h=function(){var n=window.event;n.target||(n.target=n.srcElement);n.preventDefault=u;n.stopPropagation=f;o(n)},r.attachEvent("on"+e,h));r[t]||(r[t]=n.guid());i.hasOwnProperty(r[t])||(i[r[t]]={});c=i[r[t]];c.hasOwnProperty(e)||(c[e]=[]);c[e].push({func:h,orig:o,key:s})},r=function(r,u,f){var e,s,o;if(u=u.toLowerCase(),r[t]&&i[r[t]]&&i[r[t]][u]){for(e=i[r[t]][u],o=e.length-1;o>=0&&(e[o].orig!==f&&e[o].key!==f||(r.removeEventListener?r.removeEventListener(u,e[o].func,!1):r.detachEvent&&r.detachEvent("on"+u,e[o].func),e[o].orig=null,e[o].func=null,e.splice(o,1),f===s));o--);if(e.length||delete i[r[t]][u],n.isEmptyObj(i[r[t]])){delete i[r[t]];try{delete r[t]}catch(h){r[t]=s}}}},o=function(u,f){u&&u[t]&&n.each(i[u[t]],function(n,t){r(u,t,f)})};return{addEvent:e,removeEvent:r,removeAllEvents:o}});i("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(n,t,i,r,u,f,e){function o(){var n,o;i.extend(this,{init:function(s){var a,v,p,l,w,y,h=this,c=h.getRuntime();n=s;p=f.extList2mimes(n.accept,c.can("filter_by_extension"));v=c.getShimContainer();v.innerHTML='<input id="'+c.uid+'" type="file" style="font-size:999px;opacity:0;"'+(n.multiple&&c.can("select_multiple")?"multiple":"")+(n.directory&&c.can("select_folder")?"webkitdirectory directory":"")+(p?' accept="'+p.join(",")+'"':"")+" />";a=r.get(c.uid);i.extend(a.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"});l=r.get(n.browse_button);o=r.getStyle(l,"z-index")||"auto";c.can("summon_file_dialog")&&("static"===r.getStyle(l,"position")&&(l.style.position="relative"),u.addEvent(l,"click",function(n){var t=r.get(c.uid);t&&!t.disabled&&t.click();n.preventDefault()},h.uid),h.bind("Refresh",function(){w=parseInt(o,10)||1;r.get(n.browse_button).style.zIndex=w;this.getRuntime().getShimContainer().style.zIndex=w-1}));y=c.can("summon_file_dialog")?l:v;u.addEvent(y,"mouseover",function(){h.trigger("mouseenter")},h.uid);u.addEvent(y,"mouseout",function(){h.trigger("mouseleave")},h.uid);u.addEvent(y,"mousedown",function(){h.trigger("mousedown")},h.uid);u.addEvent(r.get(n.container),"mouseup",function(){h.trigger("mouseup")},h.uid);(c.can("summon_file_dialog")?a:l).setAttribute("tabindex",-1);a.onchange=function b(){if(h.files=[],i.each(this.files,function(i){var r="";return n.directory&&"."==i.name?!0:(i.webkitRelativePath&&(r="/"+i.webkitRelativePath.replace(/^\//,"")),i=new t(c.uid,i),i.relativePath=r,h.files.push(i),void 0)}),"IE"!==e.browser&&"IEMobile"!==e.browser)this.value="";else{var r=this.cloneNode(!0);this.parentNode.replaceChild(r,this);r.onchange=b}h.files.length&&h.trigger("change")};h.trigger({type:"ready",async:!0});v=null},setOption:function(n,t){var u=this.getRuntime(),i=r.get(u.uid),e;switch(n){case"accept":t?(e=t.mimes||f.extList2mimes(t,u.can("filter_by_extension")),i.setAttribute("accept",e.join(","))):i.removeAttribute("accept");break;case"directory":t&&u.can("select_folder")?(i.setAttribute("directory",""),i.setAttribute("webkitdirectory","")):(i.removeAttribute("directory"),i.removeAttribute("webkitdirectory"));break;case"multiple":t&&u.can("select_multiple")?i.setAttribute("multiple",""):i.removeAttribute("multiple")}},disable:function(n){var t,i=this.getRuntime();(t=r.get(i.uid))&&(t.disabled=!!n)},destroy:function(){var e=this.getRuntime(),s=e.getShim(),t=e.getShimContainer(),f=n&&r.get(n.container),i=n&&r.get(n.browse_button);f&&u.removeAllEvents(f,this.uid);i&&(u.removeAllEvents(i,this.uid),i.style.zIndex=o);t&&(u.removeAllEvents(t,this.uid),t.innerHTML="");s.removeInstance(this.uid);n=t=f=i=s=null}})}return n.FileInput=o});i("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(n,t,i,r,u,f){function e(){function c(n){if(!n.dataTransfer||!n.dataTransfer.types)return!1;var t=i.toArray(n.dataTransfer.types||[]);return-1!==i.inArray("Files",t)||-1!==i.inArray("public.file-url",t)||-1!==i.inArray("application/x-moz-file",t)}function s(n,i){if(v(n)){var r=new t(h,n);r.relativePath=i||"";e.push(r)}}function a(n){for(var t=[],r=0;r<n.length;r++)[].push.apply(t,n[r].extensions.split(/\s*,\s*/));return-1===i.inArray("*",t)?t:[]}function v(n){if(!o.length)return!0;var t=f.getFileExtension(n.name);return!t||-1!==i.inArray(t,o)}function y(n,t){var r=[];i.each(n,function(n){var t=n.webkitGetAsEntry();t&&(t.isFile?s(n.getAsFile(),t.fullPath):r.push(t))});r.length?l(r,t):t()}function l(n,t){var r=[];i.each(n,function(n){r.push(function(t){p(n,t)})});i.inSeries(r,function(){t()})}function p(n,t){n.isFile?n.file(function(i){s(i,n.fullPath);t()},function(){t()}):n.isDirectory?w(n,t):t()}function w(n,t){function i(n){u.readEntries(function(t){t.length?([].push.apply(r,t),i(n)):n()},n)}var r=[],u=n.createReader();i(function(){l(r,t)})}var n,h,e=[],o=[];i.extend(this,{init:function(t){var f,r=this;n=t;h=r.ruid;o=a(n.accept);f=n.container;u.addEvent(f,"dragover",function(n){c(n)&&(n.preventDefault(),n.dataTransfer.dropEffect="copy")},r.uid);u.addEvent(f,"drop",function(n){c(n)&&(n.preventDefault(),e=[],n.dataTransfer.items&&n.dataTransfer.items[0].webkitGetAsEntry?y(n.dataTransfer.items,function(){r.files=e;r.trigger("drop")}):(i.each(n.dataTransfer.files,function(n){s(n)}),r.files=e,r.trigger("drop")))},r.uid);u.addEvent(f,"dragenter",function(){r.trigger("dragenter")},r.uid);u.addEvent(f,"dragleave",function(){r.trigger("dragleave")},r.uid)},destroy:function(){u.removeAllEvents(n&&r.get(n.container),this.uid);h=e=o=n=null;this.getRuntime().getShim().removeInstance(this.uid)}})}return n.FileDrop=e});i("moxie/runtime/html5/file/FileReader",["moxie/runtime/html5/Runtime","moxie/core/utils/Encode","moxie/core/utils/Basic"],function(n,t,i){function r(){function u(n){return t.atob(n.substring(n.indexOf("base64,")+7))}var n,r=!1;i.extend(this,{read:function(t,f){var e=this;e.result="";n=new window.FileReader;n.addEventListener("progress",function(n){e.trigger(n)});n.addEventListener("load",function(t){e.result=r?u(n.result):n.result;e.trigger(t)});n.addEventListener("error",function(t){e.trigger(t,n.error)});n.addEventListener("loadend",function(t){n=null;e.trigger(t)});"function"===i.typeOf(n[t])?(r=!1,n[t](f.getSource())):"readAsBinaryString"===t&&(r=!0,n.readAsDataURL(f.getSource()))},abort:function(){n&&n.abort()},destroy:function(){n=null;this.getRuntime().getShim().removeInstance(this.uid)}})}return n.FileReader=r});i("moxie/runtime/html5/xhr/XMLHttpRequest",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/utils/Mime","moxie/core/utils/Url","moxie/file/File","moxie/file/Blob","moxie/xhr/FormData","moxie/core/Exceptions","moxie/core/utils/Env"],function(n,t,i,r,u,f,e,o,s){function h(){function l(n,t){var r,i,u=this;r=t.getBlob().getSource();i=new window.FileReader;i.onload=function(){t.append(t.getBlobName(),new f(null,{type:r.type,data:i.result}));c.send.call(u,n,t)};i.readAsBinaryString(r)}function a(){return!window.XMLHttpRequest||"IE"===s.browser&&s.verComp(s.version,8,"<")?function(){for(var t=["Msxml2.XMLHTTP.6.0","Microsoft.XMLHTTP"],n=0;n<t.length;n++)try{return new ActiveXObject(t[n])}catch(i){}}():new window.XMLHttpRequest}function v(n){var t=n.responseXML,i=n.responseText;return"IE"===s.browser&&i&&t&&!t.documentElement&&/[^\/]+\/[^\+]+\+xml/.test(n.getResponseHeader("Content-Type"))&&(t=new window.ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.validateOnParse=!1,t.loadXML(i)),t&&("IE"===s.browser&&0!==t.parseError||!t.documentElement||"parsererror"===t.documentElement.tagName)?null:t}function y(t){var r="----moxieboundary"+(new Date).getTime(),u="--",i="\r\n",e="",s=this.getRuntime();if(!s.can("send_binary_string"))throw new o.RuntimeError(o.RuntimeError.NOT_SUPPORTED_ERR);return n.setRequestHeader("Content-Type","multipart/form-data; boundary="+r),t.each(function(n,t){e+=n instanceof f?u+r+i+'Content-Disposition: form-data; name="'+t+'"; filename="'+unescape(encodeURIComponent(n.name||"blob"))+'"'+i+"Content-Type: "+(n.type||"application/octet-stream")+i+i+n.getSource()+i:u+r+i+'Content-Disposition: form-data; name="'+t+'"'+i+i+unescape(encodeURIComponent(n))+i}),e+=u+r+u+i}var n,h,c=this;t.extend(this,{send:function(i,u){var o=this,p="Mozilla"===s.browser&&s.verComp(s.version,4,">=")&&s.verComp(s.version,7,"<"),w="Android Browser"===s.browser,v=!1,c;if(h=i.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),n=a(),n.open(i.method,i.url,i.async,i.user,i.password),u instanceof f)u.isDetached()&&(v=!0),u=u.getSource();else if(u instanceof e){if(u.hasBlob())if(u.getBlob().isDetached())u=y.call(o,u),v=!0;else if((p||w)&&"blob"===t.typeOf(u.getBlob().getSource())&&window.FileReader)return l.call(o,i,u),void 0;u instanceof e&&(c=new window.FormData,u.each(function(n,t){n instanceof f?c.append(t,n.getSource()):c.append(t,n)}),u=c)}n.upload?(i.withCredentials&&(n.withCredentials=!0),n.addEventListener("load",function(n){o.trigger(n)}),n.addEventListener("error",function(n){o.trigger(n)}),n.addEventListener("progress",function(n){o.trigger(n)}),n.upload.addEventListener("progress",function(n){o.trigger({type:"UploadProgress",loaded:n.loaded,total:n.total})})):n.onreadystatechange=function(){switch(n.readyState){case 3:var t,u;try{r.hasSameOrigin(i.url)&&(t=n.getResponseHeader("Content-Length")||0);n.responseText&&(u=n.responseText.length)}catch(f){t=u=0}o.trigger({type:"progress",lengthComputable:!!t,total:parseInt(t,10),loaded:u});break;case 4:n.onreadystatechange=function(){};try{if(n.status>=200&&n.status<400){o.trigger("load");break}}catch(f){}o.trigger("error")}};t.isEmptyObj(i.headers)||t.each(i.headers,function(t,i){n.setRequestHeader(i,t)});""!==i.responseType&&"responseType"in n&&(n.responseType="json"!==i.responseType||s.can("return_response_type","json")?i.responseType:"text");v?n.sendAsBinary?n.sendAsBinary(u):function(){for(var i=new Uint8Array(u.length),t=0;t<u.length;t++)i[t]=255&u.charCodeAt(t);n.send(i.buffer)}():n.send(u);o.trigger("loadstart")},getStatus:function(){try{if(n)return n.status}catch(t){}return 0},getResponse:function(t){var o=this.getRuntime(),r,f,e;try{switch(t){case"blob":return r=new u(o.uid,n.response),f=n.getResponseHeader("Content-Disposition"),f&&(e=f.match(/filename=([\'\"'])([^\1]+)\1/),e&&(h=e[2])),r.name=h,r.type||(r.type=i.getFileMime(h)),r;case"json":return s.can("return_response_type","json")?n.response:200===n.status&&window.JSON?JSON.parse(n.responseText):null;case"document":return v(n);default:return""!==n.responseText?n.responseText:null}}catch(c){return null}},getAllResponseHeaders:function(){try{return n.getAllResponseHeaders()}catch(t){}return""},abort:function(){n&&n.abort()},destroy:function(){c=h=null;this.getRuntime().getShim().removeInstance(this.uid)}})}return n.XMLHttpRequest=h});i("moxie/runtime/html5/utils/BinaryReader",["moxie/core/utils/Basic"],function(n){function t(n){n instanceof ArrayBuffer?i.apply(this,arguments):r.apply(this,arguments)}function i(t){var i=new DataView(t);n.extend(this,{readByteAt:function(n){return i.getUint8(n)},writeByteAt:function(n,t){i.setUint8(n,t)},SEGMENT:function(n,r,u){switch(arguments.length){case 2:return t.slice(n,n+r);case 1:return t.slice(n);case 3:if(null===u&&(u=new ArrayBuffer),u instanceof ArrayBuffer){var f=new Uint8Array(this.length()-r+u.byteLength);n>0&&f.set(new Uint8Array(t.slice(0,n)),0);f.set(new Uint8Array(u),n);f.set(new Uint8Array(t.slice(n+r)),n+u.byteLength);this.clear();t=f.buffer;i=new DataView(t);break}default:return t}},length:function(){return t?t.byteLength:0},clear:function(){i=t=null}})}function r(t){function i(n,i,r){r=3===arguments.length?r:t.length-i-1;t=t.substr(0,i)+n+t.substr(r+i)}n.extend(this,{readByteAt:function(n){return t.charCodeAt(n)},writeByteAt:function(n,t){i(String.fromCharCode(t),n,1)},SEGMENT:function(n,r,u){switch(arguments.length){case 1:return t.substr(n);case 2:return t.substr(n,r);case 3:i(null!==u?u:"",n,r);break;default:return t}},length:function(){return t?t.length:0},clear:function(){t=null}})}return n.extend(t.prototype,{littleEndian:!1,read:function(n,t){var r,u,i;if(n+t>this.length())throw new Error("You are trying to read outside the source boundaries.");for(u=this.littleEndian?0:-8*(t-1),i=0,r=0;t>i;i++)r|=this.readByteAt(n+i)<<Math.abs(u+8*i);return r},write:function(n,t,i){var u,r;if(n>this.length())throw new Error("You are trying to write outside the source boundaries.");for(u=this.littleEndian?0:-8*(i-1),r=0;i>r;r++)this.writeByteAt(n+r,255&t>>Math.abs(u+8*r))},BYTE:function(n){return this.read(n,1)},SHORT:function(n){return this.read(n,2)},LONG:function(n){return this.read(n,4)},SLONG:function(n){var t=this.read(n,4);return t>2147483647?t-4294967296:t},CHAR:function(n){return String.fromCharCode(this.read(n,1))},STRING:function(n,t){return this.asArray("CHAR",n,t).join("")},asArray:function(n,t,i){for(var u=[],r=0;i>r;r++)u[r]=this[n](t+r);return u}}),t});i("moxie/runtime/html5/image/JPEGHeaders",["moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(n,t){return function i(r){var o,f,e,u=[],s=0;if(o=new n(r),65496!==o.SHORT(0))throw o.clear(),new t.ImageError(t.ImageError.WRONG_FORMAT);for(f=2;f<=o.length();)if(e=o.SHORT(f),e>=65488&&65495>=e)f+=2;else{if(65498===e||65497===e)break;s=o.SHORT(f+2)+2;e>=65505&&65519>=e&&u.push({hex:e,name:"APP"+(15&e),start:f,length:s,segment:o.SEGMENT(f,s)});f+=s}return o.clear(),{headers:u,restore:function(t){var e,r,i;for(i=new n(t),f=65504==i.SHORT(2)?4+i.SHORT(4):2,r=0,e=u.length;e>r;r++)i.SEGMENT(f,0,u[r].segment),f+=u[r].length;return t=i.SEGMENT(),i.clear(),t},strip:function(t){var r,u,e,f;for(e=new i(t),u=e.headers,e.purge(),r=new n(t),f=u.length;f--;)r.SEGMENT(u[f].start,u[f].length,"");return t=r.SEGMENT(),r.clear(),t},get:function(n){for(var i=[],t=0,r=u.length;r>t;t++)u[t].name===n.toUpperCase()&&i.push(u[t].segment);return i},set:function(n,t){var i,r,e,f=[];for("string"==typeof t?f.push(t):f=t,i=r=0,e=u.length;e>i&&(u[i].name===n.toUpperCase()&&(u[i].segment=f[r],u[i].length=f[r].length,r++),!(r>=f.length));i++);},purge:function(){this.headers=u=[]}}}});i("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(n,i,r){function u(f){function h(i,u){for(var s,a,h,v,f,y,o=this,p=[],w={},k={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},d={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8},b=o.SHORT(i),l=0;b>l;l++)if(p=[],f=i+2+12*l,s=u[o.SHORT(f)],s!==t){if(a=k[o.SHORT(f+=2)],h=o.LONG(f+=2),v=d[a],!v)throw new r.ImageError(r.ImageError.INVALID_META_ERR);if(f+=4,v*h>4&&(f=o.LONG(f)+e.tiffHeader),f+v*h>=this.length())throw new r.ImageError(r.ImageError.INVALID_META_ERR);"ASCII"!==a?(p=o.asArray(a,f,h),y=1==h?p[0]:p,w[s]=c.hasOwnProperty(s)&&"object"!=typeof y?c[s][y]:y):w[s]=n.trim(o.STRING(f,h).replace(/\0$/,""))}return w}function y(n,t,i){var u,l,f,o=0,h,c,r;if("string"==typeof t){h=s[n.toLowerCase()];for(c in h)if(h[c]===t){t=c;break}}for(u=e[n.toLowerCase()+"IFD"],l=this.SHORT(u),r=0;l>r;r++)if(f=u+12*r+2,this.SHORT(f)==t){o=f+8;break}if(!o)return!1;try{this.write(o,i,4)}catch(a){return!1}return!0}var a,s,c,e,l,o,v;if(i.call(this,f),s={tiff:{274:"Orientation",270:"ImageDescription",271:"Make",272:"Model",305:"Software",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37386:"FocalLength",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"},thumb:{513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength"}},c={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}},e={tiffHeader:10},l=e.tiffHeader,a={clear:this.clear},n.extend(this,{read:function(){try{return u.prototype.read.apply(this,arguments)}catch(n){throw new r.ImageError(r.ImageError.INVALID_META_ERR);}},write:function(){try{return u.prototype.write.apply(this,arguments)}catch(n){throw new r.ImageError(r.ImageError.INVALID_META_ERR);}},UNDEFINED:function(){return this.BYTE.apply(this,arguments)},RATIONAL:function(n){return this.LONG(n)/this.LONG(n+4)},SRATIONAL:function(n){return this.SLONG(n)/this.SLONG(n+4)},ASCII:function(n){return this.CHAR(n)},TIFF:function(){return o||null},EXIF:function(){var t=null,i,r;if(e.exifIFD){try{t=h.call(this,e.exifIFD,s.exif)}catch(u){return null}if(t.ExifVersion&&"array"===n.typeOf(t.ExifVersion)){for(i=0,r="";i<t.ExifVersion.length;i++)r+=String.fromCharCode(t.ExifVersion[i]);t.ExifVersion=r}}return t},GPS:function(){var t=null;if(e.gpsIFD){try{t=h.call(this,e.gpsIFD,s.gps)}catch(i){return null}t.GPSVersionID&&"array"===n.typeOf(t.GPSVersionID)&&(t.GPSVersionID=t.GPSVersionID.join("."))}return t},thumb:function(){if(e.IFD1)try{var n=h.call(this,e.IFD1,s.thumb);if("JPEGInterchangeFormat"in n)return this.SEGMENT(e.tiffHeader+n.JPEGInterchangeFormat,n.JPEGInterchangeFormatLength)}catch(t){}return null},setExif:function(n,t){return"PixelXDimension"!==n&&"PixelYDimension"!==n?!1:y.call(this,"exif",n,t)},clear:function(){a.clear();f=s=c=o=e=a=null}}),65505!==this.SHORT(0)||"EXIF\0"!==this.STRING(4,5).toUpperCase())throw new r.ImageError(r.ImageError.INVALID_META_ERR);if(this.littleEndian=18761==this.SHORT(l),42!==this.SHORT(l+=2))throw new r.ImageError(r.ImageError.INVALID_META_ERR);e.IFD0=e.tiffHeader+this.LONG(l+=2);o=h.call(this,e.IFD0,s.tiff);"ExifIFDPointer"in o&&(e.exifIFD=e.tiffHeader+o.ExifIFDPointer,delete o.ExifIFDPointer);"GPSInfoIFDPointer"in o&&(e.gpsIFD=e.tiffHeader+o.GPSInfoIFDPointer,delete o.GPSInfoIFDPointer);n.isEmptyObj(o)&&(o=null);v=this.LONG(e.IFD0+12*this.SHORT(e.IFD0)+2);v&&(e.IFD1=e.tiffHeader+v)}return u.prototype=i.prototype,u});i("moxie/runtime/html5/image/JPEG",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEGHeaders","moxie/runtime/html5/utils/BinaryReader","moxie/runtime/html5/image/ExifParser"],function(n,t,i,r,u){function f(f){function c(n){var i,r,t=0;for(n||(n=s);t<=n.length();){if(i=n.SHORT(t+=2),i>=65472&&65475>=i)return t+=5,{height:n.SHORT(t),width:n.SHORT(t+=2)};r=n.SHORT(t+=2);t+=r-2}return null}function l(){var t,n,i=e.thumb();return i&&(t=new r(i),n=c(t),t.clear(),n)?(n.data=i,n):null}function a(){e&&o&&s&&(e.clear(),o.purge(),s.clear(),h=o=e=s=null)}var s,o,e,h;if(s=new r(f),65496!==s.SHORT(0))throw new t.ImageError(t.ImageError.WRONG_FORMAT);o=new i(f);try{e=new u(o.get("app1")[0])}catch(v){}h=c.call(this);n.extend(this,{type:"image/jpeg",size:s.length(),width:h&&h.width||0,height:h&&h.height||0,setExif:function(t,i){return e?("object"===n.typeOf(t)?n.each(t,function(n,t){e.setExif(t,n)}):e.setExif(t,i),o.set("app1",e.SEGMENT()),void 0):!1},writeHeaders:function(){return arguments.length?o.restore(arguments[0]):o.restore(f)},stripHeaders:function(n){return o.strip(n)},purge:function(){a.call(this)}});e&&(this.meta={tiff:e.TIFF(),exif:e.EXIF(),gps:e.GPS(),thumb:l()})}return f});i("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(n,t,i){function r(r){function o(){var n,t;return n=s.call(this,8),"IHDR"==n.type?(t=n.start,{width:u.LONG(t),height:u.LONG(t+=4)}):null}function e(){u&&(u.clear(),r=f=h=c=u=null)}function s(n){var t,i,r,f;return t=u.LONG(n),i=u.STRING(n+=4,4),r=n+=4,f=u.LONG(n+t),{length:t,type:i,start:r,CRC:f}}var u,h,c,f;u=new i(r),function(){for(var i=0,t=0,r=[35152,20039,3338,6666],t=0;t<r.length;t++,i+=2)if(r[t]!=u.SHORT(i))throw new n.ImageError(n.ImageError.WRONG_FORMAT);}();f=o.call(this);t.extend(this,{type:"image/png",size:u.length(),width:f.width,height:f.height,purge:function(){e.call(this)}});e.call(this)}return r});i("moxie/runtime/html5/image/ImageInfo",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/html5/image/JPEG","moxie/runtime/html5/image/PNG"],function(n,t,i,r){return function(u){var f,e=[i,r];f=function(){for(var n=0;n<e.length;n++)try{return new e[n](u)}catch(i){}throw new t.ImageError(t.ImageError.WRONG_FORMAT);}();n.extend(this,{type:"",size:0,width:0,height:0,setExif:function(){},writeHeaders:function(n){return n},stripHeaders:function(n){return n},purge:function(){u=null}});n.extend(this,f);this.purge=function(){f.purge();f=null}}});i("moxie/runtime/html5/image/ResizerCanvas",[],function(){function n(i,r,u){var e=i.width>i.height?"width":"height",s=Math.round(i[e]*r),o=!1,f;return"nearest"!==u&&(.5>r||r>2)&&(r=.5>r?.5:2,o=!0),f=t(i,r),o?n(f,s/f[e],u):f}function t(n,t){var r=n.width,u=n.height,f=Math.round(r*t),e=Math.round(u*t),i=document.createElement("canvas");return i.width=f,i.height=e,i.getContext("2d").drawImage(n,0,0,r,u,0,0,f,e),n=null,i}return{scale:n}});i("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/ResizerCanvas","moxie/core/utils/Mime","moxie/core/utils/Env"],function(n,t,i,r,u,f,e,o,s){function h(){function p(){if(!n&&!a)throw new i.ImageError(i.DOMException.INVALID_STATE_ERR);return n||a}function k(){var t=p();return"canvas"==t.nodeName.toLowerCase()?t:(n=document.createElement("canvas"),n.width=t.width,n.height=t.height,n.getContext("2d").drawImage(t,0,0),n)}function w(n){return r.atob(n.substring(n.indexOf("base64,")+7))}function nt(n,t){return"data:"+(t||"")+";base64,"+r.btoa(n)}function d(n){var t=this;a=new Image;a.onerror=function(){g.call(this);t.trigger("error",i.ImageError.WRONG_FORMAT)};a.onload=function(){t.trigger("load")};a.src="data:"==n.substr(0,5)?n:nt(n,l.type)}function tt(n,t){var r,u=this;return window.FileReader?(r=new FileReader,r.onload=function(){t.call(u,this.result)},r.onerror=function(){u.trigger("error",i.ImageError.WRONG_FORMAT)},r.readAsDataURL(n),void 0):t.call(this,n.getAsDataURL())}function it(n,i){var o=Math.PI/180,e=document.createElement("canvas"),r=e.getContext("2d"),u=n.width,f=n.height;switch(t.inArray(i,[5,6,7,8])>-1?(e.width=f,e.height=u):(e.width=u,e.height=f),i){case 2:r.translate(u,0);r.scale(-1,1);break;case 3:r.translate(u,f);r.rotate(180*o);break;case 4:r.translate(0,f);r.scale(1,-1);break;case 5:r.rotate(90*o);r.scale(1,-1);break;case 6:r.rotate(90*o);r.translate(0,-f);break;case 7:r.rotate(90*o);r.translate(u,-f);r.scale(-1,1);break;case 8:r.rotate(-90*o);r.translate(-u,0)}return r.drawImage(n,0,0,u,f),e}function g(){c&&(c.purge(),c=null);h=a=n=l=null;v=!1}var a,c,n,h,l,y=this,v=!1,b=!0;t.extend(this,{loadFromBlob:function(n){var t=this.getRuntime(),r=arguments.length>1?arguments[1]:!0;if(!t.can("access_binary"))throw new i.RuntimeError(i.RuntimeError.NOT_SUPPORTED_ERR);return l=n,n.isDetached()?(h=n.getSource(),d.call(this,h),void 0):(tt.call(this,n.getSource(),function(n){r&&(h=w(n));d.call(this,n)}),void 0)},loadFromImage:function(n,t){this.meta=n.meta;l=new f(null,{name:n.name,size:n.size,type:n.type});d.call(this,t?h=n.getAsBinaryString():n.getAsDataURL())},getInfo:function(){var n,t=this.getRuntime();return!c&&h&&t.can("access_image_binary")&&(c=new e(h)),n={width:p().width||0,height:p().height||0,type:l.type||s.getFileMime(l.name),size:h&&h.length||l.size||0,name:l.name||"",meta:null},b&&(n.meta=c&&c.meta||this.meta||{},!n.meta||!n.meta.thumb||n.meta.thumb.data instanceof u||(n.meta.thumb.data=new u(null,{type:"image/jpeg",data:n.meta.thumb.data}))),n},resize:function(t,i,r){var u=document.createElement("canvas"),f;(u.width=t.width,u.height=t.height,u.getContext("2d").drawImage(p(),t.x,t.y,t.width,t.height,0,0,u.width,u.height),n=o.scale(u,i),b=r.preserveHeaders,b)||(f=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,n=it(n,f));this.width=n.width;this.height=n.height;v=!0;this.trigger("Resize")},getAsCanvas:function(){return n||(n=k()),n.id=this.uid+"_canvas",n},getAsBlob:function(n,t){return n!==this.type?(v=!0,new f(null,{name:l.name||"",type:n,data:y.getAsDataURL(n,t)})):new f(null,{name:l.name||"",type:n,data:y.getAsBinaryString(n,t)})},getAsDataURL:function(t){var i=arguments[1]||90;if(!v)return a.src;if(k(),"image/jpeg"!==t)return n.toDataURL("image/png");try{return n.toDataURL("image/jpeg",i/100)}catch(r){return n.toDataURL("image/jpeg")}},getAsBinaryString:function(t,i){if(!v)return h||(h=w(y.getAsDataURL(t,i))),h;if("image/jpeg"!==t)h=w(y.getAsDataURL(t,i));else{var r;i||(i=90);k();try{r=n.toDataURL("image/jpeg",i/100)}catch(u){r=n.toDataURL("image/jpeg")}h=w(r);c&&(h=c.stripHeaders(h),b&&(c.meta&&c.meta.exif&&c.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),h=c.writeHeaders(h)),c.purge(),c=null)}return v=!1,h},destroy:function(){y=null;g.call(this);this.getRuntime().getShim().removeInstance(this.uid)}})}return n.Image=h});i("moxie/runtime/flash/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(n,t,i,u,f){function s(){var n;try{n=navigator.plugins["Shockwave Flash"];n=n.description}catch(t){try{n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){n="0.0"}}return n=n.match(/\d+/g),parseFloat(n[0]+"."+n[1])}function h(n){var r=i.get(n);r&&"OBJECT"==r.nodeName&&("IE"===t.browser?(r.style.display="none",function u(){4==r.readyState?c(n):setTimeout(u,10)}()):r.parentNode.removeChild(r))}function c(n){var t=i.get(n),r;if(t){for(r in t)"function"==typeof t[r]&&(t[r]=null);t.parentNode.removeChild(t)}}function l(c){var a,l=this;c=n.extend({swf_url:t.swf_url},c);f.call(this,c,e,{access_binary:function(n){return n&&"browser"===l.mode},access_image_binary:function(n){return n&&"browser"===l.mode},display_media:f.capTest(r("moxie/image/Image")),do_cors:f.capTrue,drag_and_drop:!1,report_upload_progress:function(){return"client"===l.mode},resize_image:f.capTrue,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!n.arrayDiff(t,["","text","document"])||"browser"===l.mode},return_status_code:function(t){return"browser"===l.mode||!n.arrayDiff(t,[200,404])},select_file:f.capTrue,select_multiple:f.capTrue,send_binary_string:function(n){return n&&"browser"===l.mode},send_browser_cookies:function(n){return n&&"browser"===l.mode},send_custom_headers:function(n){return n&&"browser"===l.mode},send_multipart:f.capTrue,slice_blob:function(n){return n&&"browser"===l.mode},stream_upload:function(n){return n&&"browser"===l.mode},summon_file_dialog:!1,upload_filesize:function(t){return n.parseSizeStr(t)<=2097152||"client"===l.mode},use_http_method:function(t){return!n.arrayDiff(t,["GET","POST"])}},{access_binary:function(n){return n?"browser":"client"},access_image_binary:function(n){return n?"browser":"client"},report_upload_progress:function(n){return n?"browser":"client"},return_response_type:function(t){return n.arrayDiff(t,["","text","json","document"])?"browser":["client","browser"]},return_status_code:function(t){return n.arrayDiff(t,[200,404])?"browser":["client","browser"]},send_binary_string:function(n){return n?"browser":"client"},send_browser_cookies:function(n){return n?"browser":"client"},send_custom_headers:function(n){return n?"browser":"client"},slice_blob:function(n){return n?"browser":"client"},stream_upload:function(n){return n?"client":"browser"},upload_filesize:function(t){return n.parseSizeStr(t)>=2097152?"client":"browser"}},"client");s()<11.3&&(this.mode=!1);n.extend(this,{getShim:function(){return i.get(this.uid)},shimExec:function(n,t){var i=[].slice.call(arguments,2);return l.getShim().exec(this.uid,n,t,i)},init:function(){var i,e,r;r=this.getShimContainer();n.extend(r.style,{position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"});i='<object id="'+this.uid+'" type="application/x-shockwave-flash" data="'+c.swf_url+'" ';"IE"===t.browser&&(i+='classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');i+='width="100%" height="100%" style="outline:0"><param name="movie" value="'+c.swf_url+'" /><param name="flashvars" value="uid='+escape(this.uid)+"&target="+f.getGlobalEventTarget()+'" /><param name="wmode" value="transparent" /><param name="allowscriptaccess" value="always" /><\/object>';"IE"===t.browser?(e=document.createElement("div"),r.appendChild(e),e.outerHTML=i,e=r=null):r.innerHTML=i;a=setTimeout(function(){l&&!l.initialized&&l.trigger("Error",new u.RuntimeError(u.RuntimeError.NOT_INIT_ERR))},5e3)},destroy:function(n){return function(){h(l.uid);n.call(l);clearTimeout(a);c=a=n=l=null}}(this.destroy)},o)}var e="flash",o={};return f.addConstructor(e,l),o});i("moxie/runtime/flash/file/Blob",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(n,t){var i={slice:function(n,i,r,u){var f=this.getRuntime();return 0>i?i=Math.max(n.size+i,0):i>0&&(i=Math.min(i,n.size)),0>r?r=Math.max(n.size+r,0):r>0&&(r=Math.min(r,n.size)),n=f.shimExec.call(this,"Blob","slice",i,r,u||""),n&&(n=new t(f.uid,n)),n}};return n.Blob=i});i("moxie/runtime/flash/file/FileInput",["moxie/runtime/flash/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(n,t,i,r){var u={init:function(n){var u=this,e=this.getRuntime(),f=i.get(n.browse_button);f&&(f.setAttribute("tabindex",-1),f=null);this.bind("Change",function(){var n=e.shimExec.call(u,"FileInput","getFiles");u.files=[];r.each(n,function(n){u.files.push(new t(e.uid,n))})},999);this.getRuntime().shimExec.call(this,"FileInput","init",{accept:n.accept,multiple:n.multiple});this.trigger("ready")}};return n.FileInput=u});i("moxie/runtime/flash/file/FileReader",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(n,t){function i(n,i){switch(i){case"readAsText":return t.atob(n,"utf8");case"readAsBinaryString":return t.atob(n);case"readAsDataURL":return n}return null}var r={read:function(n,t){var r=this;return r.result="","readAsDataURL"===n&&(r.result="data:"+(t.type||"")+";base64,"),r.bind("Progress",function(t,u){u&&(r.result+=i(u,n))},999),r.getRuntime().shimExec.call(this,"FileReader","readAsBase64",t.uid)}};return n.FileReader=r});i("moxie/runtime/flash/file/FileReaderSync",["moxie/runtime/flash/Runtime","moxie/core/utils/Encode"],function(n,t){function i(n,i){switch(i){case"readAsText":return t.atob(n,"utf8");case"readAsBinaryString":return t.atob(n);case"readAsDataURL":return n}return null}var r={read:function(n,t){var r,u=this.getRuntime();return(r=u.shimExec.call(this,"FileReaderSync","readAsBase64",t.uid))?("readAsDataURL"===n&&(r="data:"+(t.type||"")+";base64,"+r),i(r,n,t.type)):null}};return n.FileReaderSync=r});i("moxie/runtime/flash/runtime/Transporter",["moxie/runtime/flash/Runtime","moxie/file/Blob"],function(n,t){var i={getAsBlob:function(n){var i=this.getRuntime(),r=i.shimExec.call(this,"Transporter","getAsBlob",n);return r?new t(i.uid,r):null}};return n.Transporter=i});i("moxie/runtime/flash/xhr/XMLHttpRequest",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/file/File","moxie/file/FileReaderSync","moxie/runtime/flash/file/FileReaderSync","moxie/xhr/FormData","moxie/runtime/Transporter","moxie/runtime/flash/runtime/Transporter"],function(n,t,i,r,u,f,e,o){var s={send:function(n,r){function f(){n.transport=u.mode;u.shimExec.call(s,"XMLHttpRequest","send",n,r)}function l(n,t){u.shimExec.call(s,"XMLHttpRequest","appendBlob",n,t.uid);r=null;f()}function a(n,t){var i=new o;i.bind("TransportingComplete",function(){t(this.result)});i.transport(n.getSource(),n.type,{ruid:u.uid})}var s=this,u=s.getRuntime(),c,h;(t.isEmptyObj(n.headers)||t.each(n.headers,function(n,t){u.shimExec.call(s,"XMLHttpRequest","setRequestHeader",t,n.toString())}),r instanceof e)?(r.each(function(n,t){n instanceof i?c=t:u.shimExec.call(s,"XMLHttpRequest","append",t,n)}),r.hasBlob())?(h=r.getBlob(),h.isDetached()?a(h,function(n){h.destroy();l(c,n)}):l(c,h)):(r=null,f()):r instanceof i?r.isDetached()?a(r,function(n){r.destroy();r=n.uid;f()}):(r=r.uid,f()):f()},getResponse:function(n){var f,i,e=this.getRuntime();if(i=e.shimExec.call(this,"XMLHttpRequest","getResponseAsBlob")){if(i=new r(e.uid,i),"blob"===n)return i;try{if(f=new u,~t.inArray(n,["","text"]))return f.readAsText(i);if("json"===n&&window.JSON)return JSON.parse(f.readAsText(i))}finally{i.destroy()}}return null},abort:function(){var n=this.getRuntime();n.shimExec.call(this,"XMLHttpRequest","abort");this.dispatchEvent("readystatechange");this.dispatchEvent("abort")}};return n.XMLHttpRequest=s});i("moxie/runtime/flash/image/Image",["moxie/runtime/flash/Runtime","moxie/core/utils/Basic","moxie/runtime/Transporter","moxie/file/Blob","moxie/file/FileReaderSync"],function(n,t,i,r,u){var f={loadFromBlob:function(n){function f(n){u.shimExec.call(r,"Image","loadFromBlob",n.uid);r=u=null}var r=this,u=r.getRuntime(),t;n.isDetached()?(t=new i,t.bind("TransportingComplete",function(){f(t.result.getSource())}),t.transport(n.getSource(),n.type,{ruid:u.uid})):f(n.getSource())},loadFromImage:function(n){var t=this.getRuntime();return t.shimExec.call(this,"Image","loadFromImage",n.uid)},getInfo:function(){var t=this.getRuntime(),n=t.shimExec.call(this,"Image","getInfo");return n.meta&&n.meta.thumb&&n.meta.thumb.data&&!(t.meta.thumb.data instanceof r)&&(n.meta.thumb.data=new r(t.uid,n.meta.thumb.data)),n},getAsBlob:function(n,t){var i=this.getRuntime(),u=i.shimExec.call(this,"Image","getAsBlob",n,t);return u?new r(i.uid,u):null},getAsDataURL:function(){var n,i=this.getRuntime(),t=i.Image.getAsBlob.apply(this,arguments);return t?(n=new u,n.readAsDataURL(t)):null}};return n.Image=f});i("moxie/runtime/silverlight/Runtime",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/runtime/Runtime"],function(n,t,i,u,f){function s(n){var r,t,i,u,o,f=!1,s=null,e=0,h;try{try{s=new ActiveXObject("AgControl.AgControl");s.IsVersionSupported(n)&&(f=!0);s=null}catch(c){if(h=navigator.plugins["Silverlight Plug-In"],h){for(r=h.description,"1.0.30226.2"===r&&(r="2.0.30226.2"),t=r.split(".");t.length>3;)t.pop();for(;t.length<4;)t.push(0);for(i=n.split(".");i.length>4;)i.pop();do u=parseInt(i[e],10),o=parseInt(t[e],10),e++;while(e<i.length&&u===o);o>=u&&!isNaN(u)&&(f=!0)}}}catch(l){f=!1}return f}function h(h){var l,c=this;h=n.extend({xap_url:t.xap_url},h);f.call(this,h,e,{access_binary:f.capTrue,access_image_binary:f.capTrue,display_media:f.capTest(r("moxie/image/Image")),do_cors:f.capTrue,drag_and_drop:!1,report_upload_progress:f.capTrue,resize_image:f.capTrue,return_response_headers:function(n){return n&&"client"===c.mode},return_response_type:function(n){return"json"!==n?!0:!!window.JSON},return_status_code:function(t){return"client"===c.mode||!n.arrayDiff(t,[200,404])},select_file:f.capTrue,select_multiple:f.capTrue,send_binary_string:f.capTrue,send_browser_cookies:function(n){return n&&"browser"===c.mode},send_custom_headers:function(n){return n&&"client"===c.mode},send_multipart:f.capTrue,slice_blob:f.capTrue,stream_upload:!0,summon_file_dialog:!1,upload_filesize:f.capTrue,use_http_method:function(t){return"client"===c.mode||!n.arrayDiff(t,["GET","POST"])}},{return_response_headers:function(n){return n?"client":"browser"},return_status_code:function(t){return n.arrayDiff(t,[200,404])?"client":["client","browser"]},send_browser_cookies:function(n){return n?"browser":"client"},send_custom_headers:function(n){return n?"client":"browser"},use_http_method:function(t){return n.arrayDiff(t,["GET","POST"])?"client":["client","browser"]}});s("2.0.31005.0")&&"Opera"!==t.browser||(this.mode=!1);n.extend(this,{getShim:function(){return i.get(this.uid).content.Moxie},shimExec:function(n,t){var i=[].slice.call(arguments,2);return c.getShim().exec(this.uid,n,t,i)},init:function(){var n;n=this.getShimContainer();n.innerHTML='<object id="'+this.uid+'" data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%" style="outline:none;"><param name="source" value="'+h.xap_url+'"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="enablehtmlaccess" value="true"/><param name="initParams" value="uid='+this.uid+",target="+f.getGlobalEventTarget()+'"/><\/object>';l=setTimeout(function(){c&&!c.initialized&&c.trigger("Error",new u.RuntimeError(u.RuntimeError.NOT_INIT_ERR))},"Windows"!==t.OS?1e4:5e3)},destroy:function(n){return function(){n.call(c);clearTimeout(l);h=l=n=c=null}}(this.destroy)},o)}var e="silverlight",o={};return f.addConstructor(e,h),o});i("moxie/runtime/silverlight/file/Blob",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/Blob"],function(n,t,i){return n.Blob=t.extend({},i)});i("moxie/runtime/silverlight/file/FileInput",["moxie/runtime/silverlight/Runtime","moxie/file/File","moxie/core/utils/Dom","moxie/core/utils/Basic"],function(n,t,i,r){function u(n){for(var i="",t=0;t<n.length;t++)i+=(""!==i?"|":"")+n[t].title+" | *."+n[t].extensions.replace(/,/g,";*.");return i}var f={init:function(n){var f=this,e=this.getRuntime(),o=i.get(n.browse_button);o&&(o.setAttribute("tabindex",-1),o=null);this.bind("Change",function(){var n=e.shimExec.call(f,"FileInput","getFiles");f.files=[];r.each(n,function(n){f.files.push(new t(e.uid,n))})},999);e.shimExec.call(this,"FileInput","init",u(n.accept),n.multiple);this.trigger("ready")},setOption:function(n,t){"accept"==n&&(t=u(t));this.getRuntime().shimExec.call(this,"FileInput","setOption",n,t)}};return n.FileInput=f});i("moxie/runtime/silverlight/file/FileDrop",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Dom","moxie/core/utils/Events"],function(n,t,i){var r={init:function(){var n,r=this,u=r.getRuntime();return n=u.getShimContainer(),i.addEvent(n,"dragover",function(n){n.preventDefault();n.stopPropagation();n.dataTransfer.dropEffect="copy"},r.uid),i.addEvent(n,"dragenter",function(n){n.preventDefault();var i=t.get(u.uid).dragEnter(n);i&&n.stopPropagation()},r.uid),i.addEvent(n,"drop",function(n){n.preventDefault();var i=t.get(u.uid).dragDrop(n);i&&n.stopPropagation()},r.uid),u.shimExec.call(this,"FileDrop","init")}};return n.FileDrop=r});i("moxie/runtime/silverlight/file/FileReader",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReader"],function(n,t,i){return n.FileReader=t.extend({},i)});i("moxie/runtime/silverlight/file/FileReaderSync",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/file/FileReaderSync"],function(n,t,i){return n.FileReaderSync=t.extend({},i)});i("moxie/runtime/silverlight/runtime/Transporter",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/runtime/Transporter"],function(n,t,i){return n.Transporter=t.extend({},i)});i("moxie/runtime/silverlight/xhr/XMLHttpRequest",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/runtime/flash/xhr/XMLHttpRequest","moxie/runtime/silverlight/file/FileReaderSync","moxie/runtime/silverlight/runtime/Transporter"],function(n,t,i){return n.XMLHttpRequest=t.extend({},i)});i("moxie/runtime/silverlight/image/Image",["moxie/runtime/silverlight/Runtime","moxie/core/utils/Basic","moxie/file/Blob","moxie/runtime/flash/image/Image"],function(n,t,i,r){return n.Image=t.extend({},r,{getInfo:function(){var u=this.getRuntime(),n={meta:{}},r=u.shimExec.call(this,"Image","getInfo");return r.meta&&(t.each(["tiff","exif","gps","thumb"],function(t){var e,f,o,i,u=r.meta[t];if(u&&u.keys)for(n.meta[t]={},f=0,o=u.keys.length;o>f;f++)e=u.keys[f],i=u[e],i&&(/^(\d|[1-9]\d+)$/.test(i)?i=parseInt(i,10):/^\d*\.\d+$/.test(i)&&(i=parseFloat(i)),n.meta[t][e]=i)}),n.meta&&n.meta.thumb&&n.meta.thumb.data&&!(u.meta.thumb.data instanceof i)&&(n.meta.thumb.data=new i(u.uid,n.meta.thumb.data))),n.width=parseInt(r.width,10),n.height=parseInt(r.height,10),n.size=parseInt(r.size,10),n.type=r.type,n.name=r.name,n},resize:function(n,t,i){this.getRuntime().shimExec.call(this,"Image","resize",n.x,n.y,n.width,n.height,t,i.preserveHeaders,i.resample)}})});i("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(n,t,i,u){function o(t){var o=this,s=i.capTest,h=i.capTrue;i.call(this,t,e,{access_binary:s(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:s((u.can("create_canvas")||u.can("use_data_uri_over32kb"))&&r("moxie/image/Image")),do_cors:!1,drag_and_drop:!1,filter_by_extension:s(function(){return!("Chrome"===u.browser&&u.verComp(u.version,28,"<")||"IE"===u.browser&&u.verComp(u.version,10,"<")||"Safari"===u.browser&&u.verComp(u.version,7,"<")||"Firefox"===u.browser&&u.verComp(u.version,37,"<"))}()),resize_image:function(){return f.Image&&o.can("access_binary")&&u.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(t){return"json"===t&&window.JSON?!0:!!~n.inArray(t,["text","document",""])},return_status_code:function(t){return!n.arrayDiff(t,[200,404])},select_file:function(){return u.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return o.can("select_file")},summon_file_dialog:function(){return o.can("select_file")&&!("Firefox"===u.browser&&u.verComp(u.version,4,"<")||"Opera"===u.browser&&u.verComp(u.version,12,"<")||"IE"===u.browser&&u.verComp(u.version,10,"<"))},upload_filesize:h,use_http_method:function(t){return!n.arrayDiff(t,["GET","POST"])}});n.extend(this,{init:function(){this.trigger("Init")},destroy:function(n){return function(){n.call(o);n=o=null}}(this.destroy)});n.extend(this.getShim(),f)}var e="html4",f={};return i.addConstructor(e,o),f});i("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(n,t,i,r,u,f,e){function o(){function c(){var w,v,a,h,f,y,l=this,p=l.getRuntime();y=i.guid("uid_");w=p.getShimContainer();o&&(a=r.get(o+"_form"),a&&(i.extend(a.style,{top:"100%"}),a.firstChild.setAttribute("tabindex",-1)));h=document.createElement("form");h.setAttribute("id",y+"_form");h.setAttribute("method","post");h.setAttribute("enctype","multipart/form-data");h.setAttribute("encoding","multipart/form-data");i.extend(h.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"});f=document.createElement("input");f.setAttribute("id",y);f.setAttribute("type","file");f.setAttribute("accept",s.join(","));p.can("summon_file_dialog")&&f.setAttribute("tabindex",-1);i.extend(f.style,{fontSize:"999px",opacity:0});h.appendChild(f);w.appendChild(h);i.extend(f.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"});"IE"===e.browser&&e.verComp(e.version,10,"<")&&i.extend(f.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"});f.onchange=function(){var n;this.value&&(n=this.files?this.files[0]:{name:this.value},n=new t(p.uid,n),this.onchange=function(){},c.call(l),l.files=[n],f.setAttribute("id",n.uid),h.setAttribute("id",n.uid+"_form"),l.trigger("change"),f=h=null)};p.can("summon_file_dialog")&&(v=r.get(n.browse_button),u.removeEvent(v,"click",l.uid),u.addEvent(v,"click",function(n){f&&!f.disabled&&f.click();n.preventDefault()},l.uid));o=y;w=a=v=null}var o,n,h,s=[];i.extend(this,{init:function(t){var o,i=this,e=i.getRuntime();n=t;s=f.extList2mimes(t.accept,e.can("filter_by_extension"));o=e.getShimContainer(),function(){var f,c,s;f=r.get(t.browse_button);h=r.getStyle(f,"z-index")||"auto";e.can("summon_file_dialog")?("static"===r.getStyle(f,"position")&&(f.style.position="relative"),i.bind("Refresh",function(){c=parseInt(h,10)||1;r.get(n.browse_button).style.zIndex=c;this.getRuntime().getShimContainer().style.zIndex=c-1})):f.setAttribute("tabindex",-1);s=e.can("summon_file_dialog")?f:o;u.addEvent(s,"mouseover",function(){i.trigger("mouseenter")},i.uid);u.addEvent(s,"mouseout",function(){i.trigger("mouseleave")},i.uid);u.addEvent(s,"mousedown",function(){i.trigger("mousedown")},i.uid);u.addEvent(r.get(t.container),"mouseup",function(){i.trigger("mouseup")},i.uid);f=null}();c.call(this);o=null;i.trigger({type:"ready",async:!0})},setOption:function(n,t){var i,u=this.getRuntime();"accept"==n&&(s=t.mimes||f.extList2mimes(t,u.can("filter_by_extension")));i=r.get(o);i&&i.setAttribute("accept",s.join(","))},disable:function(n){var t;(t=r.get(o))&&(t.disabled=!!n)},destroy:function(){var e=this.getRuntime(),c=e.getShim(),t=e.getShimContainer(),f=n&&r.get(n.container),i=n&&r.get(n.browse_button);f&&u.removeAllEvents(f,this.uid);i&&(u.removeAllEvents(i,this.uid),i.style.zIndex=h);t&&(u.removeAllEvents(t,this.uid),t.innerHTML="");c.removeInstance(this.uid);o=s=n=t=f=i=c=null}})}return n.FileInput=o});i("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(n,t){return n.FileReader=t});i("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(n,t,i,r,u,f,e,o){function s(){function c(t){var o,u,r,e,s=this,h=!1;if(n){if(o=n.id.replace(/_iframe$/,""),u=i.get(o+"_form")){for(r=u.getElementsByTagName("input"),e=r.length;e--;)switch(r[e].getAttribute("type")){case"hidden":r[e].parentNode.removeChild(r[e]);break;case"file":h=!0}r=[];h||u.parentNode.removeChild(u);u=null}setTimeout(function(){f.removeEvent(n,"load",s.uid);n.parentNode&&n.parentNode.removeChild(n);var i=s.getRuntime().getShimContainer();i.children.length||i.parentNode.removeChild(i);i=n=null;t()},1)}}var h,s,n;t.extend(this,{send:function(l,a){function d(){var u=k.getShimContainer()||document.body,i=document.createElement("div");i.innerHTML='<iframe id="'+p+'_iframe" name="'+p+'_iframe" src="javascript:&quot;&quot;" style="display:none"><\/iframe>';n=i.firstChild;u.appendChild(n);f.addEvent(n,"load",function(){var i;try{i=n.contentWindow.document||n.contentDocument||window.frames[n.id].document;/^4(0[0-9]|1[0-7]|2[2346])\s/.test(i.title)?h=i.title.replace(/^(\d+).*$/,"$1"):(h=200,s=t.trim(i.body.innerHTML),y.trigger({type:"progress",loaded:s.length,total:s.length}),b&&y.trigger({type:"uploadprogress",loaded:b.size||1025,total:b.size||1025}))}catch(u){if(!r.hasSameOrigin(l.url))return c.call(y,function(){y.trigger("error")}),void 0;h=404}c.call(y,function(){y.trigger("load")})},y.uid)}var p,v,w,b,y=this,k=y.getRuntime();if(h=s=null,a instanceof o&&a.hasBlob()){if(b=a.getBlob(),p=b.uid,w=i.get(p),v=i.get(p+"_form"),!v)throw new u.DOMException(u.DOMException.NOT_FOUND_ERR);}else p=t.guid("uid_"),v=document.createElement("form"),v.setAttribute("id",p+"_form"),v.setAttribute("method",l.method),v.setAttribute("enctype","multipart/form-data"),v.setAttribute("encoding","multipart/form-data"),k.getShimContainer().appendChild(v);v.setAttribute("target",p+"_iframe");a instanceof o&&a.each(function(n,i){if(n instanceof e)w&&w.setAttribute("name",i);else{var r=document.createElement("input");t.extend(r,{type:"hidden",name:i,value:n});w?v.insertBefore(r,w):v.appendChild(r)}});v.setAttribute("action",l.url);d();v.submit();y.trigger("loadstart")},getStatus:function(){return h},getResponse:function(n){if("json"===n&&"string"===t.typeOf(s)&&window.JSON)try{return JSON.parse(s.replace(/^\s*<pre[^>]*>/,"").replace(/<\/pre>\s*$/,""))}catch(i){return null}return s},abort:function(){var t=this;n&&n.contentWindow&&(n.contentWindow.stop?n.contentWindow.stop():n.contentWindow.document.execCommand?n.contentWindow.document.execCommand("Stop"):n.src="about:blank");c.call(this,function(){t.dispatchEvent("abort")})},destroy:function(){this.getRuntime().getShim().removeInstance(this.uid)}})}return n.XMLHttpRequest=s});i("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(n,t){return n.Image=t});o(["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Dom","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/core/I18n","moxie/core/utils/Mime","moxie/file/FileInput","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/image/Image","moxie/core/utils/Events","moxie/runtime/html5/image/ResizerCanvas"])}(this)});!function(n,t){var i=function(){var n={};return t.apply(n,arguments),n.plupload};"function"==typeof define&&define.amd?define("plupload",["./moxie"],i):"object"==typeof module&&module.exports?module.exports=i(require("./moxie")):n.plupload=i(n.moxie)}(this||window,function(n){!function(n,t,i){function s(n){function u(n,i,r){var u={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};u[n]?t[u[n]]=i:r||(t[n]=i)}var i=n.required_features,t={};return"string"==typeof i?r.each(i.split(/\s*,\s*/),function(n){u(n,!0)}):"object"==typeof i?r.each(i,function(n,t){u(t,n)}):i===!0&&(n.chunk_size&&n.chunk_size>0&&(t.slice_blob=!0),r.isEmptyObj(n.resize)&&n.multipart!==!1||(t.send_binary_string=!0),n.http_method&&(t.use_http_method=n.http_method),r.each(n,function(n,t){u(t,!!n,!0)})),t}var e=window.setTimeout,o={},u=t.core.utils,f=t.runtime.Runtime,r={VERSION:"2.3.6",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,moxie:t,mimeTypes:u.Mime.mimes,ua:u.Env,typeOf:u.Basic.typeOf,extend:u.Basic.extend,guid:u.Basic.guid,getAll:function(n){var t,i=[],u;for("array"!==r.typeOf(n)&&(n=[n]),u=n.length;u--;)t=r.get(n[u]),t&&i.push(t);return i.length?i:null},get:u.Dom.get,each:u.Basic.each,getPos:u.Dom.getPos,getSize:u.Dom.getSize,xmlEncode:function(n){var t={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"};return n?(""+n).replace(/[<>&\"\']/g,function(n){return t[n]?"&"+t[n]+";":n}):n},toArray:u.Basic.toArray,inArray:u.Basic.inArray,inSeries:u.Basic.inSeries,addI18n:t.core.I18n.addI18n,translate:t.core.I18n.translate,sprintf:u.Basic.sprintf,isEmptyObj:u.Basic.isEmptyObj,hasClass:u.Dom.hasClass,addClass:u.Dom.addClass,removeClass:u.Dom.removeClass,getStyle:u.Dom.getStyle,addEvent:u.Events.addEvent,removeEvent:u.Events.removeEvent,removeAllEvents:u.Events.removeAllEvents,cleanName:function(n){for(var i=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],t=0;t<i.length;t+=2)n=n.replace(i[t],i[t+1]);return n=n.replace(/\s+/g,"_"),n=n.replace(/[^a-z0-9_\-\.]+/gi,"")},buildUrl:function(n,t){var i="";return r.each(t,function(n,t){i+=(i?"&":"")+encodeURIComponent(t)+"="+encodeURIComponent(n)}),i&&(n+=(n.indexOf("?")>0?"&":"?")+i),n},formatSize:function(n){function u(n,t){return Math.round(n*Math.pow(10,t))/Math.pow(10,t)}if(n===i||/\D/.test(n))return r.translate("N/A");var t=Math.pow(1024,4);return n>t?u(n/t,1)+" "+r.translate("tb"):n>(t/=1024)?u(n/t,1)+" "+r.translate("gb"):n>(t/=1024)?u(n/t,1)+" "+r.translate("mb"):n>1024?Math.round(n/1024)+" "+r.translate("kb"):n+" "+r.translate("b")},parseSize:u.Basic.parseSizeStr,predictRuntime:function(n,t){var i,u;return i=new r.Uploader(n),u=f.thatCan(i.getOption().required_features,t||n.runtimes),i.destroy(),u},addFileFilter:function(n,t){o[n]=t}};r.addFileFilter("mime_types",function(n,t,i){n.length&&!n.regexp.test(t.name)?(this.trigger("Error",{code:r.FILE_EXTENSION_ERROR,message:r.translate("File extension error."),file:t}),i(!1)):i(!0)});r.addFileFilter("max_file_size",function(n,t,i){var u;n=r.parseSize(n);t.size!==u&&n&&t.size>n?(this.trigger("Error",{code:r.FILE_SIZE_ERROR,message:r.translate("File size error."),file:t}),i(!1)):i(!0)});r.addFileFilter("prevent_duplicates",function(n,t,i){if(n)for(var u=this.files.length;u--;)if(t.name===this.files[u].name&&t.size===this.files[u].size)return this.trigger("Error",{code:r.FILE_DUPLICATE_ERROR,message:r.translate("Duplicate file error."),file:t}),i(!1),void 0;i(!0)});r.addFileFilter("prevent_empty",function(n,t,u){n&&!t.size&&t.size!==i?(this.trigger("Error",{code:r.FILE_SIZE_ERROR,message:r.translate("File size error."),file:t}),u(!1)):u(!0)});r.Uploader=function(n){function k(){var n,t,i=0;if(this.state==r.STARTED){for(t=0;t<c.length;t++)n||c[t].status!=r.QUEUED?i++:(n=c[t],this.trigger("BeforeUpload",n)&&(n.status=r.UPLOADING,this.trigger("UploadFile",n)));i==c.length&&(this.state!==r.STOPPED&&(this.state=r.STOPPED,this.trigger("StateChanged")),this.trigger("UploadComplete",c))}}function g(n){n.percent=n.size>0?Math.ceil(100*(n.loaded/n.size)):100;p()}function p(){var t,n,u,f=0;for(l.reset(),t=0;t<c.length;t++)n=c[t],n.size!==i?(l.size+=n.origSize,u=n.loaded*n.origSize/n.size,(!n.completeTimestamp||n.completeTimestamp>w)&&(f+=u),l.loaded+=u):l.size=i,n.status==r.DONE?l.uploaded++:n.status==r.FAILED?l.failed++:l.queued++;l.size===i?l.percent=c.length>0?Math.ceil(100*(l.uploaded/c.length)):0:(l.bytesPerSec=Math.ceil(f/((+new Date-w||1)/1e3)),l.percent=l.size>0?Math.ceil(100*(l.loaded/l.size)):0)}function d(){var n=a[0]||v[0];return n?n.getRuntime().uid:!1}function rt(){this.bind("FilesAdded FilesRemoved",function(n){n.trigger("QueueChanged");n.refresh()});this.bind("CancelUpload",ht);this.bind("BeforeUpload",ft);this.bind("UploadFile",et);this.bind("UploadProgress",ot);this.bind("StateChanged",st);this.bind("QueueChanged",p);this.bind("Error",lt);this.bind("FileUploaded",ct);this.bind("Destroy",at)}function nt(n,i){var u=this,e=0,o=[],s={runtime_order:n.runtimes,required_caps:n.required_features,preferred_caps:b,swf_url:n.flash_swf_url,xap_url:n.silverlight_xap_url};r.each(n.runtimes.split(/\s*,\s*/),function(t){n[t]&&(s[t]=n[t])});n.browse_button&&r.each(n.browse_button,function(i){o.push(function(o){var h=new t.file.FileInput(r.extend({},s,{accept:n.filters.mime_types,name:n.file_data_name,multiple:n.multi_selection,container:n.container,browse_button:i}));h.onready=function(){var n=f.getInfo(this.ruid);r.extend(u.features,{chunks:n.can("slice_blob"),multipart:n.can("send_multipart"),multi_selection:n.can("select_multiple")});e++;a.push(this);o()};h.onchange=function(){u.addFile(this.files)};h.bind("mouseenter mouseleave mousedown mouseup",function(t){y||(n.browse_button_hover&&("mouseenter"===t.type?r.addClass(i,n.browse_button_hover):"mouseleave"===t.type&&r.removeClass(i,n.browse_button_hover)),n.browse_button_active&&("mousedown"===t.type?r.addClass(i,n.browse_button_active):"mouseup"===t.type&&r.removeClass(i,n.browse_button_active)))});h.bind("mousedown",function(){u.trigger("Browse")});h.bind("error runtimeerror",function(){h=null;o()});h.init()})});n.drop_element&&r.each(n.drop_element,function(n){o.push(function(i){var o=new t.file.FileDrop(r.extend({},s,{drop_zone:n}));o.onready=function(){var n=f.getInfo(this.ruid);r.extend(u.features,{chunks:n.can("slice_blob"),multipart:n.can("send_multipart"),dragdrop:n.can("drag_and_drop")});e++;v.push(this);i()};o.ondrop=function(){u.addFile(this.files)};o.bind("error runtimeerror",function(){o=null;i()});o.init()})});r.inSeries(o,function(){"function"==typeof i&&i(e)})}function ut(n,r,u,f){var e=new t.image.Image;try{e.onload=function(){r.width>this.width&&r.height>this.height&&r.quality===i&&r.preserve_headers&&!r.crop?(this.destroy(),f(n)):e.downsize(r.width,r.height,r.crop,r.preserve_headers)};e.onresize=function(){var t=this.getAsBlob(n.type,r.quality);this.destroy();f(t)};e.bind("error runtimeerror",function(){this.destroy();f(n)});e.load(n,u)}catch(o){f(n)}}function tt(n,i,e){function h(n,i,f){var e=u[n];switch(n){case"max_file_size":"max_file_size"===n&&(u.max_file_size=u.filters.max_file_size=i);break;case"chunk_size":(i=r.parseSize(i))&&(u[n]=i,u.send_file_name=!0);break;case"multipart":u[n]=i;i||(u.send_file_name=!0);break;case"http_method":u[n]="PUT"===i.toUpperCase()?"PUT":"POST";break;case"unique_names":u[n]=i;i&&(u.send_file_name=!0);break;case"filters":"array"===r.typeOf(i)&&(i={mime_types:i});f?r.extend(u.filters,i):u.filters=i;i.mime_types&&("string"===r.typeOf(i.mime_types)&&(i.mime_types=t.core.utils.Mime.mimes2extList(i.mime_types)),i.mime_types.regexp=function(n){var t=[];return r.each(n,function(n){r.each(n.extensions.split(/,/),function(n){/^\s*\*\s*$/.test(n)?t.push("\\.*"):t.push("\\."+n.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+t.join("|")+")$","i")}(i.mime_types),u.filters.mime_types=i.mime_types);break;case"resize":u.resize=i?r.extend({preserve_headers:!0,crop:!1},i):!1;break;case"prevent_duplicates":u.prevent_duplicates=u.filters.prevent_duplicates=!!i;break;case"container":case"browse_button":case"drop_element":i="container"===n?r.get(i):r.getAll(i);case"runtimes":case"multi_selection":case"flash_swf_url":case"silverlight_xap_url":u[n]=i;f||(c=!0);break;default:u[n]=i}f||o.trigger("OptionChanged",n,i,e)}var o=this,c=!1;"object"==typeof n?r.each(n,function(n,t){h(t,n,e)}):h(n,i,e);e?(u.required_features=s(r.extend({},u)),b=s(r.extend({},u,{required_features:!0}))):c&&(o.trigger("Destroy"),nt.call(o,u,function(n){n?(o.runtime=f.getInfo(d()).type,o.trigger("Init",{runtime:o.runtime}),o.trigger("PostInit")):o.trigger("Error",{code:r.INIT_ERROR,message:r.translate("Init error.")})}))}function ft(n,t){if(n.settings.unique_names){var i=t.name.match(/\.([^.]+)$/),r="part";i&&(r=i[1]);t.target_name=t.id+"."+r}}function et(n,i){function v(){y-->0?e(s,1e3):(i.loaded=f,n.trigger("Error",{code:r.HTTP_ERROR,message:r.translate("HTTP Error."),file:i,response:h.responseText,status:h.status,responseHeaders:h.getAllResponseHeaders()}))}function s(){var e,s,t={};i.status===r.UPLOADING&&n.state!==r.STOPPED&&(n.settings.send_file_name&&(t.name=i.target_name||i.name),o&&l.chunks&&u.size>o?(s=Math.min(o,u.size-f),e=u.slice(f,f+s)):(s=u.size,e=u),o&&l.chunks&&(n.settings.send_chunk_number?(t.chunk=Math.ceil(f/o),t.chunks=Math.ceil(u.size/o)):(t.offset=f,t.total=u.size)),n.trigger("BeforeChunkUpload",i,t,e,f)&&p(t,e,s))}function p(o,p,w){var b;h=new t.xhr.XMLHttpRequest;h.upload&&(h.upload.onprogress=function(t){i.loaded=Math.min(i.size,f+t.loaded);n.trigger("UploadProgress",i)});h.onload=function(){return h.status<200||h.status>=400?(v(),void 0):(y=n.settings.max_retries,w<u.size?(p.destroy(),f+=w,i.loaded=Math.min(f,u.size),n.trigger("ChunkUploaded",i,{offset:i.loaded,total:u.size,response:h.responseText,status:h.status,responseHeaders:h.getAllResponseHeaders()}),"Android Browser"===r.ua.browser&&n.trigger("UploadProgress",i)):i.loaded=i.size,p=b=null,!f||f>=u.size?(i.size!=i.origSize&&(u.destroy(),u=null),n.trigger("UploadProgress",i),i.status=r.DONE,i.completeTimestamp=+new Date,n.trigger("FileUploaded",i,{response:h.responseText,status:h.status,responseHeaders:h.getAllResponseHeaders()})):e(s,1),void 0)};h.onerror=function(){v()};h.onloadend=function(){this.destroy()};n.settings.multipart&&l.multipart?(h.open(n.settings.http_method,c,!0),r.each(n.settings.headers,function(n,t){h.setRequestHeader(t,n)}),b=new t.xhr.FormData,r.each(r.extend(o,n.settings.multipart_params),function(n,t){b.append(t,n)}),b.append(n.settings.file_data_name,p),h.send(b,a)):(c=r.buildUrl(n.settings.url,r.extend(o,n.settings.multipart_params)),h.open(n.settings.http_method,c,!0),r.each(n.settings.headers,function(n,t){h.setRequestHeader(t,n)}),h.hasRequestHeader("Content-Type")||h.setRequestHeader("Content-Type","application/octet-stream"),h.send(p,a))}var u,c=n.settings.url,o=n.settings.chunk_size,y=n.settings.max_retries,l=n.features,f=0,a={runtime_order:n.settings.runtimes,required_caps:n.settings.required_features,preferred_caps:b,swf_url:n.settings.flash_swf_url,xap_url:n.settings.silverlight_xap_url};i.loaded&&(f=i.loaded=o?o*Math.floor(i.loaded/o):0);u=i.getSource();r.isEmptyObj(n.settings.resize)||-1===r.inArray(u.type,["image/jpeg","image/png"])?s():ut(u,n.settings.resize,a,function(n){u=n;i.size=n.size;s()})}function ot(n,t){g(t)}function st(n){if(n.state==r.STARTED)w=+new Date;else if(n.state==r.STOPPED)for(var t=n.files.length-1;t>=0;t--)n.files[t].status==r.UPLOADING&&(n.files[t].status=r.QUEUED,p())}function ht(){h&&h.abort()}function ct(n){p();e(function(){k.call(n)},1)}function lt(n,t){t.code===r.INIT_ERROR?n.destroy():t.code===r.HTTP_ERROR&&(t.file.status=r.FAILED,t.file.completeTimestamp=+new Date,g(t.file),n.state==r.STARTED&&(n.trigger("CancelUpload"),e(function(){k.call(n)},1)))}function at(n){n.stop();r.each(c,function(n){n.destroy()});c=[];a.length&&(r.each(a,function(n){n.destroy()}),a=[]);v.length&&(r.each(v,function(n){n.destroy()}),v=[]);b={};y=!1;w=h=null;l.reset()}var u,w,l,h,it=r.guid(),c=[],b={},a=[],v=[],y=!1;u={chunk_size:0,file_data_name:"file",filters:{mime_types:[],max_file_size:0,prevent_duplicates:!1,prevent_empty:!0},flash_swf_url:"js/Moxie.swf",http_method:"POST",max_retries:0,multipart:!0,multi_selection:!0,resize:!1,runtimes:f.order,send_file_name:!0,send_chunk_number:!0,silverlight_xap_url:"js/Moxie.xap"};tt.call(this,n,null,!0);l=new r.QueueProgress;r.extend(this,{id:it,uid:it,state:r.STOPPED,features:{},runtime:null,files:c,settings:u,total:l,init:function(){var t,i,n=this;return t=n.getOption("preinit"),"function"==typeof t?t(n):r.each(t,function(t,i){n.bind(i,t)}),rt.call(n),r.each(["container","browse_button","drop_element"],function(t){if(null===n.getOption(t))return(i={code:r.INIT_ERROR,message:r.sprintf(r.translate("%s specified, but cannot be found."),t)},!1)}),i?n.trigger("Error",i):u.browse_button||u.drop_element?(nt.call(n,u,function(t){var i=n.getOption("init");"function"==typeof i?i(n):r.each(i,function(t,i){n.bind(i,t)});t?(n.runtime=f.getInfo(d()).type,n.trigger("Init",{runtime:n.runtime}),n.trigger("PostInit")):n.trigger("Error",{code:r.INIT_ERROR,message:r.translate("Init error.")})}),void 0):n.trigger("Error",{code:r.INIT_ERROR,message:r.translate("You must specify either browse_button or drop_element.")})},setOption:function(n,t){tt.call(this,n,t,!this.runtime)},getOption:function(n){return n?u[n]:u},refresh:function(){a.length&&r.each(a,function(n){n.trigger("Refresh")});this.trigger("Refresh")},start:function(){this.state!=r.STARTED&&(this.state=r.STARTED,this.trigger("StateChanged"),k.call(this))},stop:function(){this.state!=r.STOPPED&&(this.state=r.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){y=arguments[0]!==i?arguments[0]:!0;a.length&&r.each(a,function(n){n.disable(y)});this.trigger("DisableBrowse",y)},getFile:function(n){for(var t=c.length-1;t>=0;t--)if(c[t].id===n)return c[t]},addFile:function(n,i){function a(n,t){var i=[];r.each(s.settings.filters,function(t,r){o[r]&&i.push(function(i){o[r].call(s,t,n,function(n){i(!n)})})});r.inSeries(i,t)}function u(n){var o=r.typeOf(n);if(n instanceof t.file.File){if(!n.ruid&&!n.isDetached()){if(!f)return!1;n.ruid=f;n.connectRuntime(f)}u(new r.File(n))}else n instanceof t.file.Blob?(u(n.getSource()),n.destroy()):n instanceof r.File?(i&&(n.name=i),h.push(function(t){a(n,function(i){i||(c.push(n),l.push(n),s.trigger("FileFiltered",n));e(t,1)})})):-1!==r.inArray(o,["file","blob"])?u(new t.file.File(null,n)):"node"===o&&"filelist"===r.typeOf(n.files)?r.each(n.files,u):"array"===o&&(i=null,r.each(n,u))}var f,s=this,h=[],l=[];f=d();u(n);h.length&&r.inSeries(h,function(){l.length&&s.trigger("FilesAdded",l)})},removeFile:function(n){for(var i="string"==typeof n?n:n.id,t=c.length-1;t>=0;t--)if(c[t].id===i)return this.splice(t,1)[0]},splice:function(n,t){var u=c.splice(n===i?0:n,t===i?c.length:t),f=!1;return this.state==r.STARTED&&(r.each(u,function(n){if(n.status===r.UPLOADING)return(f=!0,!1)}),f&&this.stop()),this.trigger("FilesRemoved",u),r.each(u,function(n){n.destroy()}),f&&this.start(),u},dispatchEvent:function(n){var t,r,i;if(n=n.toLowerCase(),t=this.hasEventListener(n))for(t.sort(function(n,t){return t.priority-n.priority}),r=[].slice.call(arguments),r.shift(),r.unshift(this),i=0;i<t.length;i++)if(t[i].fn.apply(t[i].scope,r)===!1)return!1;return!0},bind:function(n,t,i,u){r.Uploader.prototype.bind.call(this,n,t,u,i)},destroy:function(){this.trigger("Destroy");u=l=null;this.unbindAll()}})};r.Uploader.prototype=t.core.EventTarget.instance;r.File=function(){function t(t){r.extend(this,{id:r.guid(),name:t.name||t.fileName,type:t.type||"",relativePath:t.relativePath||"",size:t.fileSize||t.size,origSize:t.fileSize||t.size,loaded:0,percent:0,status:r.QUEUED,lastModifiedDate:t.lastModifiedDate||(new Date).toLocaleString(),completeTimestamp:0,getNative:function(){var n=this.getSource().getSource();return-1!==r.inArray(r.typeOf(n),["blob","file"])?n:null},getSource:function(){return n[this.id]?n[this.id]:null},destroy:function(){var t=this.getSource();t&&(t.destroy(),delete n[this.id])}});n[this.id]=t}var n={};return t}();r.QueueProgress=function(){var n=this;n.size=0;n.loaded=0;n.uploaded=0;n.failed=0;n.queued=0;n.percent=0;n.bytesPerSec=0;n.reset=function(){n.size=n.loaded=n.uploaded=n.failed=n.queued=n.percent=n.bytesPerSec=0}};n.plupload=r}(this,n)});!function(n,t){function i(n){return t.translate(n)||n}function u(t,r){r.contents().each(function(t,i){i=n(i);i.is(".plupload")||i.remove()});r.prepend('<div class="plupload_wrapper plupload_scroll"><div id="'+t+'_container" class="plupload_container"><div class="plupload"><div class="plupload_header"><div class="plupload_header_content"><div class="plupload_header_title">'+i("Select files")+'<\/div><div class="plupload_header_text">'+i("Add files to the upload queue and click the start button.")+'<\/div><\/div><\/div><div class="plupload_content"><div class="plupload_filelist_header"><div class="plupload_file_name">'+i("Filename")+'<\/div><div class="plupload_file_action">&nbsp;<\/div><div class="plupload_file_status"><span>'+i("Status")+'<\/span><\/div><div class="plupload_file_size">'+i("Size")+'<\/div><div class="plupload_clearer">&nbsp;<\/div><\/div><ul id="'+t+'_filelist" class="plupload_filelist"><\/ul><div class="plupload_filelist_footer"><div class="plupload_file_name"><div class="plupload_buttons"><a href="#" class="plupload_button plupload_add" id="'+t+'_browse">'+i("Add Files")+'<\/a><a href="#" class="plupload_button plupload_start">'+i("Start Upload")+'<\/a><\/div><span class="plupload_upload_status"><\/span><\/div><div class="plupload_file_action"><\/div><div class="plupload_file_status"><span class="plupload_total_status">0%<\/span><\/div><div class="plupload_file_size"><span class="plupload_total_file_size">0 b<\/span><\/div><div class="plupload_progress"><div class="plupload_progress_container"><div class="plupload_progress_bar"><\/div><\/div><\/div><div class="plupload_clearer">&nbsp;<\/div><\/div><\/div><\/div><\/div><input type="hidden" id="'+t+'_count" name="'+t+'_count" value="0" /><\/div>')}var r={};n.fn.pluploadQueue=function(f){return f?(this.each(function(){function h(i){var r,u;i.status==t.DONE&&(r="plupload_done");i.status==t.FAILED&&(r="plupload_failed");i.status==t.QUEUED&&(r="plupload_delete");i.status==t.UPLOADING&&(r="plupload_uploading");u=n("#"+i.id).attr("class",r).find("a").css("display","block");i.hint&&u.attr("title",i.hint)}function a(){n("span.plupload_total_status",o).html(e.total.percent+"%");n("div.plupload_progress_bar",o).css("width",e.total.percent+"%");n("span.plupload_upload_status",o).html(t.sprintf(i("Uploaded %d/%d files"),e.total.uploaded,e.files.length))}function c(){var r,f=n("ul.plupload_filelist",o).html(""),u=0;n.each(e.files,function(i,o){r="";o.status==t.DONE&&(o.target_name&&(r+='<input type="hidden" name="'+s+"_"+u+'_tmpname" value="'+t.xmlEncode(o.target_name)+'" />'),r+='<input type="hidden" name="'+s+"_"+u+'_name" value="'+t.xmlEncode(o.name)+'" />',r+='<input type="hidden" name="'+s+"_"+u+'_status" value="'+(o.status==t.DONE?"done":"failed")+'" />',u++,n("#"+s+"_count").val(u));f.append('<li id="'+o.id+'"><div class="plupload_file_name"><span>'+o.name+'<\/span><\/div><div class="plupload_file_action"><a href="#"><\/a><\/div><div class="plupload_file_status">'+o.percent+'%<\/div><div class="plupload_file_size">'+t.formatSize(o.size)+'<\/div><div class="plupload_clearer">&nbsp;<\/div>'+r+"<\/li>");h(o);n("#"+o.id+".plupload_delete a").click(function(t){n("#"+o.id).remove();e.removeFile(o);t.preventDefault()})});n("span.plupload_total_file_size",o).html(t.formatSize(e.total.size));0===e.total.queued?n("span.plupload_add_text",o).html(i("Add Files")):n("span.plupload_add_text",o).html(t.sprintf(i("%d files queued"),e.total.queued));n("a.plupload_start",o).toggleClass("plupload_disabled",e.files.length==e.total.uploaded+e.total.failed);f[0].scrollTop=f[0].scrollHeight;a();!e.files.length&&e.features.dragdrop&&e.settings.dragdrop&&n("#"+s+"_filelist").append('<li class="plupload_droptext">'+i("Drag files here.")+"<\/li>")}function v(){delete r[s];e.destroy();o.html(l);e=o=l=null}var e,o,s,l;o=n(this);s=o.attr("id");s||(s=t.guid(),o.attr("id",s));l=o.html();u(s,o);f=n.extend({dragdrop:!0,browse_button:s+"_browse",container:s},f);f.dragdrop&&(f.drop_element=s+"_filelist");e=new t.Uploader(f);r[s]=e;e.bind("UploadFile",function(t,i){n("#"+i.id).addClass("plupload_current_file")});e.bind("Init",function(t,i){!f.unique_names&&f.rename&&o.on("click","#"+s+"_filelist div.plupload_file_name span",function(i){var u,f,e,r=n(i.target),o="",s=r.closest("li");s.hasClass("plupload_delete")&&(u=t.getFile(r.parents("li")[0].id),e=u.name,f=/^(.+)(\.[^.]+)$/.exec(e),f&&(e=f[1],o=f[2]),r.hide().after('<input type="text" />'),r.next().val(e).focus().blur(function(){r.show().next().remove()}).keydown(function(t){var i=n(this);13==t.keyCode&&(t.preventDefault(),u.name=i.val()+o,r.html(u.name),i.blur())}))});n("#"+s+"_container").attr("title","Using runtime: "+i.runtime);n("a.plupload_start",o).click(function(t){n(this).hasClass("plupload_disabled")||e.start();t.preventDefault()});n("a.plupload_stop",o).click(function(n){n.preventDefault();e.stop()});n("a.plupload_start",o).addClass("plupload_disabled")});e.bind("Error",function(r,u){var e,f=u.file;f&&(e=u.message,u.details&&(e+=" ("+u.details+")"),u.code==t.FILE_SIZE_ERROR&&alert(i("Error: File too large:")+" "+f.name),u.code==t.FILE_EXTENSION_ERROR&&alert(i("Error: Invalid file extension:")+" "+f.name),f.hint=e,n("#"+f.id).attr("class","plupload_failed").find("a").css("display","block").attr("title",e));u.code===t.INIT_ERROR&&setTimeout(function(){v()},1)});e.bind("PostInit",function(t){t.settings.dragdrop&&t.features.dragdrop&&n("#"+s+"_filelist").append('<li class="plupload_droptext">'+i("Drag files here.")+"<\/li>")});e.init();e.bind("StateChanged",function(){e.state===t.STARTED?(n("li.plupload_delete a,div.plupload_buttons",o).hide(),e.disableBrowse(!0),n("span.plupload_upload_status,div.plupload_progress,a.plupload_stop",o).css("display","block"),n("span.plupload_upload_status",o).html("Uploaded "+e.total.uploaded+"/"+e.files.length+" files"),f.multiple_queues&&n("span.plupload_total_status,span.plupload_total_file_size",o).show()):(c(),n("a.plupload_stop,div.plupload_progress",o).hide(),n("a.plupload_delete",o).css("display","block"),f.multiple_queues&&e.total.uploaded+e.total.failed==e.files.length&&(n(".plupload_buttons,.plupload_upload_status",o).css("display","inline"),e.disableBrowse(!1),n(".plupload_start",o).addClass("plupload_disabled"),n("span.plupload_total_status,span.plupload_total_file_size",o).hide()))});e.bind("FilesAdded",c);e.bind("FilesRemoved",function(){var t=n("#"+s+"_filelist").scrollTop();c();n("#"+s+"_filelist").scrollTop(t)});e.bind("FileUploaded",function(n,t){h(t)});e.bind("UploadProgress",function(t,i){n("#"+i.id+" div.plupload_file_status",o).html(i.percent+"%");h(i);a()});f.setup&&f.setup(e)}),this):r[n(this[0]).attr("id")]}}(jQuery,plupload)