function makePopupCalc(addr) {
		var wh = "width=" + screen.width * 0.5 + ",height=" + screen.height * 0.75;
		var cwin = window.open(addr, "calcwin", "status=0,toolbar=1,menubar=0,location=0,scrollbars=1,resizable=1," + wh);
		cwin.focus();
}

function makePopupPic(addr, xsize, ysize) {
		var wh = "width=" + (xsize + 20) + ",height=" + (ysize + 20);
		var pwin = window.open(addr, "picwin", "status=0,toolbar=1,menubar=0,location=0,scrollbars=1,resizeable=1," + wh);
		pwin.focus();
}

//Contents for menu 1
var toolsmenu=new Array()
toolsmenu[0]='<a href="/tools/gaussbeamcalc.html" onclick="makePopupCalc(\'/tools/gaussbeamcalc.html\'); return false;">Gaussian Beam Calculator</a>'
toolsmenu[1]='<a href="/tools/thermallight.html" onclick="makePopupCalc(\'/tools/thermallight.html\'); return false;">Thermal Beating Noise Calculator</a>'
toolsmenu[2]='<a href="/tools/fibernoisecalc.html" onclick="makePopupCalc(\'/tools/fibernoisecalc.html\'); return false;">Fiber Mode Noise Calculator</a>'
toolsmenu[3]='<a href="/tools/planck.php" onclick="makePopupCalc(\'/tools/planck.php\'); return false;">Planck\'s Blackbody Curve</a>'
toolsmenu[4]='<a href="http://www.lifsim.com/">LIFSim</a>'

var postersmenu=new Array()
postersmenu[0]='<a href="http://www.erc.wisc.edu/erc_projects/erc_posters/Multiengine%20poster.pdf">Broadband, high-resultion absorption spectroscopy in piston and gas turbine engines, shock tubes, and rocket plumes</a>'
postersmenu[1]='<a href="http://www.erc.wisc.edu/erc_projects/erc_posters/Kranendonk_Poster.pdf">Investigation of light load HCCl combustion based on measured temperature and OH concentrations</a>'
postersmenu[2]='<a href="http://www.erc.wisc.edu/erc_projects/erc_posters/Multispecies%20poster.pdf">Multispecies sensing with a single laser source in HCCl Combustion</a>'
postersmenu[3]='<a href="http://www.erc.wisc.edu/erc_projects/erc_posters/CW_c-FTS%20poster.pdf">New sensor design based on frequency comb Fourier transform spectroscopy for combustion studies</a>'
postersmenu[4]='<a href="http://www.erc.wisc.edu/erc_projects/posters%20june%202006/CHyP.pdf">Hyperspectral Photonics: an Overview</a>'

var whitepapersmenu=new Array()
whitepapersmenu[0]='<a href="/whitepapers/broad_high_speed_resolution_throughput_mid_infrared_spectrometer_STS_final.html">High-speed, high-resolution, high-throughput spectrometer</a>'
whitepapersmenu[1]='<a href="/whitepapers/high_temperature_gas_spectral_database_STS.html">A database of molecular spectra accurate to high temperatures and pressures</a>'
whitepapersmenu[2]='<a href="/whitepapers/spray_structure_imaging_STS.html">Optical imaging of near-nozzle spray structure</a>'
whitepapersmenu[3]='<a href="/whitepapers/high-resolution_UV_source_STS.html">Compact hyperspectral ultraviolet light source</a>'
whitepapersmenu[4]='<a href="/whitepapers/Final-combustion_device_emulator_STS.html">Development of a web-based &quot;computational combustion device&quot; for testing diagnostic strategies</a>'

var datamenu=new Array()
datamenu[0]='<a href="/data/theoretical_reflectance_curves_metals_RJB.png" onclick="makePopupPic(\'/data/theoretical_reflectance_curves_metals_RJB.png\', 781, 664); return false;">Theoretical reflectance spectra for metals</a>'

var linksmenu=new Array()
linksmenu[0]='<a href="http://www.erc.wisc.edu">ERC Homepage</a>'
linksmenu[1]='<a href="http://www.loci.wisc.edu">LOCI Homepage</a>'
linksmenu[2]='<a href="http://www.engr.wisc.edu/me/faculty/sanders_scott.html">Homepage of Scott Sanders</a>'
linksmenu[3]='<a href="http://infrared.als.lbl.gov/calculators/bb2001.html">Black body emission calculator</a>'
		
var menuwidth='165px' //default menu width
var menubgcolor='lightyellow'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6) document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth, arrowid){
	if (ie4||ns6) dropmenuobj.style.left=dropmenuobj.style.top="-500px"
	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") {
		obj.visibility=visible
	} else if (e.type=="click") {
		obj.visibility=hidden
	}
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure){
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
		}
	} else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
			edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
			if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure){ //up no good either?
				edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
			}
		}
	}
	return edgeoffset
}

function populatemenu(what,arrowid){
	if (ie4||ns6) {
		dropmenuobj.innerHTML=what.join("")
		if(document.getElementById) {
			activearrowid=arrowid
			document.getElementById(arrowid).src = "/images/arrowdownblackongray.png"
		}
	}
}


function dropdownmenu(obj, e, menucontents, menuwidth, arrownum){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()

	clearhidemenu()
	if (typeof activearrowid!="undefined") {
		if(document.getElementById) {
			document.getElementById(activearrowid).src = "/images/arrowrightblackongray.png"
		}
	}
	dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
	arrowid="menuarrow" + arrownum
	populatemenu(menucontents,arrowid)

	if (ie4||ns6){
		showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth, arrowid)
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}

	return clickreturnvalue()
}

function clickreturnvalue(){
	if (ie4||ns6) {
		return false
	} else {
		return true
	}
}

function contains_ns6(a, b) {
	while (b.parentNode) {
		if ((b = b.parentNode) == a) return true;
	}
	return false;
}

function dynamichide(e){
	if (ie4&&!dropmenuobj.contains(e.toElement)) {
		delayhidemenu()
	} else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget)) {
		delayhidemenu()
	}
}

function hidemenu(e){
	if (typeof dropmenuobj!="undefined"){
		if (ie4||ns6) {
			dropmenuobj.style.visibility="hidden"
		}
	}
	if (typeof activearrowid!="undefined") {
		if(document.getElementById) {
			document.getElementById(activearrowid).src = "/images/arrowrightblackongray.png"
		}
	}
}

function delayhidemenu(){
	if (ie4||ns6) delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
	if (typeof delayhide!="undefined") clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes") document.onclick=hidemenu
