itesttime=false&&true//928 structures: IE 9.9 sec, Opera7.52 2.8 sec, NN7.1 2.5 sec
isdebug=true&&false
loadtime0=new Date()
miniversion=false

thetitle="<b><a href=index.htm target=_top>CoolMolecules</a>: A Molecular Structure Explorer</b>"
thenote="All of the NSTRUC structures in <b>LEVEL</b> are actual, experimentally- determined structures. They are displayed TO SCALE (100 pm = 1 cm on my screen). You can rotate them around to see them from different angles, and you can double click on them to check bond lengths and angles right on the model itself. If the model doesn't display, you may need to install the <a target=_blank href=http://www.java.com>java plug-in</a> (very quick).<br><a href=http://www.stolaf.edu/people/hansonr/ target=_blank>Bob Hanson</a>, <b>Melanie Casavant</b>, <b>Michael McGuan</b> (St. Olaf College), <a href=http://www.chem.wsu.edu/Faculty/wherland.html target=_blank>Scot Wherland</a> (Washington State University)."


/*

startup options include "level=", "by=", "search=", "text=", "method=", "shape="
 ?level=cool&by=text&search=water
 ?level=entry&by=bonds&search=C-H
 ?list=<filename>,<filename>,....
 ?by=text&search=DEZYUC&view=1
*/

onetimemessage="See <a href=\"http://www.stolaf.edu/depts/chemistry/mo/struc\" target=_top>http://www.stolaf.edu/depts/chemistry/mo/struc</a> for more information about this database."
+"<br>Teachers: See <a href=topics/index.htm target=_blank>the topics page</a> to get ideas for how to use this in class."
+"<br> page last updated: 4/28/2006"
+"<p>Please report all problems to <a href=mailto:hansonr@stolaf.edu>Bob</a>. <p>Thanks."

//must be top document

if(top==self)location="index.htm"

Level=new Array()
Level["entry"]=["entry level","nolevel2shapes=true;nolevel3shapes=true;nometals=true;mustbe1strowcenter=true;onlysmallmolecules=true","the subset of the database containing a sampling of just the simplest of geometries"]
Level["expanded"]=["expanded valence","nolevel3shapes=true;nometals=true","the subset of the database containing standard geometries for nonmetals"]
Level["metals"]=["include metals","nolevel3shapes=true","the subset of the database including metals but not the most complex geometries"]
Level["cponly"]=["pi complexes","cpshapesonly=true","the subset of the database with electrocyclic [4n+2] ligands"]
Level["cool"]=["cool shapes","nolevel1shapes=true;nolevel2shapes=true;nocp=true","the subset of the database with just the most complex geometries"]
Level["full"]=["full database","","the full database"]

LEVEL1SHAPES="diatomic,linear,bent,trigonal planar,trigonal pyramidal,tetrahedral"
LEVEL2SHAPES="T-shaped,see-saw,square planar,trigonal bipyramidal,square pyramidal,octahedral"
Subsets=new Array()
 var n=10
 for(var i in Level){
	n++
	Subsets[n]=i
 }


//defaults

nolevel1shapes=false
nolevel2shapes=false
nolevel3shapes=false
cpshapesonly=false
nocp=false
nometals=false
mustbe1strowcenter=false
onlysmallmolecules=false

//search

docsearch=document.location.search+"&"
if(parent && parent.document)docsearch+="&"+parent.document.location.search+"&"
docsearch=docsearch.replace(/\?/g,"&")
if(docsearch.indexOf("noview")>=0)docsearch=docsearch.replace(/view/g,"noview")

function fieldof(sinfo,skey){
 var pt=sinfo.indexOf("&"+skey+"=")
 if(pt<0)return ""
 var s=sinfo.substring(pt+skey.length+2,sinfo.length)+"&"
 s=s.substring(0,s.indexOf("&")).replace(/\+/g," ")
 return unescape(s)
}

level=fieldof(docsearch+"&level=full&","level")
filelist=fieldof(docsearch,"list")
iloadview=parseInt(fieldof(docsearch,"view"))
if(Level[level] && Level[level][1]){
	eval(Level[level][1])
	isfullset=false
}else{
	isfullset=true
}


MAXDISPLAY=100
defaultscale3d=2.1
usealt=false
cleartime=0//1000	
vmag=1
longestbond=395
largesymbols=true
allowvibrations=true
idodetails=false
displayorder="bycenter"//or "byshape"

//directories

function bref(cmd,txt,sclass,id){
 return "<input id="+id+" type=button onfocus=this.blur() onclick="+cmd+" value=\""+txt+"\" class=btn"+sclass+">"
}

function href(ref,link){
 var s=Math.random()+""
 s=s.substring(3,10)
 return (link==""?ref:"<a target="+s+" href=\""+link+"\">"+ref+"</a>")
}

function jref(ref,link){
 return (link==""?ref:"<a href=\"javascript:"+link.replace(/\"/g,"'")+"\">"+ref+"</a>")
}

molserver=moserver="data/"
pdbserver="http://www.rcsb.org/pdb/explore/explore.do?structureId=CODE&"
nistserver="http://webbook.nist.gov/cgi/cbook.cgi?ID=CCODE"
ccdcref = href("CCDC","http://www.ccdc.cam.ac.uk/products/csd/")


greeksource="./"	//Name fixes
searchpage="&query="
shortnamesonly=true
maxsmallnamelength=50
showmolfilename=true
ilinkpdbfiles=true
ilinkmo=false //don't link to .mo files - just too weird.
usejmol=true

jmolscript="set frank off;background black;SCRIPT"
jmolscriptv=";vectors on;vibration on;rotate x 10;rotate y 10"
chimedefaults="width=400 height=400 display3d=ball&stick"
jmoldefaults="width=400 height=400 "

//positioning
//bwidth=150
//bwidth2=bwidth*.9
cellheight=30
dyoff=cellheight*8.8
resultplacetop=(dyoff+cellheight*5)
showplacetop=(dyoff+cellheight*7)
selectplacetop=(dyoff+cellheight*4)
graphplacetop=(dyoff+cellheight*4)
maxgraphbar=50
maxndist=98 //for histogram
pm_per_bin=5


//colors
nostruccolor="#000000"
backgroundcolor="#CCCCCC"
btncolor="#EEEEAA"
bodycolor="#D0D0D0"
row0color="#CCCCCC"
row1color="#BBBBBB"


x="";testing=false

function getstyles(){
	var s="<style>"
	s+="*{}"
	s+="a{cursor:pointer}"
	s+="#tableplace{position:absolute;left:10;top:0;z-index:10}"
	s+="#notableplace{position:absolute;left:10;top:0;visibility:hidden;z-index:1}"
	s+="#jmolplace{position:absolute;left:400;top:0;z-index:2}"
	s+="#infoplace{position:absolute;left:10;top:0;z-index:3}"
	s+="#resultplace{position:absolute;left:5;top:"+resultplacetop+";z-index:4}"
	s+="#showplace{position:absolute;left:5;top:"+showplacetop+";z-index:5}"
	s+="#selectplace{position:absolute;left:5;top:"+selectplacetop+";z-index:6}"
	s+="#graphplace{position:absolute;left:10;top:"+graphplacetop+";z-index:7}"
	s+="a,a.visited{text-decoration:none;color:blue}"
	s+="hover{font-size:14pt}"
	s+="td{font-size:"+(largesymbols?12:8)+"pt}"
	s+=".b{font-size:12pt}"
	s+=".btn0{font-size:10pt;width:120;height:25}"
	s+=".btn1,.btn2{font-size:10pt;width:80;height:25}"
	s+=".btn3{font-size:8pt;width:60;height:20}"
	s+="body{background-color:"+bodycolor+"}"
	s+="input {font-size:12pt;outline:none}"
	s+="td.c1 {background-color:"+row0color+";font-size:12pt}"
	s+="td.c0 {background-color:"+row1color+";font-size:12pt}"
	s+="td.cother {background-color:pink;font-size:12pt}"
	s+=".info{font-size:12pt}"
	s+="high,.high {color:darkred;font-weight:bold}"
	s+="</style>"
	PT.largesymbols=largesymbols
	s+=PTgetStyles(PT)
	return s
}

function writestyle(){
	var s=getstyles()
	document.write(s)
}writestyle()


function buttoncell(i,thisn,txt,title,iclass){
 var s="<td nowrap align=center id=b"+i+">"
//	+"<img id=ia"+i+" src=img/"+(i==thisn?"a":"t")+"1.gif>&nbsp;"
	+bref("parent.fraCode.docmd("+i+") title=\""+title+"\"",txt,iclass,"btn"+i)
	+helpref(i)
//	+"&nbsp;<img id=ib"+i+" src=img/"+(i==thisn?"b":"t")+"1.gif>"
	+"</td>"
 return s
}

function setpointer(n){
	var i=10
	if(n>i||isNaN(n)){
		for(var j in Level){
			i++
//			parent.fraNav.document.images["ia"+i].src="img/"+(n==i||n==j?"a1.gif":"t1.gif")
//			parent.fraNav.document.images["ib"+i].src="img/"+(n==i||n==j?"b1.gif":"t1.gif")
			parent.fraNav.document.getElementById("btn"+i).style.backgroundColor=(n==j||n==i?btncolor:bodycolor)
		}
		return
	}
	for(var i=1;i<Cmd.length;i++){
//		parent.fraIndex.document.images["ia"+i].src="img/"+(n==i?"a1.gif":"t1.gif")
//		parent.fraIndex.document.images["ib"+i].src="img/"+(n==i?"b1.gif":"t1.gif")
		parent.fraIndex.document.getElementById("btn"+i).style.backgroundColor=(n==i?btncolor:bodycolor)
	}
}

function helpref(i){
 return jref("<img src=img/q.gif border=0 title='click this icon for more information'>","parent.fraCode.dohelp("+i+")")
}

