',
c.$after("#"+f._id+"_appletdiv",l.replace(/ID/g,f._id+"_localReader")),f._localReader=c.$(f,"localReader"));c.$appEvent(f,"localReader_loadfile","click");c.$appEvent(f,"localReader_loadfile","click",function(){var g=c.$(f,"localReader_files")[0].files[0],k=new FileReader;k.onloadend=function(k){k.target.readyState==FileReader.DONE&&(c.$css(c.$(f,"localReader"),{display:"none"}),c._setData(b,g.name,g.name,k.target.result,j))};k.readAsArrayBuffer(g)});c.$appEvent(f,"localReader_cancel","click");c.$appEvent(f,
"localReader_cancel","click",function(){c.$css(c.$(f,"localReader"),{display:"none"});b.setData(null,null,null,j)});c.$css(c.$(f,"localReader"),{display:"block"})};c._setData=function(b,f,g,j,k){j=c._strToBytes(j);0<=f.indexOf(".jdx")&&c.Cache.put("cache://"+f,j);b.setData(f,g,j,k)};c._toBytes=function(b){if("string"==typeof b)return b.getBytes();b=new Uint8Array(b);for(var c=Clazz.newByteArray(b.length,0),g=b.length;0<=--g;)c[g]=b[g];return c};c._doAjax=function(b,f,g){b=b.toString();if(null!=g)return c._saveFile(b,
g);f&&(b+="?POST?"+f);return c._getFileData(b,null,!0)};c._saveFile=function(b,f,g,j){if(c._localFileSaveFunction&&c._localFileSaveFunction(b,f))return"OK";b=b.substring(b.lastIndexOf("/")+1);g||(g=0<=b.indexOf(".pdf")?"application/pdf":0<=b.indexOf(".png")?"image/png":0<=b.indexOf(".gif")?"image/gif":0<=b.indexOf(".jpg")?"image/jpg":"");var k="string"==typeof f;k||(f=(JU?JU:J.util).Base64.getBase64(f).toString());j||(j=k?"":"base64");(k=c._serverUrl)&&0<=k.indexOf("your.server")&&(k="");c._useDataURI||
!k?(j||(f=btoa(f)),j=document.createElement("a"),j.href="data:"+g+";base64,"+f,j.type=g||"text/plain",j.download=b,j.target="_blank",q("body").append(j),j.click(),j.remove()):(c._formdiv||(c.$after("body",'
\t\t\t\t\t\t\t\t\t\t\t\t
'),
c._formdiv="__jsmolform__"),c.$attr(c._formdiv,"action",k+"?"+(new Date).getMilliseconds()),c.$val("__jsmoldata__",f),c.$val("__jsmolfilename__",b),c.$val("__jsmolmimetype__",g),c.$val("__jsmolencoding__",j),c.$submit("__jsmolform__"),c.$val("__jsmoldata__",""),c.$val("__jsmolfilename__",""));return"OK"};c._strToBytes=function(b){if(Clazz.instanceOf(b,self.ArrayBuffer))return c._toBytes(b);for(var f=Clazz.newByteArray(b.length,0),g=b.length;0<=--g;)f[g]=b.charCodeAt(g)&255;return f};c._setConsoleDiv=
function(b){self.Clazz&&Clazz.setConsoleDiv(b)};c._registerApplet=function(b,f){return window[b]=c._applets[b]=c._applets[f]=c._applets[b+"__"+c._syncId+"__"]=f};c._readyCallback=function(b,f,g,j,k){b=b.split("_object")[0];k||(k=j);g=g.booleanValue?g.booleanValue():g;var l=c._applets[b];l._appletPanel=k;l._applet=j;c._track(l._readyCallback(b,f,g))};c._getWrapper=function(b,f){var g;if(f){var j="";b._coverImage&&(j=' onclick="Jmol.coverApplet(ID, false)" title="'+b._coverTitle+'"',g='
",j='
"+g+"
");g=c._appletCssText.replace(/\'/g,'"');g=0<=g.indexOf('style="')?g.split('style="')[1]:
'" '+g;g='...
IMG......
";var k=b._height,l=b._width;if("string"!==typeof k||0>k.indexOf("%"))k+="px";if("string"!==typeof l||0>l.indexOf("%"))l+="px";g=g.replace(/IMG/,j).replace(/Hpx/g,k).replace(/Wpx/g,l)}else g='......
......
......
...
';
return g.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,b._id)};c._documentWrite=function(b){if(c._document){if(c._isXHTML&&!c._XhtmlElement){var f=document.getElementsByTagName("script");c._XhtmlElement=f.item(f.length-1);c._XhtmlAppendChild=!1}c._XhtmlElement?c._domWrite(b):c._document.write(b)}return b};c._domWrite=function(b){for(var f=[0];f[0]
b.jarFile.indexOf("Signed")&&(b.jarFile=b.jarFile.replace(/Applet/,"AppletSigned")),b.use=b.use.replace(/SIGNED/,"JAVA"),b.isSigned=!0)};c._syncedApplets=[];c._syncedCommands=[];c._syncedReady=[];c._syncReady=!1;c._isJmolJSVSync=!1;c._setReady=function(b){c._syncedReady[b]=
1;for(var f=0,g=0;gf[0]?-1:0}if(!b||"object"!=typeof b)return[];for(var g=[],j=b.length-1;0<=j;j--)for(var k=0,l=b[j].length;kf.type.indexOf("touch"))return!1;f.preventDefault();var g=c.$offset(b.id),j,k=f.originalEvent;f.pageX||(f.pageX=k.pageX);f.pageY||
(f.pageY=k.pageY);c._mousePageX=f.pageX;c._mousePageY=f.pageY;k.targetTouches&&k.targetTouches[0]?(j=k.targetTouches[0].pageX-g.left,g=k.targetTouches[0].pageY-g.top):k.changedTouches?(j=k.changedTouches[0].pageX-g.left,g=k.changedTouches[0].pageY-g.top):(j=f.pageX-g.left,g=f.pageY-g.top);return void 0==j?null:[Math.round(j),Math.round(g),c._jsGetMouseModifiers(f)]};c._gestureUpdate=function(b,f){f.stopPropagation();f.preventDefault();var g=f.originalEvent;switch(f.type){case "touchstart":c._touching=
!0;break;case "touchend":c._touching=!1}if(!g.touches||2!=g.touches.length)return!1;switch(f.type){case "touchstart":b._touches=[[],[]];break;case "touchmove":var j=c.$offset(b.id),k=b._touches[0],l=b._touches[1];k.push([g.touches[0].pageX-j.left,g.touches[0].pageY-j.top]);l.push([g.touches[1].pageX-j.left,g.touches[1].pageY-j.top]);g=k.length;3g?-1:1,0,f]);return!1});c.$bind(b,"contextmenu",function(){return!1});c.$bind(b,"mouseout",function(f){b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!1);c._jsGetXY(b,f);return!1});c.$bind(b,"mouseenter",function(f){b.applet._appletPanel&&b.applet._appletPanel.startHoverWatcher(!0);if(0===f.buttons||0===f.which){b.isDragging=!1;f=c._jsGetXY(b,
f);if(!f)return!1;b.applet._processEvent(504,f);b.applet._processEvent(502,f);return!1}});c.$bind(b,"mousemoveoutjsmol",function(f,g,j){if(b==c._mouseOwner&&b.isDragging)return c._drag(b,j)});b.applet._is2D&&c.$resize(function(){b.applet&&b.applet._resize()});c.$bind("body","mouseup touchend",function(){b.applet&&(b.isDragging=!1);c._setMouseOwner(null)})};c._jsUnsetMouse=function(b){b.applet=null;c.$bind(b,"mousedown touchstart mousemove touchmove mouseup touchend DOMMouseScroll mousewheel contextmenu mouseout mouseenter",
null);c._setMouseOwner(null)};c.Swing={count:0,menuInitialized:0,menuCounter:0,htDialogs:{}};var w=c.Swing;SwingController=w;w.setDraggable=function(b){b=b.prototype;b.setContainer||(b.setContainer=function(b){this.container=b;b.obj=this;this.ignoreMouse=this.isDragging=!1;var g=this;b.bind("mousedown touchstart",function(b){if(g.ignoreMouse)return g.ignoreMouse=!1,!0;c._setMouseOwner(g,!0);g.isDragging=!0;g.pageX=b.pageX;g.pageY=b.pageY;return!1});b.bind("mousemove touchmove",function(b){if(g.isDragging&&
c._mouseOwner==g)return g.mouseMove(b),!1});b.bind("mouseup touchend",function(b){g.mouseUp(b);c._setMouseOwner(null)})},b.mouseUp=function(b){if(this.isDragging&&c._mouseOwner==this)return this.pageX0+=b.pageX-this.pageX,this.pageY0+=b.pageY-this.pageY,this.isDragging=!1;c._setMouseOwner(null)},b.setPosition=function(){if(null===c._mousePageX){var b=c.$offset(this.applet._id+"_"+(this.applet._is2D?"canvas2d":"canvas"));c._mousePageX=b.left;c._mousePageY=b.top}this.pageX0=c._mousePageX;this.pageY0=
c._mousePageY;this.container.css({top:c._mousePageY+"px",left:c._mousePageX+"px"})},b.mouseMove=function(b){if(this.isDragging&&c._mouseOwner==this){this.timestamp=System.currentTimeMillis();var g=this.pageX0+(b.pageX-this.pageX);b=this.pageY0+(b.pageY-this.pageY);c._mousePageX=g;c._mousePageY=b;this.container.css({top:b+"px",left:g+"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");c._setMouseOwner(null);if(b){var g=this;this.container.bind("mousemoveoutjsmol touchmoveoutjsmol",function(b,c,f){g.mouseMove(f)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(b,c,f){g.mouseUp(f)})}})};w.JSDialog=function(){};w.setDraggable(w.JSDialog);w.getScreenDimensions=function(b){b.width=q(window).width();b.height=q(window).height()};w.dispose=function(b){c.$remove(b.id+"_mover");delete w.htDialogs[b.id];b.container.obj.dragBind(!1)};
w.register=function(b,c){b.id=c+ ++w.count;w.htDialogs[b.id]=b};w.setDialog=function(b){c._setMouseOwner(null);c.$remove(b.id);var f=b.id+"_mover",g=c._$(f),j;g[0]?(g.html(b.html),j=g[0].jd):(c.$after("body",""+b.html+"
"),j=new w.JSDialog,g=c._$(f),b.container=g,j.applet=b.manager.vwr.html5Applet,j.setContainer(g),j.dialog=b,j.setPosition(),j.dragBind(!0),g[0].jd=j);c.$bind("#"+b.id+" .JButton","mousedown touchstart",function(){j.ignoreMouse=
!0});c.$bind("#"+b.id+" .JComboBox","mousedown touchstart",function(){j.ignoreMouse=!0});c.$bind("#"+b.id+" .JCheckBox","mousedown touchstart",function(){j.ignoreMouse=!0});c.$bind("#"+b.id+" .JTextField","mousedown touchstart",function(){j.ignoreMouse=!0});c.$bind("#"+b.id+" .JTable","mousedown touchstart",function(){j.ignoreMouse=!0});c.$bind("#"+b.id+" .JScrollPane","mousedown touchstart",function(){j.ignoreMouse=!0});c.$bind("#"+b.id+" .JEditorPane","mousedown touchstart",function(){j.ignoreMouse=
!0})};w.setSelected=function(b){c.$prop(b.id,"checked",!!b.selected)};w.setSelectedIndex=function(b){c.$prop(b.id,"selectedIndex",b.selectedIndex)};w.setText=function(b){c.$prop(b.id,"value",b.text)};w.setVisible=function(b){c.$setVisible(b.id,b.visible)};w.setEnabled=function(b){c.$setEnabled(b.id,b.enabled)};w.click=function(b,f){var g=w.htDialogs[b.id];if(g){var j=g.toString();if(0<=j.indexOf("JCheck"))g.selected=b.checked;else if(0<=j.indexOf("JCombo"))g.selectedIndex=b.selectedIndex;else if(null!=
g.text&&(g.text=b.value,f&&13!=(f.charCode||f.keyCode)))return}j=w.htDialogs[c.$getAncestorDiv(b.id,"JDialog").id];j.manager.actionPerformed(g?g.name:j.registryKey+"/"+b.id)};w.setFront=function(b){var f=b.manager.vwr.html5Applet;b.zIndex!=c._getZ(f,"dialog")&&(b.zIndex=c._incrZ(f,"dialog"));b.container&&((b.container[0]||b.container).style.zIndex=b.zIndex)};w.hideMenus=function(b){if(b=b._menus)for(var c in b)b[c].visible&&w.hideMenu(b[c])};w.windowClosing=function(b){b=w.htDialogs[c.$getAncestorDiv(b.id,
"JDialog").id];b.registryKey?b.manager.processWindowClosing(b.registryKey):b.dispose()};c._track=function(b){if(c._tracker){try{var f='';c.$after("body",f)}catch(g){}delete c._tracker}return b};c.getProfile=function(){window["j2s.doProfile"]=!0;if(self.Clazz&&self.JSON)return Clazz._profile||
(Clazz._profile={}),Clazz.getProfile()};c._getInChIKey=function(b,c){0<=c.indexOf("MOL=")&&c.split("MOL=")[1].split('"')};c._getAttr=function(b,c){var g=b.indexOf(c+"=");return 0<=g&&0<=(g=b.indexOf('"',g))?b.substring(g+1,b.indexOf('"',g+1)):null};c.User={viewUpdatedCallback:null};c.View={count:0,applets:{},sets:{}};(function(b){b.updateView=function(f,g){if(null!=f._viewSet){g.chemID||(f._searchQuery=null);g.data||(g.data="N/A");g.type=f._viewType;if(null==(f._currentView=b.__findView(f._viewSet,
g)))f._currentView=b.__createViewSet(f._viewSet,g.chemID,g.viewID||g.chemID);f._currentView[g.type].data=g.data;f._currentView[g.type].smiles=f._getSmiles();c.User.viewUpdatedCallback&&c.User.viewUpdatedCallback(f,"updateView");b.__setView(f._currentView,f,!1)}};b.updateFromSync=function(f,g){f._updateMsg=g;var j=c._getAttr(g,"sourceID")||c._getAttr(g,"file");if(j){var k=b.__findView(f._viewSet,{viewID:j});if(null==k)return c.updateView(f,g);k!=f._currentView&&b.__setView(k,f,!0);var l=(j=c._getAttr(g,
"atoms"))&&0<=g.indexOf("selectionhalos ON")?eval("["+j+"]"):[];setTimeout(function(){f._currentView==k&&b.updateAtomPick(f,l)},10);c.User.viewUpdatedCallback&&c.User.viewUpdatedCallback(f,"updateFromSync")}};b.updateAtomPick=function(b,g){var j=b._currentView;if(null!=j){for(var k in j)"info"!=k&&j[k].applet!=b&&j[k].applet._updateAtomPick(g);c.User.viewUpdatedCallback&&c.User.viewUpdatedCallback(b,"updateAtomPick")}};b.dumpViews=function(c){var g=b.sets[c];if(g){var j="View set "+c+":\n";c=b.applets[c];
for(var k in c)j+="\napplet "+c[k]._id+" currentView="+(c[k]._currentView?c[k]._currentView.info.viewID:null);for(k=g.length;0<=--k;){c=g[k];var j=j+("\n\nview="+k+" viewID="+c.info.viewID+" chemID="+c.info.chemID+"\n"),l,m;for(m in c)"info"!=m&&(j+="\nview="+k+" type="+m+" applet="+((l=c[m]).applet?l.applet._id:null)+" SMILES="+l.smiles+"\n atomMap="+JSON.stringify(l.atomMap)+"\n data=\n"+l.data+"\n")}return j}};b.__init=function(c){var g=c._viewSet,j=b.applets;j[g]||(j[g]={});j[g][c._viewType]=
c};b.__findView=function(c,g){var j=b.sets[c];null==j&&(j=b.sets[c]=[]);for(var k=j.length;0<=--k;){var l=j[k];if(g.viewID){if(l.info.viewID==g.viewID)return l}else{if(null!=g.chemID&&g.chemID==l.info.chemID)return l;for(var m in l)if("info"!=m&&(null!=g.data&&null!=l[m].data?g.data==l[m].data:g.type==m))return l}}return null};b.__createViewSet=function(f,g,j){b.count++;g={info:{chemID:g,viewID:j||"model_"+b.count}};for(var k in c._applets)j=c._applets[k],j._viewSet==f&&(g[j._viewType]={applet:j,
data:null});b.sets[f].push(g);return g};b.__setView=function(b,c,j){for(var k in b)if("info"!=k){var l=b[k],m=l.applet,n=j||null!=m&&""==m._molData;if(!(null==m||m==c&&!n)){var q=null==l.data,w=null!=m._currentView;m._currentView=b;if(!w||!(b[k].data==l.data&&!q&!n))if(m._loadModelFromView(b),q)break}}}})(c.View);c.Cache={fileCache:{}};c.Cache.get=function(b){return c.Cache.fileCache[b]};c.Cache.put=function(b,f){c.Cache.fileCache[b]=f};c.Cache.setDragDrop=function(b){c.$appEvent(b,"appletdiv",
"dragover",function(b){b=b.originalEvent;b.stopPropagation();b.preventDefault();b.dataTransfer.dropEffect="copy"});c.$appEvent(b,"appletdiv","drop",function(f){var g=f.originalEvent;g.stopPropagation();g.preventDefault();var j=g.dataTransfer.files[0];if(null==j)try{j=""+g.dataTransfer.getData("text"),(0==j.indexOf("file:/")||0==j.indexOf("http:/"))&&b._scriptLoad(j)}catch(k){}else g=new FileReader,g.onloadend=function(g){if(g.target.readyState==FileReader.DONE){var k="cache://DROP_"+j.name;g=c._toBytes(g.target.result);
k.endsWith(".spt")||b._appletPanel.cacheFileByName("cache://DROP_*",!1);"JSV"==b._viewType||k.endsWith(".jdx")?c.Cache.put(k,g):b._appletPanel.cachePut(k,g);(g=c._jsGetXY(b._canvas,f))&&(!b._appletPanel.setStatusDragDropped||b._appletPanel.setStatusDragDropped(0,g[0],g[1],k))&&b._appletPanel.openFileAsyncSpecial(k,1)}},g.readAsArrayBuffer(j)})}})(Jmol,jQuery);Jmol._debugCode=!1;Jmol._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"]];Jmol.say=function(c){alert(c)};
Jmol._TMApplet=function(c,q,j){this._uniqueId=(""+Math.random()).substring(3);this._id=c;this._is2D=!0;this._isJava=!1;this._ready=!0;this._mouseDown=!1;this._jmolType="Jmol._Canvas2D (TwirlyMol)";if(j)return this;this._createCanvas(c,q);return this};
Jmol._TMApplet._getApplet=function(c,q,j){if(!Jmol.featureDetection.allowHTML5)return null;j||(j=!1);q||(q={});Jmol._addDefaultInfo(q,{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});q=new Jmol._TMApplet(c,q,
j);return j?q:Jmol._registerApplet(c,q)};Jmol.getTMApplet=Jmol._TMApplet._getApplet;
(function(c){c._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(" ");c._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(" ");
c._elemNo={};var q=c.prototype;q.spin=function(c){this.__Info.spin=c;this._spin(c)};q._spin=function(c){this._spinThread&&clearTimeout(this._spinThread);if(0==this.spinFPS||0==this.spinRateX&&0==this.spinRateY)c=!1;if(c){var k=this;c=1E3/this.spinFPS;this._mouseDown||(this._rotate(this.spinRateY,this.spinRateX),this._draw());this._spinThread=setTimeout(function(){k._spin(!0)},c)}};q._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 c.M3;this.shadeAtoms=!1;this._setParams()};q._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 c=this.shadeAtoms;(this.shadeAtoms=this.__Info.shadeAtoms||!1)&&!c&&this._setAtomShades()};q._setAtomShades=function(){if(this.atoms)for(var c=this.atoms.length;0<=--c;)this.atoms[c].color50=this._getColor(this.atoms[c].color,0.5)};q._createCanvas=function(c,k){Jmol._setObject(this,c,k);this._color=this._color.replace(/0x/,"#");var l=Jmol._getWrapper(this,!0);Jmol._document?(Jmol._documentWrite(l),this._createCanvas2d(!1),l=""):l+='