'.replace(/ID/g,
b._id+"_localReader")),b._localReader=a.$(b,"localReader"));a.$appEvent(b,"localReader_loadfile","click");a.$appEvent(b,"localReader_loadfile","click",function(){var f=a.$(b,"localReader_files")[0].files[0],g=new FileReader;g.onloadend=function(g){g.target.readyState==FileReader.DONE&&(a.$appStyle(b,"localReader",{display:"none"}),c.setData(f.name,a._toBytes(g.target.result)))};g.readAsArrayBuffer(f)});a.$appEvent(b,"localReader_cancel","click");a.$appEvent(b,"localReader_cancel","click",function(){a.$appStyle(b,
"localReader",{display:"none"});c.setData(null,"#CANCELED#")});a.$appStyle(b,"localReader",{display:"block"})};a._toBytes=function(a){a=new Uint8Array(a);for(var b=Clazz.newByteArray(a.length,0),f=a.length;0<=--f;)b[f]=a[f];return b};a._doAjax=function(c,b,f){c=c.toString();if(null!=f)return a._saveFile(c,f);b&&(c+="?POST?"+b);b=a._getFileData(c);return a._processData(b,a._isBinaryUrl(c))};a._saveFile=function(c,b){var f=a._serverUrl;if(a._localFileSaveFunction&&a._localFileSaveFunction(c,b))return"OK";
if(!f)return"Jmol._serverUrl is not defined";var g="string"==typeof b,e=g?"":"base64";g||(b=J.io.Base64.getBase64(b).toString());c=c.substring(c.lastIndexOf("/")+1);g=0<=c.indexOf(".png")?"image/png":0<=c.indexOf(".jpg")?"image/jpg":"";a._formdiv||(a.$after("body",'
\t \t\t\t\t\t \t\t\t\t
'),
a._formdiv="__jsmolform__");a.$attr(a._formdiv,"action",f+"?"+(new Date).getMilliseconds());a.$val("__jsmoldata__",b);a.$val("__jsmolfilename__",c);a.$val("__jsmolmimetype__",g);a.$val("__jsmolencoding__",e);a.$submit("__jsmolform__");a.$val("__jsmoldata__","");a.$val("__jsmolfilename__","");return"OK"};a._processData=function(c,b){"undefined"==typeof c&&(c="",b=!1);b&=a._canSyncBinary();if(!b)return J.util.SB.newS(c);var f;if(Clazz.instanceOf(c,self.ArrayBuffer))return a._toBytes(c);f=Clazz.newByteArray(c.length,
0);for(var g=c.length;0<=--g;)f[g]=c.charCodeAt(g)&255;return f};a._setConsoleDiv=function(a){self.Clazz&&Clazz.setConsoleDiv(a)};a._setJmolParams=function(c,b,f){for(var g in b)if(0<="'progressbar','progresscolor','boxbgcolor','boxfgcolor','allowjavascript','boxmessage',\t\t\t\t\t\t\t\t\t'messagecallback','pickcallback','animframecallback','appletreadycallback','atommovedcallback',\t\t\t\t\t\t\t\t\t'echocallback','evalcallback','hovercallback','language','loadstructcallback','measurecallback',\t\t\t\t\t\t\t\t\t'minimizationcallback','resizecallback','scriptcallback','statusform','statustext','statustextarea',\t\t\t\t\t\t\t\t\t'synccallback','usecommandthread'".indexOf("'"+
g.toLowerCase()+"'")&&("language"!=g||a.featureDetection.supportsLocalization()))f?c.put(g,!0===b[g]?Boolean.TRUE:!1===b[g]?Boolean.FALSE:b[g]):c[g]=b[g]};a._registerApplet=function(c,b){return window[c]=a._applets[c]=a._applets[b]=b};a._readyCallback=function(c,b,f,g){var e=c.split("_object")[0];a._applets[e]._readyCallback(c,b,f,g)};a._getWrapper=function(a,b){var f=a._height,g=a._width;if("string"!==typeof f||0>f.indexOf("%"))f+="px";if("string"!==typeof g||0>g.indexOf("%"))g+="px";var e="";a._coverImage&&
(e=' onclick="Jmol.coverApplet(ID, false)" title="'+a._coverTitle+'"',e='
"+('")+"
");return(b?
'
').replace(/IMG/,
e).replace(/Hpx/g,f).replace(/Wpx/g,g).replace(/ID/g,a._id)};a._documentWrite=function(c){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var b=document.getElementsByTagName("script");a._XhtmlElement=b.item(b.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(c):a._document.write(c);return null}return c};a._domWrite=function(c){for(var b=[0];b[0]
a[0]?-1:0}if(!a||"object"!=typeof a)return[];for(var f=[],g=a.length-1;0<=g;g--)for(var e=0,j=a[g].length;eb.type.indexOf("touch"))return!1;b.preventDefault();var f=a.$offset(c.id),g,e=b.originalEvent;a._mousePageX=b.pageX;a._mousePageY=b.pageY;e.targetTouches&&e.targetTouches[0]?(g=e.targetTouches[0].pageX-f.left,f=e.targetTouches[0].pageY-f.top):e.changedTouches?(g=e.changedTouches[0].pageX-f.left,f=e.changedTouches[0].pageY-f.top):(g=b.pageX-f.left,
f=b.pageY-f.top);return void 0==g?null:[Math.round(g),Math.round(f),a._jsGetMouseModifiers(b)]};a._gestureUpdate=function(c,b){b.stopPropagation();b.preventDefault();var f=b.originalEvent;switch(b.type){case "touchstart":a._touching=!0;break;case "touchend":a._touching=!1}if(!f.touches||2!=f.touches.length)return!1;switch(b.type){case "touchstart":c._touches=[[],[]];break;case "touchmove":var g=a.$offset(c.id),e=c._touches[0],j=c._touches[1];e.push([f.touches[0].pageX-g.left,f.touches[0].pageY-g.top]);
j.push([f.touches[1].pageX-g.left,f.touches[1].pageY-g.top]);f=e.length;3f?-1:1,0,b]);return!1});a.$bind(c,"contextmenu",function(){return!1});a.$bind(c,"mouseout",function(){c.applet._applet&&c.applet._applet.viewer.startHoverWatcher(!1);c.isDragging=!1});a.$bind(c,"mouseenter",function(b){c.applet._applet&&c.applet._applet.viewer.startHoverWatcher(!0);if(0===b.buttons||0===b.which){c.isDragging=
!1;b=a._jsGetXY(c,b);if(!b)return!1;c.applet._processEvent(502,b)}});c.applet._is2D&&a.$resize(function(){c.applet&&c.applet._resize()});a.$bind("body","mouseup touchend",function(){c.applet&&(c.isDragging=!1)})};a._jsUnsetMouse=function(c){c.applet=null;a.$bind(c,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",null)};a._setDraggable=function(c){c=c.prototype;c.setContainer=function(b){this.container=b;this.ignoreMouse=this.isDragging=
!1;var a=this;b.bind("mousedown touchstart",function(b){if(a.ignoreMouse)return a.ignoreMouse=!1,!0;a.isDragging=!0;a.pageX=b.pageX;a.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(a.isDragging)return a.mouseMove(b),!1});b.bind("mouseup touchend",function(b){a.mouseUp(b)})};c.mouseUp=function(b){if(this.isDragging)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=!1};c.setPosition=function(){if(null===a._mousePageX){var b=a.$offset(this.applet._id+
"_"+(this.applet._is2D?"canvas2d":"canvas"));a._mousePageX=b.left;a._mousePageY=b.top}this.pageX0=a._mousePageX;this.pageY0=a._mousePageY;this.container.css({top:a._mousePageY+"px",left:a._mousePageX+"px"})};c.mouseMove=function(b){this.isDragging&&this.container.css({top:this.pageY0+(b.pageY-this.pageY)+"px",left:this.pageX0+(b.pageX-this.pageX)+"px"})};c.dragBind=function(b){this.container.unbind("mousemoveoutjsmol");this.container.unbind("touchmoveoutjsmol");this.container.unbind("mouseupoutjsmol");
this.container.unbind("touchendoutjsmol");if(b){var a=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(b,c,e){a.mouseMove(e)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(b,c,e){a.mouseUp(e)})}}}})(Jmol,jQuery);
(function(a){a._getCanvas=function(d,h,e,j,c){var b=null;j&&a.featureDetection.supportsWebGL()&&(a._Canvas3D.prototype=a._jsSetPrototype(new a._Applet(d,h,"",!0)),GLmol.setRefresh(a._Canvas3D.prototype),b=new a._Canvas3D(d,h,null,e));c&&null==b&&(a._Canvas2D.prototype=a._jsSetPrototype(new a._Applet(d,h,"",!0)),b=new a._Canvas2D(d,h,null,e));return b};a._Canvas2D=function(d,h,e,j){this._syncId=(""+Math.random()).substring(3);this._id=d;this._is2D=!0;this._isJava=!1;this._aaScale=1;this._jmolType=
"Jmol._Canvas2D (JSmol)";this._platform="J.awtjs2d.Platform";if(j)return this;window[d]=this;this._createCanvas(d,h,e,null);if(!a._document||this._deferApplet)return this;this._init();return this};a._jsSetPrototype=function(d){d._init=function(){this._setupJS();this._showInfo(!0);this._disableInitialConsole&&this._showInfo(!1)};d._createCanvas=function(d,e,j,c){a._setObject(this,d,e);c&&(this._GLmol=c,this._GLmol.applet=this,this._GLmol.id=this._id);c=a._getWrapper(this,!0);this._deferApplet||(a._document?
(a._documentWrite(c),this._getCanvas(!1),c=""):(this._deferApplet=!0,c+='