(function(a){function h(a){try{return a?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest}catch(c){}}a.ajaxSettings.xhr=void 0===window.ActiveXObject?h:function(){return(this.url==document.location||0==this.url.indexOf("http")||!this.isLocal)&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&h()||h(1)};a.ajaxTransport("+script",function(a){var c,g=document.head||jQuery("head")[0]||document.documentElement;return{send:function(j,l){c=document.createElement("script");a.scriptCharset&&
(c.charset=a.scriptCharset);c.src=a.url;c.onload=c.onreadystatechange=function(a,b){if(b||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,c.parentNode&&c.parentNode.removeChild(c),c=null,b||l(200,"success")};g.insertBefore(c,g.firstChild)},abort:function(){if(c)c.onload(void 0,!0)}}});a.extend(a.support,{iecors:!!window.XDomainRequest});a.support.iecors?a.ajaxTransport(function(a){return{send:function(c,g){var j=new window.XDomainRequest;j.onload=function(){g(200,
"OK",{text:j.responseText},{"Content-Type":j.contentType})};a.xhrFields&&(j.onerror=a.xhrFields.error,j.ontimeout=a.xhrFields.timeout);j.open(a.type,a.url);j.send(a.hasContent&&a.data||null)},abort:function(){xdr.abort()}}}):(a.ajaxSetup({accepts:{binary:"text/plain; charset=x-user-defined"},responseFields:{binary:"response"}}),a.ajaxTransport("binary",function(a){var c;return{send:function(g,j){var l=a.xhr();console.log("xhr.open binary async="+a.async+" url="+a.url);l.open(a.type,a.url,a.async);
var h=!1;try{l.hasOwnProperty("responseType")&&(l.responseType="arraybuffer",h=!0)}catch(b){}try{!h&&l.overrideMimeType&&l.overrideMimeType("text/plain; charset=x-user-defined")}catch(e){}!a.crossDomain&&!g["X-Requested-With"]&&(g["X-Requested-With"]="XMLHttpRequest");try{for(var d in g)l.setRequestHeader(d,g[d])}catch(m){}l.send(a.hasContent&&a.data||null);c=function(){var b=l.status,e="",d=l.getAllResponseHeaders(),m={};try{if(c&&4===l.readyState){c=void 0;try{m.text="string"===typeof l.responseText?
l.responseText:null}catch(g){}try{m.binary=l.response}catch(h){}try{e=l.statusText}catch(k){e=""}!b&&a.isLocal&&!a.crossDomain?b=m.text?200:404:1223===b&&(b=204);j(b,e,m,d)}}catch(s){alert(s),j(-1,s)}};a.async?4===l.readyState?setTimeout(c):l.onreadystatechange=c:c()},abort:function(){}}}))})(jQuery);
(function(a,h,f,c){function g(f,g){function k(e){a(b).each(function(){self.Jmol&&(0<=g.indexOf("mouseup")||0<=g.indexOf("touchend"))&&Jmol._setMouseOwner(null);var b=a(this);this!==e.target&&!b.has(e.target).length&&b.triggerHandler(g,[e.target,e])})}g=g||f+c;var b=a(),e=f+"."+g+"-special-event";a.event.special[g]={setup:function(){b=b.add(this);1===b.length&&a(h).bind(e,k)},teardown:function(){self.Jmol&&Jmol._setMouseOwner(null);b=b.not(this);0===b.length&&a(h).unbind(e)},add:function(b){var a=
b.handler;b.handler=function(b,e){b.target=e;a.apply(this,arguments)}}}}a.map(f.split(" "),function(a){g(a)});g("focusin","focus"+c);g("focusout","blur"+c)})(jQuery,document,"click mousemove mouseup touchmove touchend","outjsmol");"undefined"==typeof jQuery&&alert("Note -- JSmoljQuery is required for JSmol, but it's not defined.");self.Jmol||(Jmol={});
Jmol._version||(Jmol=function(a){var h=function(a){return{header:a++,rear:a++,main:a++,image:a++,front:a++,fileOpener:a++,coverImage:a++,dialog:a++,menu:a+9E4,console:a+91E3,monitorZIndex:a+99999}},h={_version:"$Date: 2014-12-19 08:17:57 -0600 (Fri, 19 Dec 2014) $",_alertNoBinary:!0,_allowedJmolSize:[25,2048,300],_appletCssClass:"",_appletCssText:"",_fileCache:null,_jarFile:null,_j2sPath:null,_use:null,_j2sLoadMonitorOpacity:90,_applets:{},_asynchronous:!0,_ajaxQueue:[],_getZOrders:h,_z:h(Jmol.z||
9E3),_debugCode:!0,db:{_databasePrefixes:"$=:",_fileLoadScript:";if (_loadScript = '' && defaultLoadScript == '' && _filetype == 'Pdb') { select protein or nucleic;cartoons Only;color structure; select * };",_nciLoadScript:";n = ({molecule=1}.length < {molecule=2}.length ? 2 : 1); select molecule=n;display selected;center selected;",_pubChemLoadScript:"",_DirectDatabaseCalls:{"cactus.nci.nih.gov":"%URL","www.rcsb.org":"%URL","pdbe.org":"%URL","www.ebi.ac.uk":"%URL","wwwdev.ebi.ac.uk":"%URL","pubchem.ncbi.nlm.nih.gov":"%URL",
"http://www.nmrdb.org/tools/jmol/predict.php":"%URL",$:"http://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf&get3d=True",$$:"http://cactus.nci.nih.gov/chemical/structure/%FILENCI/file?format=sdf","=":"http://www.rcsb.org/pdb/files/%FILE.pdb","*":"http://www.ebi.ac.uk/pdbe/entry-files/download/%FILE.cif","==":"http://www.rcsb.org/pdb/files/ligand/%FILE.cif",":":"http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d"},_restQueryUrl:"http://www.rcsb.org/pdb/rest/search",
_restQueryXml:"<orgPdbQuery><queryType>org.pdb.query.simple.AdvancedKeywordQuery</queryType><description>Text Search</description><keywords>QUERY</keywords></orgPdbQuery>",_restReportUrl:"http://www.pdb.org/pdb/rest/customReport?pdbids=IDLIST&customReportColumns=structureId,structureTitle"},_debugAlert:!1,_document:a,_isXHTML:!1,_lastAppletID:null,_mousePageX:null,_mouseOwner:null,_serverUrl:"http://your.server.here/jsmol.php",_syncId:(""+Math.random()).substring(3),_touching:!1,_XhtmlElement:null,
_XhtmlAppendChild:!1};a=a.location.href.toLowerCase();h._httpProto=0==a.indexOf("https")?"https://":"http://";h._isFile=0==a.indexOf("file:");h._ajaxTestSite=h._httpProto+"google.com";a=h._isFile||0==a.indexOf("http://localhost")||0==a.indexOf("http://127.");h._tracker="http://"==h._httpProto&&!a&&"http://chemapps.stolaf.edu/jmol/JmolTracker.htm?id=UA-45940799-1";h._isChrome=0<=navigator.userAgent.toLowerCase().indexOf("chrome");h._isSafari=!h._isChrome&&0<=navigator.userAgent.toLowerCase().indexOf("safari");
h._isMsie=void 0!==window.ActiveXObject;h._useDataURI=!h._isSafari&&!h._isMsie;for(var f in Jmol)h[f]=Jmol[f];return h}(document,Jmol));
(function(a,h){h(document).ready(function(){a._document=null});a.$=function(b,a){null==b&&alert(a+arguments.callee.caller.toString());return h(a?"#"+b._id+"_"+a:b)};a._$=function(b){return"string"==typeof b?h("#"+b):b};a.$ajax=function(b){a._ajaxCall=b.url;b.cache="NO"!=b.cache;0==b.url.indexOf("http://pubchem.ncbi.nlm.nih")&&(b.url="https://"+b.url.substring(7));return h.ajax(b)};a._getNCIInfo=function(b,e){return a._getFileData("http://cactus.nci.nih.gov/chemical/structure/"+b+"/"+("name"==e?"names":
e))};a.$appEvent=function(b,e,d,f){b=a.$(b,e);b.off(d)&&f&&b.on(d,f)};a.$resize=function(b){return h(window).resize(b)};a.$after=function(b,a){return h(b).after(a)};a.$bind=function(b,a,d){return d?h(b).bind(a,d):h(b).unbind(a)};a.$closest=function(b,a){return h(b).closest(a)};a.$get=function(b,a){return h(b).get(a)};a.$documentOff=function(b,a){return h(document).off(b,"#"+a)};a.$documentOn=function(b,a,d){return h(document).on(b,"#"+a,d)};a.$getAncestorDiv=function(b,a){return h("div."+a+":has(#"+
b+")")[0]};a.$supportsIECrossDomainScripting=function(){return h.support.iecors};a.$attr=function(b,e,d){return a._$(b).attr(e,d)};a.$css=function(b,e){return a._$(b).css(e)};a.$find=function(b,e){return a._$(b).find(e)};a.$focus=function(b){return a._$(b).focus()};a.$html=function(b,e){return a._$(b).html(e)};a.$offset=function(b){return a._$(b).offset()};a.$windowOn=function(b,a){return h(window).on(b,a)};a.$prop=function(b,e,d){var f=a._$(b);return 3==arguments.length?f.prop(e,d):f.prop(e)};a.$remove=
function(b){return a._$(b).remove()};a.$scrollTo=function(b,e){var d=a._$(b);return d.scrollTop(0>e?d[0].scrollHeight:e)};a.$setEnabled=function(b,e){return a._$(b).attr("disabled",e?null:"disabled")};a.$setSize=function(b,e,d){return a._$(b).width(e).height(d)};a.$setVisible=function(b,e){var d=a._$(b);return e?d.show():d.hide()};a.$submit=function(b){return a._$(b).submit()};a.$val=function(b,e){var d=a._$(b);return 1==arguments.length?d.val():d.val(e)};a._clearVars=function(){delete jQuery;delete h;
delete a;delete SwingController;delete J;delete JM;delete JS;delete JSV;delete JU;delete JV;delete java;delete javajs;delete Clazz;delete c$};var f=document,c=window,g={};g.ua=navigator.userAgent.toLowerCase();var j;a:{j=["linux","unix","mac","win"];for(var l=j.length;l--;)if(-1!=g.ua.indexOf(j[l])){j=j[l];break a}j="unknown"}g.os=j;g.browser=function(){for(var b=g.ua,a="konqueror webkit omniweb opera webtv icab msie mozilla".split(" "),d=0;d<a.length;d++)if(0<=b.indexOf(a[d]))return a[d];return"unknown"};
g.browserName=g.browser();g.browserVersion=parseFloat(g.ua.substring(g.ua.indexOf(g.browserName)+g.browserName.length+1));g.supportsXhr2=function(){return h.support.cors||h.support.iecors};g.allowDestroy="msie"!=g.browserName;g.allowHTML5="msie"!=g.browserName||0>navigator.appVersion.indexOf("MSIE 8");g.getDefaultLanguage=function(){return navigator.language||navigator.userLanguage||"en-US"};g._webGLtest=0;g.supportsWebGL=function(){if(!a.featureDetection._webGLtest){var b;a.featureDetection._webGLtest=
c.WebGLRenderingContext&&((b=f.createElement("canvas")).getContext("webgl")||b.getContext("experimental-webgl"))?1:-1}return 0<a.featureDetection._webGLtest};g.supportsLocalization=function(){for(var b=f.getElementsByTagName("meta"),a=b.length;0<=--a;)if(0<=b[a].outerHTML.toLowerCase().indexOf("utf-8"))return!0;return!1};g.supportsJava=function(){a.featureDetection._javaEnabled||(a.featureDetection._javaEnabled=a._isMsie?navigator.javaEnabled()?1:-1:navigator.javaEnabled()&&(!navigator.mimeTypes||
navigator.mimeTypes["application/x-java-applet"])?1:-1);return 0<a.featureDetection._javaEnabled};g.compliantBrowser=function(){var b=!!f.getElementById,a=g.os;if("opera"==g.browserName&&7.54>=g.browserVersion&&"mac"==a||"webkit"==g.browserName&&125.12>g.browserVersion||"msie"==g.browserName&&"mac"==a||"konqueror"==g.browserName&&3.3>=g.browserVersion)b=!1;return b};g.isFullyCompliant=function(){return g.compliantBrowser()&&g.supportsJava()};g.useIEObject="win"==g.os&&"msie"==g.browserName&&5.5<=
g.browserVersion;g.useHtml4Object="mozilla"==g.browserName&&5<=g.browserVersion||"opera"==g.browserName&&8<=g.browserVersion||"webkit"==g.browserName;g.hasFileReader=c.File&&c.FileReader;a.featureDetection=g;a._ajax=function(b){if(!b.async)return a.$ajax(b).responseText;a._ajaxQueue.push(b);1==a._ajaxQueue.length&&a._ajaxDone()};a._ajaxDone=function(){var b=a._ajaxQueue.shift();b&&a.$ajax(b)};a._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"],["=","RCSB(macromolecules)"],
["*","PDBe(macromolecules)"]];a._getGrabberOptions=function(b){if(0==a._grabberOptions.length)return"";var e='<input type="text" id="ID_query" onfocus="jQuery(this).select()" onkeypress="if(13==event.which){Jmol._applets[\'ID\']._search();return false}" size="32" value="" />',d='<button id="ID_submit" onclick="Jmol._applets[\'ID\']._search()">Search</button></nobr>';1==a._grabberOptions.length?(e="<nobr>"+e+'<span style="display:none">',d="</span>"+d):e+="<br /><nobr>";for(var e=e+'<select id="ID_select">',
f=0;f<a._grabberOptions.length;f++)var c=a._grabberOptions[f],e=e+('<option value="'+c[0]+'" '+(0==f?"selected":"")+">"+c[1]+"</option>");e=(e+"</select>"+d).replace(/ID/g,b._id);return"<br />"+e};a._getScriptForDatabase=function(b){return"$"==b?a.db._nciLoadScript:":"==b?a.db._pubChemLoadScript:a.db._fileLoadScript};a._setInfo=function(b,a,d){var f=[],c="";if(0==d.indexOf("ERROR"))c=d;else switch(a){case "=":a=d.split("<dimStructure.structureId>");f=["<table>"];for(d=1;d<a.length;d++)f.push('<tr><td valign=top><a href="javascript:Jmol.search('+
b._id+",'="+a[d].substring(0,4)+"')\">"+a[d].substring(0,4)+"</a></td>"),f.push("<td>"+a[d].split("Title>")[1].split("</")[0]+"</td></tr>");f.push("</table>");c=a.length-1+" matches";break;case "$":case ":":break;default:return}b._infoHeader=c;b._info=f.join("");b._showInfo(!0)};a._loadSuccess=function(b,e){e&&(a._ajaxDone(),e(b))};a._loadError=function(b){a._ajaxDone();a.say("Error connecting to server: "+a._ajaxCall);null!=b&&b()};a._isDatabaseCall=function(b){return 0<=a.db._databasePrefixes.indexOf(b.substring(0,
1))};a._getDirectDatabaseCall=function(b,e){if(e&&!a.featureDetection.supportsXhr2())return b;var d=2,f,c=a.db._DirectDatabaseCalls[b.substring(0,d)];c||(c=a.db._DirectDatabaseCalls[f=b.substring(0,--d)]);c&&(":"==f?(f=b.toLowerCase(),isNaN(parseInt(b.substring(1)))?0==f.indexOf(":smiles:")?(c+="?POST?smiles="+b.substring(8),b="smiles"):0==f.indexOf(":cid:")?b="cid/"+b.substring(5):(0==f.indexOf(":name:")?b=b.substring(5):0==f.indexOf(":cas:")&&(b=b.substring(4)),b="name/"+encodeURIComponent(b.substring(d))):
b="cid/"+b.substring(1)):b=encodeURIComponent(b.substring(d)),0<=c.indexOf("FILENCI")?(b=b.replace(/\%2F/g,"/"),b=c.replace(/\%FILENCI/,b)):b=c.replace(/\%FILE/,b));return b};a._getRawDataFromServer=function(b,e,d,f,c,g){b="?call=getRawDataFromDatabase&database="+b+(0<=e.indexOf("?POST?")?"?POST?":"")+"&query="+encodeURIComponent(e)+(c?"&encoding=base64":"")+(g?"":"&script="+encodeURIComponent(a._getScriptForDatabase(b)));return a._contactServer(b,d,f)};a._checkFileName=function(b,e,d){a._isDatabaseCall(e)&&
(d&&a._setQueryTerm(b,e),e=a._getDirectDatabaseCall(e,!0),a._isDatabaseCall(e)&&(e=a._getDirectDatabaseCall(e,!1),d&&(d[0]=!0)));return e};a._checkCache=function(b,e,d){if(b._cacheFiles&&a._fileCache&&!e.endsWith(".js")){if(b=a._fileCache[e])return System.out.println("using "+b.length+" bytes of cached data for "+e),d(b),null;d=function(b,e){d(a._fileCache[b]=e)}}return d};a._loadFileData=function(b,e,d,f){var c=[];e=a._checkFileName(b,e,c);d=a._checkCache(b,e,d);c[0]?a._getRawDataFromServer("_",
e,d,f):(b={type:"GET",dataType:"text",url:e,async:a._asynchronous,success:function(b){a._loadSuccess(b,d)},error:function(){a._loadError(f)}},a._checkAjaxPost(b),a._ajax(b))};a._getInfoFromDatabase=function(b,e,d){if("===="==e){var f=a.db._restQueryXml.replace(/QUERY/,d),f={dataType:"text",type:"POST",contentType:"application/x-www-form-urlencoded",url:a.db._restQueryUrl,data:encodeURIComponent(f)+"&req=browser",success:function(f){a._ajaxDone();a._extractInfoFromRCSB(b,e,d,f)},error:function(){a._loadError(null)},
async:a._asynchronous};return a._ajax(f)}d="?call=getInfoFromDatabase&database="+e+"&query="+encodeURIComponent(d);return a._contactServer(d,function(d){a._setInfo(b,e,d)})};a._extractInfoFromRCSB=function(b,e,d,f){var c=f.length/5;if(0!=c&&4==d.length&&1!=c){d=d.toUpperCase();var g=f.indexOf(d);0<g&&0<="123456789".indexOf(d.substring(0,1))&&(f=d+","+f.substring(0,g)+f.substring(g+5));50<c&&(f=f.substring(0,250));f=f.replace(/\n/g,",");f=a._restReportUrl.replace(/IDLIST/,f);a._loadFileData(b,f,function(d){a._setInfo(b,
e,d)})}};a._checkAjaxPost=function(b){var a=b.url.indexOf("?POST?");0<a&&(b.data=b.url.substring(a+6),b.url=b.url.substring(0,a),b.type="POST",b.contentType="application/x-www-form-urlencoded")};a._contactServer=function(b,e,d){b={dataType:"text",type:"GET",url:a._serverUrl+b,success:function(b){a._loadSuccess(b,e)},error:function(){a._loadError(d)},async:e?a._asynchronous:!1};a._checkAjaxPost(b);return a._ajax(b)};a._setQueryTerm=function(b,e){if(e&&b._hasOptions&&"http://"!=e.substring(0,7)){if(a._isDatabaseCall(e)){var d=
e.substring(0,1);e=e.substring(1);e.substring(0,1)==d&&0<="=$".indexOf(d)&&(e=e.substring(1));var f=a._getElement(b,"select");if(f&&f.options)for(var c=0;c<f.options.length;c++)f[c].value==d&&(f[c].selected=!0)}a.$val(a.$(b,"query"),e)}};a._search=function(b,e,d){1<arguments.length||(e=null);a._setQueryTerm(b,e);e||(e=a.$val(a.$(b,"query")));0==e.indexOf("!")?b._script(e.substring(1)):(e&&(e=e.replace(/\"/g,"")),b._showInfo(!1),a._searchMol(b,e,d,!0))};a._searchMol=function(b,e,d,f){var c;a._isDatabaseCall(e)?
(c=e.substring(0,1),e=e.substring(1)):c=b._hasOptions?a.$val(a.$(b,"select")):"$";"="==c&&3==e.length&&(e="="+e);var g=c+e;if(e&&!(0>g.indexOf("?")&&g==b._thisJmolModel)){b._thisJmolModel=g;var j;f&&null!=b._viewSet&&null!=(j=a.View.__findView(b._viewSet,{chemID:g}))?a.View.__setView(j,b,!1):("$"==c||":"==c?b._jmolFileType="MOL":"="==c&&(b._jmolFileType="PDB"),b._searchDatabase(e,c,d))}};a._searchDatabase=function(b,e,d,f){b._showInfo(!1);return 0<=e.indexOf("?")?(a._getInfoFromDatabase(b,d,e.split("?")[0]),
!0):a.db._DirectDatabaseCalls[d]?(b._loadFile(d+e,f),!0):!1};a._syncBinaryOK="?";a._canSyncBinary=function(b){if(a._isAsync)return!0;if(self.VBArray)return a._syncBinaryOK=!1;if("?"!=a._syncBinaryOK)return a._syncBinaryOK;a._syncBinaryOK=!0;try{var e=new window.XMLHttpRequest;e.open("text",a._ajaxTestSite,!1);e.hasOwnProperty("responseType")?e.responseType="arraybuffer":e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined")}catch(d){return System.out.println("JSmolCore.js: synchronous binary file transfer is requested but not available"),
a._alertNoBinary&&!b&&alert("JSmolCore.js: synchronous binary file transfer is requested but not available"),a._syncBinaryOK=!1}return!0};a._binaryTypes=".gz .jpg .gif .png .zip .jmol .bin .smol .spartan .mrc .pse .map .omap".split(" ");a._isBinaryUrl=function(b){for(var e=a._binaryTypes.length;0<=--e;)if(0<=b.indexOf(a._binaryTypes[e]))return!0;return!1};a._getFileData=function(b,e,d){var f=a._isBinaryUrl(b),c=0<=b.indexOf("pdb.gz")&&0==b.indexOf("http://www.rcsb.org/pdb/files/"),g=f&&!a._canSyncBinary(c);
g&&c&&(b=b.replace(/pdb\.gz/,"pdb"),g=f=!1);c=0<=b.indexOf("?POST?");0==b.indexOf("file:/")&&0!=b.indexOf("file:///")&&(b="file://"+b.substring(5));var j=0>b.indexOf("://")||0==b.indexOf(document.location.protocol)&&0<=b.indexOf(document.location.host),h=a._isDirectCall(b),l=!j&&a.$supportsIECrossDomainScripting(),k=null;if((!e||g)&&(l||g||!j&&!h))k=a._getRawDataFromServer("_",b,e,e,g,!0);else{b=b.replace(/file:\/\/\/\//,"file://");var n={dataType:f?"binary":"text",async:!!e};c?(n.type="POST",n.url=
b.split("?POST?")[0],n.data=b.split("?POST?")[1]):(n.type="GET",n.url=b);e&&(n.success=function(){e(a._xhrReturn(n.xhr))},n.error=function(){xxi=n;e(n.xhr.statusText)});n.xhr=a.$ajax(n);e||(k=a._xhrReturn(n.xhr))}if(!d)return k;null==k&&(k="",f=!1);f&&(f=a._canSyncBinary(!0));return f?a._strToBytes(k):JU.SB.newS(k)};a._xhrReturn=function(b){return!b.responseText||self.Clazz&&Clazz.instanceOf(b.response,self.ArrayBuffer)?b.response||b.statusText:b.responseText};a._isDirectCall=function(b){for(var e in a.db._DirectDatabaseCalls)if(0<=
e.indexOf(".")&&0<=b.indexOf(e))return!0;return!1};a._cleanFileData=function(b){return 0<=b.indexOf("\r")&&0<=b.indexOf("\n")?b.replace(/\r\n/g,"\n"):0<=b.indexOf("\r")?b.replace(/\r/g,"\n"):b};a._getFileType=function(b){var a=b.substring(0,1);if("$"==a||":"==a)return"MOL";if("="==a)return"="==b.substring(1,2)?"LCIF":"PDB";b=b.split(".").pop().toUpperCase();return b.substring(0,Math.min(b.length,3))};a._getZ=function(b,e){return b&&b._z&&b._z[e]||a._z[e]};a._incrZ=function(b,e){return b&&b._z&&++b._z[e]||
++a._z[e]};a._loadFileAsynchronously=function(b,e,d,f){if(0!=d.indexOf("?")){var c=d;d=a._checkFileName(e,d);var g=function(e){a._setData(b,d,c,e,f)},g=a._checkCache(e,d,g);0<=d.indexOf("|")&&(d=d.split("|")[0]);return null==g?null:a._getFileData(d,g)}if(!a.featureDetection.hasFileReader)return b.setData("Local file reading is not enabled in your browser",null,null,f);e._localReader||(g='<div id="ID" style="z-index:'+a._getZ(e,"fileOpener")+';position:absolute;background:#E0E0E0;left:10px;top:10px"><div style="margin:5px 5px 5px 5px;"><input type="file" id="ID_files" /><button id="ID_loadfile">load</button><button id="ID_cancel">cancel</button></div><div>',
a.$after("#"+e._id+"_appletdiv",g.replace(/ID/g,e._id+"_localReader")),e._localReader=a.$(e,"localReader"));a.$appEvent(e,"localReader_loadfile","click");a.$appEvent(e,"localReader_loadfile","click",function(){var d=a.$(e,"localReader_files")[0].files[0],c=new FileReader;c.onloadend=function(c){c.target.readyState==FileReader.DONE&&(a.$css(a.$(e,"localReader"),{display:"none"}),a._setData(b,d.name,d.name,c.target.result,f))};c.readAsArrayBuffer(d)});a.$appEvent(e,"localReader_cancel","click");a.$appEvent(e,
"localReader_cancel","click",function(){a.$css(a.$(e,"localReader"),{display:"none"});b.setData(null,null,null,f)});a.$css(a.$(e,"localReader"),{display:"block"})};a._setData=function(b,e,d,f,c){f=a._strToBytes(f);0<=e.indexOf(".jdx")&&a.Cache.put("cache://"+e,f);b.setData(e,d,f,c)};a._toBytes=function(b){if("string"==typeof b)return b.getBytes();b=new Uint8Array(b);for(var a=Clazz.newByteArray(b.length,0),d=b.length;0<=--d;)a[d]=b[d];return a};a._doAjax=function(b,e,d){b=b.toString();if(null!=d)return a._saveFile(b,
d);e&&(b+="?POST?"+e);return a._getFileData(b,null,!0)};a._saveFile=function(b,e,d,f){if(a._localFileSaveFunction&&a._localFileSaveFunction(b,e))return"OK";b=b.substring(b.lastIndexOf("/")+1);d||(d=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 c="string"==typeof e;c||(e=(JU?JU:J.util).Base64.getBase64(e).toString());f||(f=c?"":"base64");(c=a._serverUrl)&&0<=c.indexOf("your.server")&&(c="");a._useDataURI||
!c?(f||(e=btoa(e)),f=document.createElement("a"),f.href="data:"+d+";base64,"+e,f.type=d||"text/plain",f.download=b,f.target="_blank",h("body").append(f),f.click(),f.remove()):(a._formdiv||(a.$after("body",'<div id="__jsmolformdiv__" style="display:none">\t\t\t\t\t\t<form id="__jsmolform__" method="post" target="_blank" action="">\t\t\t\t\t\t<input name="call" value="saveFile"/>\t\t\t\t\t\t<input id="__jsmolmimetype__" name="mimetype" value=""/>\t\t\t\t\t\t<input id="__jsmolencoding__" name="encoding" value=""/>\t\t\t\t\t\t<input id="__jsmolfilename__" name="filename" value=""/>\t\t\t\t\t\t<textarea id="__jsmoldata__" name="data"></textarea>\t\t\t\t\t\t</form>\t\t\t\t\t\t</div>'),
a._formdiv="__jsmolform__"),a.$attr(a._formdiv,"action",c+"?"+(new Date).getMilliseconds()),a.$val("__jsmoldata__",e),a.$val("__jsmolfilename__",b),a.$val("__jsmolmimetype__",d),a.$val("__jsmolencoding__",f),a.$submit("__jsmolform__"),a.$val("__jsmoldata__",""),a.$val("__jsmolfilename__",""));return"OK"};a._strToBytes=function(b){if(Clazz.instanceOf(b,self.ArrayBuffer))return a._toBytes(b);for(var e=Clazz.newByteArray(b.length,0),d=b.length;0<=--d;)e[d]=b.charCodeAt(d)&255;return e};a._setConsoleDiv=
function(b){self.Clazz&&Clazz.setConsoleDiv(b)};a._registerApplet=function(b,e){return window[b]=a._applets[b]=a._applets[e]=a._applets[b+"__"+a._syncId+"__"]=e};a._readyCallback=function(b,e,d,f){b=b.split("_object")[0];d=d.booleanValue?d.booleanValue():d;a._track(a._applets[b])._readyCallback(b,e,d,f)};a._getWrapper=function(b,e){var d;if(e){var f="";b._coverImage&&(f=' onclick="Jmol.coverApplet(ID, false)" title="'+b._coverTitle+'"',d='<image id="ID_coverclickgo" src="'+b._j2sPath+'/img/play_make_live.jpg" style="width:25px;height:25px;position:absolute;bottom:10px;left:10px;z-index:'+
a._getZ(b,"coverImage")+';opacity:0.5;"'+f+" />",f='<div id="ID_coverdiv" style="background-color:red;z-index:'+a._getZ(b,"coverImage")+';width:100%;height:100%;display:inline;position:absolute;top:0px;left:0px"><image id="ID_coverimage" src="'+b._coverImage+'" style="width:100%;height:100%"'+f+"/>"+d+"</div>");d=a._appletCssText.replace(/\'/g,'"');d=0<=d.indexOf('style="')?d.split('style="')[1]:'" '+d;d='...<div id="ID_appletinfotablediv" style="width:Wpx;height:Hpx;position:relative;font-size:14px;text-align:left">IMG......<div id="ID_appletdiv" style="z-index:'+
a._getZ(b,"header")+";width:100%;height:100%;position:absolute;top:0px;left:0px;"+d+">";var c=b._height,g=b._width;if("string"!==typeof c||0>c.indexOf("%"))c+="px";if("string"!==typeof g||0>g.indexOf("%"))g+="px";d=d.replace(/IMG/,f).replace(/Hpx/g,c).replace(/Wpx/g,g)}else d='......</div>......<div id="ID_2dappletdiv" style="position:absolute;width:100%;height:100%;overflow:hidden;display:none"></div>......<div id="ID_infotablediv" style="width:100%;height:100%;position:absolute;top:0px;left:0px">.........<div id="ID_infoheaderdiv" style="height:20px;width:100%;background:yellow;display:none"><span id="ID_infoheaderspan"></span><span id="ID_infocheckboxspan" style="position:absolute;text-align:right;right:1px;"><a href="javascript:Jmol.showInfo(ID,false)">[x]</a></span></div>.........<div id="ID_infodiv" style="position:absolute;top:20px;bottom:0px;width:100%;height:100%;overflow:auto"></div>......</div>...</div>';
return d.replace(/\.\.\./g,"").replace(/[\n\r]/g,"").replace(/ID/g,b._id)};a._documentWrite=function(b){if(a._document){if(a._isXHTML&&!a._XhtmlElement){var e=document.getElementsByTagName("script");a._XhtmlElement=e.item(e.length-1);a._XhtmlAppendChild=!1}a._XhtmlElement?a._domWrite(b):a._document.write(b)}return b};a._domWrite=function(b){for(var e=[0];e[0]<b.length;){var d=a._getDomElement(b,e);if(!d)break;a._XhtmlAppendChild?a._XhtmlElement.appendChild(d):a._XhtmlElement.parentNode.insertBefore(d,
_jmol.XhtmlElement)}};a._getDomElement=function(b,a){var d=document.createElement("span");d.innerHTML=b;a[0]=b.length;return d};a._setObject=function(b,e,d){b._id=e;b.__Info={};d.z&&d.zIndexBase&&(a._z=a._getZOrders(d.zIndexBase));for(var f in d)b.__Info[f]=d[f];(b._z=d.z)||d.zIndexBase&&(b._z=b.__Info.z=a._getZOrders(d.zIndexBase));b._width=d.width;b._height=d.height;b._noscript=!b._isJava&&d.noscript;b._console=d.console;b._cacheFiles=!!d.cacheFiles;b._viewSet=null==d.viewSet||b._isJava?null:"Set"+
d.viewSet;null!=b._viewSet&&(a.View.__init(b),b._currentView=null);!a._fileCache&&b._cacheFiles&&(a._fileCache={});b._console||(b._console=b._id+"_infodiv");"none"==b._console&&(b._console=null);b._color=d.color?d.color.replace(/0x/,"#"):"#FFFFFF";b._disableInitialConsole=d.disableInitialConsole;b._noMonitor=d.disableJ2SLoadMonitor;a._j2sPath&&(d.j2sPath=a._j2sPath);b._j2sPath=d.j2sPath;b._coverImage=d.coverImage;b._isCovered=!!b._coverImage;b._deferApplet=d.deferApplet||b._isCovered&&b._isJava;b._deferUncover=
d.deferUncover&&!b._isJava;b._coverScript=d.coverScript;b._coverTitle=d.coverTitle;b._coverTitle||(b._coverTitle=b._deferApplet?"activate 3D model":"3D model is loading...");b._containerWidth=b._width+(b._width==parseFloat(b._width)?"px":"");b._containerHeight=b._height+(b._height==parseFloat(b._height)?"px":"");b._info="";b._infoHeader=b._jmolType+' "'+b._id+'"';b._hasOptions=d.addSelectionOptions;b._defaultModel=d.defaultModel;b._readyScript=d.script?d.script:"";b._readyFunction=d.readyFunction;
b._coverImage&&!b._deferApplet&&(b._readyScript+=";javascript "+e+"._displayCoverImage(false)");b._src=d.src};a._addDefaultInfo=function(b,e){for(var d in e)"undefined"==typeof b[d]&&(b[d]=e[d]);a._use&&(b.use=a._use);0<=b.use.indexOf("SIGNED")&&(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 e=0,d=0;d<a._syncedApplets.length;d++){if(a._syncedApplets[d]==b._id)a._syncedApplets[d]=b,a._syncedReady[d]=1;else if(!a._syncedReady[d])continue;e++}e==a._syncedApplets.length&&a._setSyncReady()};a._setDestroy=function(b){a.featureDetection.allowDestroy&&a.$windowOn("beforeunload",function(){a._destroy(b)})};a._destroy=function(b){try{b._applet&&b._applet.destroy();b._applet=null;a._unsetMouse(b._canvas);b._canvas=null;for(var e=0,d=0;d<a._syncedApplets.length;d++)a._syncedApplets[d]==
b&&(a._syncedApplets[d]=null),a._syncedApplets[d]&&e++;0<e||a._clearVars()}catch(f){}};a._setSyncReady=function(){a._syncReady=!0;for(var b="",e=0;e<a._syncedApplets.length;e++)a._syncedCommands[e]&&(b+="Jmol.script(Jmol._syncedApplets["+e+"], Jmol._syncedCommands["+e+"]);");setTimeout(b,50)};a._mySyncCallback=function(b,e){app=a._applets[b];if(app._viewSet)a.View.updateFromSync(app,e);else{if(!a._syncReady||!a._isJmolJSVSync)return 1;for(var d=0;d<a._syncedApplets.length;d++)0<=e.indexOf(a._syncedApplets[d]._syncKeyword)&&
a._syncedApplets[d]._syncScript(e);return 0}};a._getElement=function(b,a){return document.getElementById(b._id+"_"+a)||{}};a._evalJSON=function(b,a){b+="";if(!b)return[];if("{"!=b.charAt(0))return 0<=b.indexOf(" | ")&&(b=b.replace(/\ \|\ /g,"\n")),b;var d=(new Function("return "+b))();return!d?null:a&&void 0!=d[a]?d[a]:d};a._sortMessages=function(b){function a(b,e){return b[0]<e[0]?1:b[0]>e[0]?-1:0}if(!b||"object"!=typeof b)return[];for(var d=[],f=b.length-1;0<=f;f--)for(var c=0,g=b[f].length;c<g;c++)d[d.length]=
b[f][c];if(0!=d.length)return d=d.sort(a)};a._setMouseOwner=function(b,e){null==b||e?a._mouseOwner=b:a._mouseOwner==b&&(a._mouseOwner=null)};a._jsGetMouseModifiers=function(b){var a=0;switch(b.button){case 0:a=16;break;case 1:a=8;break;case 2:a=4}b.shiftKey&&(a+=1);b.altKey&&(a+=8);b.ctrlKey&&(a+=2);return a};a._jsGetXY=function(b,e){if(!b.applet._ready||a._touching&&0>e.type.indexOf("touch"))return!1;e.preventDefault();var d=a.$offset(b.id),f,c=e.originalEvent;e.pageX||(e.pageX=c.pageX);e.pageY||
(e.pageY=c.pageY);a._mousePageX=e.pageX;a._mousePageY=e.pageY;c.targetTouches&&c.targetTouches[0]?(f=c.targetTouches[0].pageX-d.left,d=c.targetTouches[0].pageY-d.top):c.changedTouches?(f=c.changedTouches[0].pageX-d.left,d=c.changedTouches[0].pageY-d.top):(f=e.pageX-d.left,d=e.pageY-d.top);return void 0==f?null:[Math.round(f),Math.round(d),a._jsGetMouseModifiers(e)]};a._gestureUpdate=function(b,e){e.stopPropagation();e.preventDefault();var d=e.originalEvent;switch(e.type){case "touchstart":a._touching=
!0;break;case "touchend":a._touching=!1}if(!d.touches||2!=d.touches.length)return!1;switch(e.type){case "touchstart":b._touches=[[],[]];break;case "touchmove":var f=a.$offset(b.id),c=b._touches[0],g=b._touches[1];c.push([d.touches[0].pageX-f.left,d.touches[0].pageY-f.top]);g.push([d.touches[1].pageX-f.left,d.touches[1].pageY-f.top]);d=c.length;3<d&&(c.shift(),g.shift());2<=d&&b.applet._processGesture(b._touches)}return!0};a._jsSetMouse=function(b){a.$bind(b,"mousedown touchstart",function(e){a._setMouseOwner(b,
!0);e.stopPropagation();e.preventDefault();b.isDragging=!0;if("touchstart"==e.type&&a._gestureUpdate(b,e))return!1;a._setConsoleDiv(b.applet._console);var f=a._jsGetXY(b,e);if(!f)return!1;2!=e.button&&a.Swing.hideMenus(b.applet);b.applet._processEvent(501,f);return!1});a.$bind(b,"mouseup touchend",function(e){a._setMouseOwner(null);e.stopPropagation();e.preventDefault();b.isDragging=!1;if("touchend"==e.type&&a._gestureUpdate(b,e))return!1;e=a._jsGetXY(b,e);if(!e)return!1;b.applet._processEvent(502,
e);return!1});a.$bind(b,"mousemove touchmove",function(e){return a._mouseOwner&&a._mouseOwner!=b&&a._mouseOwner.isDragging?(a._mouseOwner.mouseMove(e),!1):a._drag(b,e)});a._drag=function(b,f){f.stopPropagation();f.preventDefault();if("touchmove"==f.type&&a._gestureUpdate(b,f))return!1;var c=a._jsGetXY(b,f);if(!c)return!1;b.isDragging||(c[2]=0);b.applet._processEvent(b.isDragging?506:503,c);return!1};a.$bind(b,"DOMMouseScroll mousewheel",function(e){e.stopPropagation();e.preventDefault();b.isDragging=
!1;var f=e.originalEvent,f=f.detail?f.detail:("mac"==a.featureDetection.os?1:-1)*f.wheelDelta;e=a._jsGetMouseModifiers(e);b.applet._processEvent(-1,[0>f?-1:1,0,e]);return!1});a.$bind(b,"contextmenu",function(){return!1});a.$bind(b,"mouseout",function(e){b.applet._applet&&b.applet._applet.startHoverWatcher(!1);a._jsGetXY(b,e);return!1});a.$bind(b,"mouseenter",function(e){b.applet._applet&&b.applet._applet.startHoverWatcher(!0);if(0===e.buttons||0===e.which){b.isDragging=!1;e=a._jsGetXY(b,e);if(!e)return!1;
b.applet._processEvent(504,e);b.applet._processEvent(502,e);return!1}});a.$bind(b,"mousemoveoutjsmol",function(e,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,e){f.mouseMove(e)});this.container.bind("mouseupoutjsmol touchendoutjsmol",function(b,a,e){f.mouseUp(e)})}})};k.JSDialog=function(){};k.setDraggable(k.JSDialog);k.getScreenDimensions=function(b){b.width=h(window).width();b.height=h(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 f=b.id+"_mover",d=a._$(f),c;d[0]?(d.html(b.html),c=d[0].jd):(a.$after("body","<div id='"+f+"' style='position:absolute;left:0px;top:0px;'>"+b.html+"</div>"),c=new k.JSDialog,d=a._$(f),b.container=d,c.applet=b.manager.vwr.html5Applet,c.setContainer(d),c.dialog=b,c.setPosition(),c.dragBind(!0),d[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,f){var d=k.htDialogs[b.id];if(d){var c=d.toString();if(0<=c.indexOf("JCheck"))d.selected=b.checked;else if(0<=c.indexOf("JCombo"))d.selectedIndex=b.selectedIndex;else if(null!=d.text&&(d.text=b.value,f&&13!=(f.charCode||
f.keyCode)))return}c=k.htDialogs[a.$getAncestorDiv(b.id,"JDialog").id];c.manager.actionPerformed(d?d.name:c.registryKey+"/"+b.id)};k.setFront=function(b){var f=b.manager.vwr.html5Applet;b.zIndex!=a._getZ(f,"dialog")&&(b.zIndex=a._incrZ(f,"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='<iframe style="display:none" width="0" height="0" frameborder="0" tabindex="-1" src="'+(a._tracker+"&applet="+b._jmolType+"&version="+a._version+"&appver="+a.___JmolVersion+"&url="+encodeURIComponent(document.location.href))+'"></iframe>';a.$after("body",f)}catch(d){}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,d){if(null!=f._viewSet){d.chemID||(f._searchQuery=null);d.data||(d.data="N/A");d.type=f._viewType;if(null==(f._currentView=b.__findView(f._viewSet,d)))f._currentView=b.__createViewSet(f._viewSet,d.chemID,
d.viewID||d.chemID);f._currentView[d.type].data=d.data;f._currentView[d.type].smiles=f._getSmiles();a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateView");b.__setView(f._currentView,f,!1)}};b.updateFromSync=function(f,d){f._updateMsg=d;var c=a._getAttr(d,"sourceID")||a._getAttr(d,"file");if(c){var g=b.__findView(f._viewSet,{viewID:c});if(null==g)return a.updateView(f,d);g!=f._currentView&&b.__setView(g,f,!0);var j=(c=a._getAttr(d,"atoms"))&&0<=d.indexOf("selectionhalos ON")?eval("["+
c+"]"):[];setTimeout(function(){f._currentView==g&&b.updateAtomPick(f,j)},10);a.User.viewUpdatedCallback&&a.User.viewUpdatedCallback(f,"updateFromSync")}};b.updateAtomPick=function(b,f){var c=b._currentView;if(null!=c){for(var g in c)"info"!=g&&c[g].applet!=b&&c[g].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 g in a)c+="\napplet "+a[g]._id+" currentView="+
(a[g]._currentView?a[g]._currentView.info.viewID:null);for(g=f.length;0<=--g;){a=f[g];var c=c+("\n\n<b>view="+g+" viewID="+a.info.viewID+" chemID="+a.info.chemID+"</b>\n"),j,h;for(h in a)"info"!=h&&(c+="\nview="+g+" type="+h+" applet="+((j=a[h]).applet?j.applet._id:null)+" SMILES="+j.smiles+"\n atomMap="+JSON.stringify(j.atomMap)+"\n data=\n"+j.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 g=c.length;0<=--g;){var j=c[g];if(f.viewID){if(j.info.viewID==f.viewID)return j}else{if(null!=f.chemID&&f.chemID==j.info.chemID)return j;for(var h in j)if("info"!=h&&(null!=f.data&&null!=j[h].data?f.data==j[h].data:f.type==h))return j}}return null};b.__createViewSet=function(f,c,g){b.count++;c={info:{chemID:c,viewID:g||"model_"+b.count}};for(var j in a._applets)g=a._applets[j],g._viewSet==f&&(c[g._viewType]={applet:g,data:null});b.sets[f].push(c);return c};b.__setView=
function(b,a,f){for(var c in b)if("info"!=c){var g=b[c],j=g.applet,h=f||null!=j&&"<modified>"==j._molData;if(!(null==j||j==a&&!h)){var l=null==g.data,k=null!=j._currentView;j._currentView=b;if(!k||!(b[c].data==g.data&&!l&!h))if(j._loadModelFromView(b),l)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){var c=f.originalEvent;c.stopPropagation();c.preventDefault();var g=c.dataTransfer.files[0];if(null==g)try{g=""+c.dataTransfer.getData("text"),(0==g.indexOf("file:/")||0==g.indexOf("http:/"))&&b._scriptLoad(g)}catch(j){}else c=new FileReader,c.onloadend=function(c){if(c.target.readyState==FileReader.DONE){var d="cache://DROP_"+g.name;c=a._toBytes(c.target.result);d.endsWith(".spt")||b._applet.cacheFileByName("cache://DROP_*",
!1);"JSV"==b._viewType||d.endsWith(".jdx")?a.Cache.put(d,c):b._applet.cachePut(d,c);(c=a._jsGetXY(b._canvas,f))&&(!b._applet.setStatusDragDropped||b._applet.setStatusDragDropped(0,c[0],c[1],d))&&b._applet.openFileAsyncSpecial(d,1)}},c.readAsArrayBuffer(g)})}})(Jmol,jQuery);Jmol._debugCode=!1;Jmol._grabberOptions=[["$","NCI(small molecules)"],[":","PubChem(small molecules)"]];Jmol.say=function(a){alert(a)};
Jmol._TMApplet=function(a,h,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,h);return this};
Jmol._TMApplet._getApplet=function(a,h,f){if(!Jmol.featureDetection.allowHTML5)return null;f||(f=!1);h||(h={});Jmol._addDefaultInfo(h,{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});h=new Jmol._TMApplet(a,h,
f);return f?h:Jmol._registerApplet(a,h)};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 h=a.prototype;h.spin=function(a){this.__Info.spin=a;this._spin(a)};h._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)}};h._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()};h._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()};h._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)};h._createCanvas=function(a,c){Jmol._setObject(this,a,c);this._color=this._color.replace(/0x/,"#");var g=Jmol._getWrapper(this,!0);Jmol._document?(Jmol._documentWrite(g),this._createCanvas2d(!1),g=""):g+='<script type="text/javascript">'+
a+"._createCanvas2d(false)\x3c/script>";g+=Jmol._getWrapper(this,!1);c.addSelectionOptions&&(g+=Jmol._getGrabberOptions(this,""));Jmol._debugAlert&&!Jmol._document&&alert(g);this._code=Jmol._documentWrite(g)};h._readyCallback=function(a,c,g,j){g&&(Jmol._setDestroy(this),this._ready=!0,a=this._readyScript,this._applet=j,this._defaultModel?this._search(this._defaultModel,a?";"+a:""):this._src&&this._loadFile(this._src),this._showInfo(!0),this._showInfo(!1),this._readyFunction&&this._readyFunction(this),
Jmol._setReady(this))};h._createCanvas2d=function(a){var c=document.createElement("canvas"),g=Jmol.$(this,"appletdiv");a&&(g[0].removeChild(this._canvas),Jmol._jsUnsetMouse(this._canvas));a=Math.round(g.width());var j=Math.round(g.height());c.applet=this;this._canvas=c;c.style.width="100%";c.style.height="100%";c.width=a;c.height=j;c.id=this._id+"_canvas2d";g.append(c);setTimeout(this._id+"._start()",10)};h._start=function(){Jmol._jsSetMouse(this._canvas);this._defaultModel?Jmol._search(this,this._defaultModel):
this._src&&this._loadFile(this._src);this._showInfo(!0);this._showInfo(!1)};h._search=function(a,c){Jmol._search(this,a,c)};h._searchDatabase=function(a,c,g){this._showInfo(!1);0<=a.indexOf("?")?Jmol._getInfoFromDatabase(this,c,a.split("?")[0]):this._loadFile(c+a,g)};h.__loadModel=function(a){this._spin(!1);"''"==a&&(a=this._mol);a?(this._parse(a),this._initParams(),this._draw(),this._showInfo(!1),this.doSpin&&this._spin(!0)):alert("No model data.")};h._showInfo=function(a){Jmol.$html(Jmol.$(this,
"infoheaderspan"),this._infoHeader);this._info&&Jmol.$html(Jmol.$(this,"infodiv"),this._info);!this._isInfoVisible!=!a&&(this._isInfoVisible=a,Jmol.$setVisible(Jmol.$(this,"infotablediv"),a),Jmol.$setVisible(Jmol.$(this,"infoheaderdiv"),a),this._show(!a))};h._show=function(a){Jmol.$setVisible(Jmol.$(this,"appletdiv"),a);a&&this._draw()};h._resize=function(){var a="__resizeTimeout_"+this._id;Jmol[a]&&clearTimeout(Jmol[a]);var c=this;Jmol[a]=setTimeout(function(){c._draw();Jmol[a]=null},100)};h._canScript=
function(){return!1};h._loadFile=function(a){this._showInfo(!1);this._thisJmolModel=a;var c=this;Jmol._loadFileData(this,a,function(a){c.__loadModel(a)})};h._processEvent=function(a,c){switch(a){case 502:case 503:this._mouseDown=!1;default:return;case 501:this._mouseX=c[0];this._mouseY=c[1];this._mouseDown=!0;return;case 506:var g=c[0]-this._mouseX,j=c[1]-this._mouseY,g=0>g?-1:0<g?1:0,j=0>j?-1:0<j?1:0;switch(c[2]){case 17:this._zoomBy(j);break;case 24:this.center2D[0]+=g;this.center2D[1]+=j;break;
default:this._rotate(g,j)}this._mouseX=c[0];this._mouseY=c[1];break;case -1:this._zoomBy(c[1])}this._draw()};h._processGesture=function(f){if(!(2>f[0].length)){var c=f[0],g=f[1],j=c[0],h=c[g.length-1];f=j[0];var k=h[0],j=j[1],h=h[1],b=[k-f,h-j,0],e=a._length(b),d=g[0],m=g[g.length-1],g=d[0],q=m[0],d=d[1],m=m[1],p=[q-g,m-d,0],r=a._length(p);3>e||3>r||(a._scale(b,1/e),a._scale(p,1/r),b=a._dot(b,p),0.8<b?(f=Math.round(k-c[c.length-2][0]),c=Math.round(h-c[c.length-2][1]),this.center2D[0]+=f,this.center2D[1]+=
c):-0.8>b&&(b=[g-f,d-j,0],p=[q-k,m-h,0],c=a._length(p)-a._length(b),this.zoom+=(0>c?-1:1)*this.pinchScaling),this._draw())}};h._zoomBy=function(a){this.zoom+=a*this.zoomScaling;5>this.zoom&&(this.zoom=5);500<this.zoom&&(this.zoom=500)};h._getRotationScaling=function(){return[1/Math.max(this._canvas.width,500)*this.mouseDragFactor*a.deg_per_radian,1/Math.max(this._canvas.height,500)*this.mouseDragFactor*a.deg_per_radian]};h._rotate=function(f,c){var g=this._getRotationScaling();c&&(a._m3.rotX(c*g[1]),
this.rotation.mul(a._m3));f&&(a._m3.rotY(f*g[0]),this.rotation.mul(a._m3))};h._getCenterAndRadius=function(){Math.min(this._canvas.width,this._canvas.height);for(var f=[999999,999999,999999],c=[-999999,-999999,-999999],g=this.atoms.length;0<=--g;)for(var j=3;0<=--j;){var h=this.atoms[g].xyz[j];h<f[j]&&(f[j]=h);h>c[j]&&(c[j]=h)}h=[0,0,0];for(j=3;0<=--j;)h[j]=(c[j]+f[j])/2;f=0;for(g=this.atoms.length;0<=--g;)c=this.atoms[g],c=a._distance(c.xyz,h)+(1==c.elemNo?1:1.5),c>f&&(f=c);this.center=h;this.modelRadius=
0==f?10:f};h._setScreenCoords=function(){for(var a=this.center,c=this.rotation,g=this.center2D,j=Math.min(this._canvas.width,this._canvas.height)/2/this.modelRadius*this.zoom/100,h=this.atoms.length;0<=--h;){var k=this.atoms[h];this._transform(k.xyz,k.sxyz,a,c,j,g);k.srad=j*k.radius}for(h=this.bonds.length;0<=--h;)k=this.bonds[h],this._transform(k.xyz,k.sxyz,a,c,j,g),this._transform(k.pts[0],k.spts[0],a,c,j,g),this._transform(k.pts[1],k.spts[1],a,c,j,g)};h._transform=function(f,c,g,j,h,k){for(var b=
a._temp1,e=a._temp2,d=3;0<=--d;)b[d]=(f[d]-g[d])*h;j.transform(b,e);e[1]=-e[1];e[2]=-e[2];for(d=3;0<=--d;)c[d]=e[d]+k[d]};h._parse=function(a){this._parseSDF(a)};h._parseSDF=function(f){this._mol=f;if(!a._elemNo.H)for(var c=a._elem.length;0<=--c;)a._elemNo[a._elem[c]]=c;f=f.split("\n");var g=3,j=f[g++];this.nAtoms=parseFloat(j.substring(0,3));this.nBonds=parseFloat(j.substring(3,6));this.atoms=Array(this.nAtoms);this.bonds=Array(this.nBonds);this.elements=Array(this.nAtoms+this.nBonds);for(var h=
0,k,b,e,c=0;c<this.nAtoms;c++){j=f[g++];k=parseFloat(j.substring(0,10));b=parseFloat(j.substring(10,20));e=parseFloat(j.substring(20,30));var j=j.substring(31,34).replace(/\s+/g,""),j=a._elemNo[j]||0,d=1==j?0.23:0.35,m=a._CPK[j]||a._CPK[0];this.elements[h++]=this.atoms[c]={type:0,elemNo:j,xyz:[k,b,e],sxyz:[0,0,0],radius:d,color:m,color50:m}}for(c=0;c<this.nBonds;c++){j=f[g++];k=this.atoms[parseFloat(j.substring(0,3))-1];b=this.atoms[parseFloat(j.substring(3,6))-1];e=Math.abs(parseFloat(j.substring(6,
9)));switch(e){case 4:case 5:case 6:case 8:e=1;break;case 7:e=2}j=a._getPointAlong(k.xyz,b.xyz,0.5);m=a._distance(k.xyz,j);d=k.radius<m?a._getPointAlong(k.xyz,j,k.radius/m):[0,0,99999];m=b.radius<m?a._getPointAlong(b.xyz,j,b.radius/m):[0,0,99999];this.elements[h++]=this.bonds[c]={type:1,atoms:[k,b],xyz:j,pts:[d,m],sxyz:[0,0,0],spts:[[0,0,0],[0,0,0]],order:e,color:0}}};h._getColor=function(a,c){"#FFFFFF"==a&&(a="#D0D0D0");var g=parseInt("0x"+a.substring(1),16),j=g>>16&255,h=g>>8&255,g=g&255;255!=j&&
(j+=Math.floor((255-j)*c));255!=h&&(h+=Math.floor((255-h)*c));255!=g&&(g+=Math.floor((255-g)*c));j="000000"+(j<<16|h<<8|g).toString(16);return"#"+j.substring(j.length-6,j.length)};h._draw=function(){if(this.atoms){this._setParams();this._setScreenCoords();var f=this.elements;f.sort(a._zorder);var c=this._canvas.getContext("2d");c.fillStyle=this._color;c.fillRect(0,0,this._canvas.width,this._canvas.height);for(var g=f.length;0<=--g;){var h=f[g];0==h.type?this._drawAtom(c,h):this._drawBond(c,h)}}};
h._drawAtom=function(f,c){f.beginPath();if(this.shadeAtoms){var g=c.srad/4,g=f.createRadialGradient(c.sxyz[0]-g,c.sxyz[1]-g,g,c.sxyz[0],c.sxyz[1],c.srad);g.addColorStop(0,c.color50);g.addColorStop(1,"#FFFFFF"==c.color?"#D0D0D0":c.color);f.fillStyle=g;f.arc(c.sxyz[0],c.sxyz[1],c.srad,0,a._pi2);f.fill()}else f.fillStyle=c.color,f.arc(c.sxyz[0],c.sxyz[1],c.srad,0,a._pi2),f.fill(),f.strokeStyle="#000000",f.lineWidth=1,f.stroke()};h._drawBond=function(a,c){99999!=c.pts[0][2]&&this._drawBondLines(a,c,c.spts[0],
c.atoms[0].color);99999!=c.pts[1][2]&&this._drawBondLines(a,c,c.spts[1],c.atoms[1].color)};h._drawBondLines=function(f,c,g,h){var l=a._temp;l.width=this.bondWidth;l.color=c.color?c.color:h;if(1==c.order)l.pt1=g,l.pt2=c.sxyz,this._drawLine(f,l);else{l.pt1=a._temp1;l.pt2=a._temp2;l.pta=g;l.ptb=c.sxyz;l.dx=l.ptb[0]-l.pta[0];l.dy=l.ptb[1]-l.pta[1];l.mag2d=Math.round(Math.sqrt(l.dx*l.dx+l.dy*l.dy));l.bondOrder=c.order;for(this._resetAxisCoordinates(l);0<l.bondOrder;)this._drawLine(f,l),l.bondOrder--,this._stepAxisCoordinates(l)}};
h._drawLine=function(a,c){a.beginPath();a.strokeStyle=c.color;a.moveTo(c.pt1[0],c.pt1[1]);a.lineTo(c.pt2[0],c.pt2[1]);a.lineWidth=c.width;a.stroke()};h._resetAxisCoordinates=function(a){var c=a.mag2d>>3;1!=this.multipleBondSpacing&&(c*=this.multipleBondSpacing);c=a.width+c;a.dxStep=Math.round(c*a.dy/a.mag2d);a.dyStep=Math.round(c*-a.dx/a.mag2d);a.pt1[0]=a.pta[0];a.pt1[1]=a.pta[1];a.pt2[0]=a.ptb[0];a.pt2[1]=a.ptb[1];c=a.bondOrder-1;a.pt1[0]-=Math.round(a.dxStep*c/2);a.pt1[1]-=Math.round(a.dyStep*c/
2);a.pt2[0]-=Math.round(a.dxStep*c/2);a.pt2[1]-=Math.round(a.dyStep*c/2)};h._stepAxisCoordinates=function(a){a.pt1[0]+=a.dxStep;a.pt1[1]+=a.dyStep;a.pt2[0]+=a.dxStep;a.pt2[1]+=a.dyStep};a._distance=function(a,c){for(var g=0,h=3;0<=--h;)var l=a[h]-c[h],g=g+l*l;return Math.sqrt(g)};a._dot=function(a,c){for(var g=0,h=3;0<=--h;)g+=a[h]*c[h];return g};a._setPt=function(a,c){for(var g=3;0<=--g;)c[g]=a[g];return c};a._scale=function(a,c){for(var g=3;0<=--g;)a[g]*=c};a._length=function(a){for(var c=0,g=3;0<=
--g;)c+=a[g]*a[g];return Math.sqrt(c)};a._getPointAlong=function(a,c,g){return[(c[0]-a[0])*g+a[0],(c[1]-a[1])*g+a[1],(c[2]-a[2])*g+a[2]]};a._zorder=function(a,c){var g=a.sxyz[2],h=c.sxyz[2];return g<h?-1:g>h?1:0};a.M3=function(){this.m00=1;this.m10=this.m02=this.m01=0;this.m11=1;this.m21=this.m20=this.m12=0;this.m22=1};a.M3.prototype.set=function(a,c,g,h,l,k,b,e,d){this.m00=a;this.m01=c;this.m02=g;this.m10=h;this.m11=l;this.m12=k;this.m20=b;this.m21=e;this.m22=d};a.M3.prototype.transform=function(a,
c){c[0]=this.m00*a[0]+this.m01*a[1]+this.m02*a[2];c[1]=this.m10*a[0]+this.m11*a[1]+this.m12*a[2];c[2]=this.m20*a[0]+this.m21*a[1]+this.m22*a[2]};a.M3.prototype.rotX=function(a){var c=Math.cos(a);a=Math.sin(a);this.m00=1;this.m10=this.m02=this.m01=0;this.m11=c;this.m12=-a;this.m20=0;this.m21=a;this.m22=c};a.M3.prototype.rotY=function(a){var c=Math.cos(a);a=Math.sin(a);this.m00=c;this.m01=0;this.m02=a;this.m10=0;this.m11=1;this.m12=0;this.m20=-a;this.m21=0;this.m22=c};a.M3.prototype.mul=function(a){this.set(a.m00*
this.m00+a.m01*this.m10+a.m02*this.m20,a.m00*this.m01+a.m01*this.m11+a.m02*this.m21,a.m00*this.m02+a.m01*this.m12+a.m02*this.m22,a.m10*this.m00+a.m11*this.m10+a.m12*this.m20,a.m10*this.m01+a.m11*this.m11+a.m12*this.m21,a.m10*this.m02+a.m11*this.m12+a.m12*this.m22,a.m20*this.m00+a.m21*this.m10+a.m22*this.m20,a.m20*this.m01+a.m21*this.m11+a.m22*this.m21,a.m20*this.m02+a.m21*this.m12+a.m22*this.m22)};a._pi2=2*Math.PI;a.deg_per_radian=180/Math.PI;a._z3=[0,0,0];a._temp1=[0,0,0];a._temp2=[0,0,0];a._temp=
{};a._m3=new a.M3})(Jmol._TMApplet);
