/*
  BCAL javascript
  
  Image manipulation
  06/14/2007
*/

  var pics       = new Array();
  var alts       = new Array();
  var picaption  = new Array();

  pics.push("salmonfallscreek");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Salmon Falls Creek landslide, ID (LiDAR image)");

  pics.push("craters");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Craters of the Moon, ID (RADAR image)");

  pics.push("northwest");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Northwest U.S.A. from space");

  pics.push("measuring");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Measuring invasive species' spectral reflectances, Swan Valley, ID");

  pics.push("lostriverrange");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Lost River Range, ID");

  pics.push("detecting");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Detecting invasive weeds with remote sensing, Swan Valley, ID");

  pics.push("borahfault");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Borah Fault, Lost River Range, ID (ASTER satellite image)");

  pics.push("borahfault2");
  alts.push("Boise Center Aerospace Laboratory");
  picaption.push("Borah Fault, Lost River Range, ID (LiDAR perspective with NAIP imagery)");

  function randPic() {
    var randnum = Math.random();
	var BGIndex = Math.round((pics.length - 1) * randnum);

	document.getElementById("splash").innerHTML = '<img class="splashphoto" src="images/' + pics[BGIndex] + '.jpg" width="539" height="200" alt="' + alts[BGIndex] + '" />';
    document.getElementById("geo_caption").innerHTML = '<h6>' + picaption[BGIndex] + '</h6>';
  }
  
  function stringReverse(textString) {
	  if (!textString) return '';
	  var revString='';
	  for (i = textString.length-1; i>=0; i--)
	    revString+=textString.charAt(i)
	  return revString;
  }
  
  function emLink(name,server) {
	  var rname=stringReverse(name);
	  var rserver=stringReverse(server);
	  var mailText=rname+"@"+rserver;
	  return mailText;
  }