//Javascript functions for /crs/rs_apps/

//Image mouseovers
function switchImage(imgName, imgSrc) 
{
  if (document.images)
  {
    if (imgSrc != "none")
    {
      document.images[imgName].src = imgSrc;
    }
  }
}

//Open a popup window and center it according to the user's screen and height & width
function openWin(url,w,h) {
	if (w == "" || h == "") {
		w = 325; h = 390;
	} else {}
	var winLeft = (screen.width - w) / 2;
	var winTop = (screen.height - h) / 2;
	windowName = "myWin";
	var windowFeatures = "width="+w+",height="+h+",status,scrollbars,resizable,"+"left="+winLeft+",top="+winTop 
	newWindow = window.open(url, windowName, windowFeatures);
	newWindow.focus();
}

//Print the appropriate link at the bottom of popup windows
function printLink(url,txt) {
	if ('myWin' == window.name) {
		document.writeln('<p align="center" style="margin-top: 1em;">')
		document.writeln('<a href="#" onclick="window.close(); return false;">Close Window</a></p>');
	} else if (txt == null){
		document.writeln('<p align="center" style="margin-top: 1em;">')
		document.writeln('Go to the <a href="index.htm">Sensor Summaries Page</a></p>');
	} else {
		document.writeln('<p align="center" style="margin-top: 1em;">')
		document.writeln('Go to the <a href="'+url+'">'+txt+' Summary Page</a></p>');
	}
}