',
a.$after("#"+d._id+"_appletdiv",c.replace(/ID/g,d._id+"_localReader")),d._localReader=a.$(d,"localReader"));a.$appEvent(d,"localReader_loadfile","click");a.$appEvent(d,"localReader_loadfile","click",function(){var e=a.$(d,"localReader_files")[0].files[0],c=new FileReader;c.onloadend=function(c){c.target.readyState==FileReader.DONE&&(a.$css(a.$(d,"localReader"),{display:"none"}),a._setData(b,e.name,c.target.result,f))};c.readAsArrayBuffer(e)});a.$appEvent(d,"localReader_cancel","click");a.$appEvent(d,
"localReader_cancel","click",function(){a.$css(a.$(d,"localReader"),{display:"none"});b.setData(null,f)});a.$css(a.$(d,"localReader"),{display:"block"})};a._setData=function(b,d,e,f){e=a._strToBytes(e);0<=d.indexOf(".jdx")&&a.Cache.put("cache://"+d,e);b.setData(d,e,f)};a._toBytes=function(b){if("string"==typeof b)return b.getBytes();b=new Uint8Array(b);for(var a=Clazz.newByteArray(b.length,0),e=b.length;0<=--e;)a[e]=b[e];return a};a._doAjax=function(b,d,e){b=b.toString();if(null!=e)return a._saveFile(b,
e);d&&(b+="?POST?"+d);d=a._getFileData(b);return a._processData(d,a._isBinaryUrl(b))};a._saveFile=function(b,d,e,f){if(a._localFileSaveFunction&&a._localFileSaveFunction(b,d))return"OK";b=b.substring(b.lastIndexOf("/")+1);e||(e=0<=b.indexOf(".pdf")?"application/pdf":0<=b.indexOf(".png")?"image/png":0<=b.indexOf(".jpg")?"image/jpg":"");var c="string"==typeof d;c||(d=(JU?JU:J.util).Base64.getBase64(d).toString());f||(f=c?"":"base64");(c=a._serverUrl)&&0<=c.indexOf("your.server")&&(c="");a._useDataURI||
!c?(f||(d=btoa(d)),f=document.createElement("a"),f.href="data:"+e+";base64,"+d,f.type=e||"text/plain",f.download=b,f.target="_blank",g("body").append(f),f.click(),f.remove()):(a._formdiv||(a.$after("body",'
\t\t\t\t\t\t\t\t\t\t\t\t
'),
a._formdiv="__jsmolform__"),a.$attr(a._formdiv,"action",c+"?"+(new Date).getMilliseconds()),a.$val("__jsmoldata__",d),a.$val("__jsmolfilename__",b),a.$val("__jsmolmimetype__",e),a.$val("__jsmolencoding__",f),a.$submit("__jsmolform__"),a.$val("__jsmoldata__",""),a.$val("__jsmolfilename__",""));return"OK"};a._processData=function(b,d){"undefined"==typeof b&&(b="",d=!1);d&&(d=a._canSyncBinary());return d?a._strToBytes(b):JU.SB.newS(b)};a._strToBytes=function(b){if(Clazz.instanceOf(b,self.ArrayBuffer))return a._toBytes(b);
for(var d=Clazz.newByteArray(b.length,0),e=b.length;0<=--e;)d[e]=b.charCodeAt(e)&255;return d};a._setConsoleDiv=function(b){self.Clazz&&Clazz.setConsoleDiv(b)};a._registerApplet=function(b,d){return window[b]=a._applets[b]=a._applets[d]=a._applets[b+"__"+a._syncId+"__"]=d};a._readyCallback=function(b,d,e,f){b=b.split("_object")[0];e=e.booleanValue?e.booleanValue():e;a._track(a._applets[b])._readyCallback(b,d,e,f)};a._getWrapper=function(b,d){var e;if(d){var f="";b._coverImage&&(e=' onclick="Jmol.coverApplet(ID, false)" title="'+
b._coverTitle+'"',f='
",f='
"+f+"
");e='...
IMG......
';var c=b._height,h=b._width;if("string"!==typeof c||0>c.indexOf("%"))c+="px";if("string"!==typeof h||0>h.indexOf("%"))h+="px";e=e.replace(/IMG/,f).replace(/Hpx/g,c).replace(/Wpx/g,h)}else e='......
......
......
...
';
return e.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,b._id)};a._documentWrite=function(b){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var d=document.getElementsByTagName("script");a._XhtmlElement=d.item(d.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(b):a._document.write(b)}return b};a._domWrite=function(b){for(var d=[0];d[0]
b.jarFile.indexOf("Signed")&&(b.jarFile=b.jarFile.replace(/Applet/,"AppletSigned")),b.use=b.use.replace(/SIGNED/,"JAVA"),b.isSigned=!0)};a._syncedApplets=[];a._syncedCommands=[];a._syncedReady=[];a._syncReady=!1;a._isJmolJSVSync=!1;a._setReady=function(b){a._syncedReady[b]=
1;for(var d=0,e=0;ed[0]?-1:0}if(!b||"object"!=typeof b)return[];for(var e=[],f=b.length-1;0<=f;f--)for(var c=0,h=b[f].length;cd.type.indexOf("touch"))return!1;d.preventDefault();var e=a.$offset(b.id),f,c=d.originalEvent;d.pageX||(d.pageX=c.pageX);d.pageY||
(d.pageY=c.pageY);a._mousePageX=d.pageX;a._mousePageY=d.pageY;c.targetTouches&&c.targetTouches[0]?(f=c.targetTouches[0].pageX-e.left,e=c.targetTouches[0].pageY-e.top):c.changedTouches?(f=c.changedTouches[0].pageX-e.left,e=c.changedTouches[0].pageY-e.top):(f=d.pageX-e.left,e=d.pageY-e.top);return void 0==f?null:[Math.round(f),Math.round(e),a._jsGetMouseModifiers(d)]};a._gestureUpdate=function(b,d){d.stopPropagation();d.preventDefault();var e=d.originalEvent;switch(d.type){case "touchstart":a._touching=
!0;break;case "touchend":a._touching=!1}if(!e.touches||2!=e.touches.length)return!1;switch(d.type){case "touchstart":b._touches=[[],[]];break;case "touchmove":var f=a.$offset(b.id),c=b._touches[0],h=b._touches[1];c.push([e.touches[0].pageX-f.left,e.touches[0].pageY-f.top]);h.push([e.touches[1].pageX-f.left,e.touches[1].pageY-f.top]);e=c.length;3f?-1:1,0,d]);return!1});a.$bind(b,"contextmenu",function(){return!1});a.$bind(b,"mouseout",function(d){b.applet._applet&&b.applet._applet.startHoverWatcher(!1);a._jsGetXY(b,d);return!1});a.$bind(b,"mouseenter",function(d){b.applet._applet&&b.applet._applet.startHoverWatcher(!0);if(0===d.buttons||0===d.which){b.isDragging=!1;d=a._jsGetXY(b,d);if(!d)return!1;
b.applet._processEvent(504,d);b.applet._processEvent(502,d);return!1}});a.$bind(b,"mousemoveoutjsmol",function(d,f,c){if(b==a._mouseOwner&&b.isDragging)return a._drag(b,c)});b.applet._is2D&&a.$resize(function(){b.applet&&b.applet._resize()});a.$bind("body","mouseup touchend",function(){b.applet&&(b.isDragging=!1);a._setMouseOwner(null)})};a._jsUnsetMouse=function(b){b.applet=null;a.$bind(b,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",
null);a._setMouseOwner(null)};a.Swing={count:0,menuInitialized:0,menuCounter:0,htDialogs:{}};var k=a.Swing;SwingController=k;k.setDraggable=function(b){b=b.prototype;b.setContainer||(b.setContainer=function(b){this.container=b;b.obj=this;this.ignoreMouse=this.isDragging=!1;var f=this;b.bind("mousedown touchstart",function(b){if(f.ignoreMouse)return f.ignoreMouse=!1,!0;a._setMouseOwner(f,!0);f.isDragging=!0;f.pageX=b.pageX;f.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(f.isDragging&&
a._mouseOwner==f)return f.mouseMove(b),!1});b.bind("mouseup touchend",function(b){f.mouseUp(b);a._setMouseOwner(null)})},b.mouseUp=function(b){if(this.isDragging&&a._mouseOwner==this)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=!1;a._setMouseOwner(null)},b.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"})},b.mouseMove=function(b){this.isDragging&&a._mouseOwner==this&&(this.timestamp=System.currentTimeMillis(),this.container.css({top:this.pageY0+(b.pageY-this.pageY)+"px",left:this.pageX0+(b.pageX-this.pageX)+"px"}))},b.dragBind=function(b){this.applet._ignoreMouse=!b;this.container.unbind("mousemoveoutjsmol");this.container.unbind("touchmoveoutjsmol");this.container.unbind("mouseupoutjsmol");this.container.unbind("touchendoutjsmol");
a._setMouseOwner(null);if(b){var f=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(b,a,d){f.mouseMove(d)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(b,a,d){f.mouseUp(d)})}})};k.JSDialog=function(){};k.setDraggable(k.JSDialog);k.getScreenDimensions=function(b){b.width=g(window).width();b.height=g(window).height()};k.dispose=function(b){a.$remove(b.id+"_mover");delete k.htDialogs[b.id];b.container.obj.dragBind(!1)};k.register=function(b,a){b.id=a+ ++k.count;
k.htDialogs[b.id]=b};k.setDialog=function(b){a._setMouseOwner(null);a.$remove(b.id);var d=b.id+"_mover",f=a._$(d),c;f[0]?(f.html(b.html),c=f[0].jd):(a.$after("body",""+b.html+"
"),c=new k.JSDialog,f=a._$(d),b.container=f,c.applet=b.manager.vwr.html5Applet,c.setContainer(f),c.dialog=b,c.setPosition(),c.dragBind(!0),f[0].jd=c);a.$bind("#"+b.id+" .JButton","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JComboBox",
"mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JCheckBox","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JTextField","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JTable","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JScrollPane","mousedown touchstart",function(){c.ignoreMouse=!0});a.$bind("#"+b.id+" .JEditorPane","mousedown touchstart",function(){c.ignoreMouse=!0})};k.setSelected=function(b){a.$prop(b.id,
"checked",!!b.selected)};k.setSelectedIndex=function(b){a.$prop(b.id,"selectedIndex",b.selectedIndex)};k.setText=function(b){a.$prop(b.id,"value",b.text)};k.setVisible=function(b){a.$setVisible(b.id,b.visible)};k.setEnabled=function(b){a.$setEnabled(b.id,b.enabled)};k.click=function(b,d){var f=k.htDialogs[b.id];if(f){var c=f.toString();if(0<=c.indexOf("JCheck"))f.selected=b.checked;else if(0<=c.indexOf("JCombo"))f.selectedIndex=b.selectedIndex;else if(null!=f.text&&(f.text=b.value,d&&13!=(d.charCode||
d.keyCode)))return}c=k.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];c.manager.actionPerformed(f?f.name:c.registryKey+"/"+b.id)};k.setFront=function(b){var d=b.manager.vwr.html5Applet;b.zIndex!=a._getZ(d,"dialog")&&(b.zIndex=a._incrZ(d,"dialog"));b.container&&((b.container[0]||b.container).style.zIndex=b.zIndex)};k.hideMenus=function(b){if(b=b._menus)for(var a in b)b[a].visible&&k.hideMenu(b[a])};k.windowClosing=function(b){b=k.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];b.registryKey?b.manager.processWindowClosing(b.registryKey):
b.dispose()};a._track=function(b){if(a._tracker){try{var f='';a.$after("body",f)}catch(e){}delete a._tracker}return b};a.getProfile=function(){window["j2s.doProfile"]=!0;if(self.Clazz&&self.JSON)return Clazz._profile||(Clazz._profile={}),Clazz.getProfile()};a._getInChIKey=
function(b,a){0<=a.indexOf("MOL=")&&a.split("MOL=")[1].split('"')};a._getAttr=function(b,a){var f=b.indexOf(a+"=");return 0<=f&&0<=(f=b.indexOf('"',f))?b.substring(f+1,b.indexOf('"',f+1)):null};a.User={viewUpdatedCallback:null};a.View={count:0,applets:{},sets:{}};(function(b){b.updateView=function(f,e){if(null!=f._viewSet){e.chemID||(f._searchQuery=null);e.data||(e.data="N/A");e.type=f._viewType;if(null==(f._currentView=b.__findView(f._viewSet,e)))f._currentView=b.__createViewSet(f._viewSet,e.chemID,
e.viewID||e.chemID);f._currentView[e.type].data=e.data;f._currentView[e.type].smiles=f._getSmiles();a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateView");b.__setView(f._currentView,f,!1)}};b.updateFromSync=function(f,e){f._updateMsg=e;var c=a._getAttr(e,"sourceID")||a._getAttr(e,"file");if(c){var h=b.__findView(f._viewSet,{viewID:c});if(null==h)return a.updateView(f,e);h!=f._currentView&&b.__setView(h,f,!0);var g=(c=a._getAttr(e,"atoms"))&&0<=e.indexOf("selectionhalos ON")?eval("["+
c+"]"):[];setTimeout(function(){f._currentView==h&&b.updateAtomPick(f,g)},10);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateFromSync")}};b.updateAtomPick=function(b,f){var c=b._currentView;if(null!=c){for(var h in c)"info"!=h&&c[h].applet!=b&&c[h].applet._updateAtomPick(f);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(b,"updateAtomPick")}};b.dumpViews=function(a){var f=b.sets[a];if(f){var c="View set "+a+":\n";a=b.applets[a];for(var h in a)c+="\napplet "+a[h]._id+" currentView="+
(a[h]._currentView?a[h]._currentView.info.viewID:null);for(h=f.length;0<=--h;){a=f[h];var c=c+("\n\nview="+h+" viewID="+a.info.viewID+" chemID="+a.info.chemID+"\n"),g,l;for(l in a)"info"!=l&&(c+="\nview="+h+" type="+l+" applet="+((g=a[l]).applet?g.applet._id:null)+" SMILES="+g.smiles+"\n atomMap="+JSON.stringify(g.atomMap)+"\n data=\n"+g.data+"\n")}return c}};b.__init=function(a){var f=a._viewSet,c=b.applets;c[f]||(c[f]={});c[f][a._viewType]=a};b.__findView=function(a,f){var c=b.sets[a];null==
c&&(c=b.sets[a]=[]);for(var h=c.length;0<=--h;){var g=c[h];if(f.viewID){if(g.info.viewID==f.viewID)return g}else{if(null!=f.chemID&&f.chemID==g.info.chemID)return g;for(var l in g)if("info"!=l&&(null!=f.data&&null!=g[l].data?f.data==g[l].data:f.type==l))return g}}return null};b.__createViewSet=function(f,c,h){b.count++;c={info:{chemID:c,viewID:h||"model_"+b.count}};for(var g in a._applets)h=a._applets[g],h._viewSet==f&&(c[h._viewType]={applet:h,data:null});b.sets[f].push(c);return c};b.__setView=
function(b,a,f){for(var c in b)if("info"!=c){var h=b[c],g=h.applet,l=f||null!=g&&""==g._molData;if(!(null==g||g==a&&!l)){var j=null==h.data,k=null!=g._currentView;g._currentView=b;if(!k||!(b[c].data==h.data&&!j&!l))if(g._loadModelFromView(b),j)break}}}})(a.View);a.Cache={fileCache:{}};a.Cache.get=function(b){return a.Cache.fileCache[b]};a.Cache.put=function(b,f){a.Cache.fileCache[b]=f};a.Cache.setDragDrop=function(b){a.$appEvent(b,"appletdiv","dragover",function(b){b=b.originalEvent;b.stopPropagation();
b.preventDefault();b.dataTransfer.dropEffect="copy"});a.$appEvent(b,"appletdiv","drop",function(f){f=f.originalEvent;f.stopPropagation();f.preventDefault();var c=f.dataTransfer.files[0];if(null==c)try{c=""+f.dataTransfer.getData("text"),(0==c.indexOf("file:/")||0==c.indexOf("http:/"))&&b._scriptLoad(c)}catch(h){}else{var g=new FileReader;g.onloadend=function(h){if(h.target.readyState==FileReader.DONE){var g="cache://DROP_"+c.name;h=a._toBytes(h.target.result);b._applet.cacheFileByName("cache://DROP_*",
!1);"JSV"==b._viewType||g.endsWith(".jdx")?a.Cache.put(g,h):b._applet.cachePut(g,h);(h=a._jsGetXY(b._canvas,f))&&(!b._applet.setStatusDragDropped||b._applet.setStatusDragDropped(0,h[0],h[1],g))&&b._applet.openFileAsyncSpecial(g,1)}};g.readAsArrayBuffer(c)}})}})(Jmol,jQuery);Jmol._debugCode=!1;Jmol._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"]];Jmol.say=function(a){alert(a)};
Jmol._TMApplet=function(a,g,f){this._uniqueId=(""+Math.random()).substring(3);this._id=a;this._is2D=!0;this._isJava=!1;this._ready=!0;this._mouseDown=!1;this._jmolType="Jmol._Canvas2D (TwirlyMol)";if(f)return this;this._createCanvas(a,g);return this};
Jmol._TMApplet._getApplet=function(a,g,f){if(!Jmol.featureDetection.allowHTML5)return null;f||(f=!1);g||(g={});Jmol._addDefaultInfo(g,{color:"#FFFFFF",width:300,height:300,addSelectionOptions:!1,serverURL:"http://your.server.here/jsmol.php",defaultModel:"",readyFunction:null,use:"HTML5",bondWidth:5,shadeAtoms:!1,zoomScaling:1.5,pinchScaling:2,mouseDragFactor:0.5,touchDragFactor:0.15,multipleBondSpacing:4,spinRateX:0,spinRateY:0.5,spinFPS:20,spin:!1,noscript:!0,debug:!1});g=new Jmol._TMApplet(a,g,
f);return f?g:Jmol._registerApplet(a,g)};Jmol.getTMApplet=Jmol._TMApplet._getApplet;
(function(a){a._CPK="#FF1493 #FFFFFF #D9FFFF #CC80FF #C2FF00 #FFB5B5 #909090 #3050F8 #FF0D0D #90E050 #B3E3F5 #AB5CF2 #8AFF00 #BFA6A6 #F0C8A0 #FF8000 #FFFF30 #1FF01F #80D1E3 #8F40D4 #3DFF00 #E6E6E6 #BFC2C7 #A6A6AB #8A99C7 #9C7AC7 #E06633 #F090A0 #50D050 #C88033 #7D80B0 #C28F8F #668F8F #BD80E3 #FFA100 #A62929 #5CB8D1 #702EB0 #00FF00 #94FFFF #94E0E0 #73C2C9 #54B5B5 #3B9E9E #248F8F #0A7D8C #006985 #C0C0C0 #FFD98F #A67573 #668080 #9E63B5 #D47A00 #940094 #429EB0 #57178F #00C900".split(" ");a._elem="X H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es".split(" ");
a._elemNo={};var g=a.prototype;g.spin=function(a){this.__Info.spin=a;this._spin(a)};g._spin=function(a){this._spinThread&&clearTimeout(this._spinThread);if(0==this.spinFPS||0==this.spinRateX&&0==this.spinRateY)a=!1;if(a){var c=this;a=1E3/this.spinFPS;this._mouseDown||(this._rotate(this.spinRateY,this.spinRateX),this._draw());this._spinThread=setTimeout(function(){c._spin(!0)},a)}};g._initParams=function(){this.zoom=this.__Info.defaultZoom||100;this.doSpin=this.__Info.spin||!1;this.center2D=[this._canvas.width/
2,this._canvas.height/2,0];this._getCenterAndRadius();this.rotation=new a.M3;this.shadeAtoms=!1;this._setParams()};g._setParams=function(){this.bondWidth=this.__Info.bondWidth||5;this.zoomScaling=this.__Info.zoomScaling||1.5;this.pinchScaling=this.__Info.pinchScaling||1;this.mouseDragFactor=this.__Info.mouseDragFactor||0.5;this.touchDragFactor=this.__Info.touchDragFactor||0.15;this.multipleBondSpacing=this.__Info.multipleBondSpacing||4;this.spinRateX=this.__Info.spinRateX||0;this.spinRateY=this.__Info.spinRateY||
0;this.spinFPS=this.__Info.spinFPS||0;var a=this.shadeAtoms;(this.shadeAtoms=this.__Info.shadeAtoms||!1)&&!a&&this._setAtomShades()};g._setAtomShades=function(){if(this.atoms)for(var a=this.atoms.length;0<=--a;)this.atoms[a].color50=this._getColor(this.atoms[a].color,0.5)};g._createCanvas=function(a,c){Jmol._setObject(this,a,c);this._color=this._color.replace(/0x/,"#");var h=Jmol._getWrapper(this,!0);Jmol._document?(Jmol._documentWrite(h),this._createCanvas2d(!1),h=""):h+='