//
// Code for Knight Science Journal Fellowships home page
// -random photo selector
// -code related to Flash
//

//
// RANDOM PHOTO
//

// Modify the array below to add/remove photos

var randomphotos = new Array();
randomphotos.push("img/home/photo1.jpg");// Claudio and butterfly
randomphotos.push("img/home/photo2.jpg");// Dome
randomphotos.push("img/home/photo3.jpg");// Skulls
randomphotos.push("img/home/photo4.jpg");// Mexico Field
randomphotos.push("img/home/photo5.jpg");// Ingfei
randomphotos.push("img/home/photo6.jpg");// 3D glasses
randomphotos.push("img/home/photo7.jpg");// Costa Rica walking
randomphotos.push("img/home/photo8.jpg");// Steve and Pam
// (add more here)


var nphoto = Math.floor(Math.random()*randomphotos.length);    // pick one at random

function showrandomphoto() {
  document.writeln('<div id="divphoto"><img src="'+randomphotos[nphoto]+'" width="489" height="208" alt="" title="" /></div>');
}





//
// FLASH
//

// feed URL
var feedurl = "http://ksjtracker.mit.edu/?feed=rss2";
// flash movie
var swffile = "ticker.swf";
// full URI
var swfuri = swffile+"?feedurl="+encodeURIComponent(feedurl);

//
// check if flash should be shown or not
//

var doflash = false;

var player = new MM_FlashInfo();
if (player.installed) {
  if (player.version && player.version >= 7) { // NEEDS FLASH VERSION 7 OR GREATER
    doflash = true;
  }
}

//
// write HTML for flash movie or HTML alternative
//

function writeflash() {
  if (doflash) {
    document.write("<div id='divflash'>");
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' id='homeflash' width='506' height='70'>");
    document.write("<param name='movie' value='"+swfuri+"' /><param name='play' value='true' /><param name='loop' value='true' /><param name='quality' value='high' /><param name='menu' value='false' /><param name='bgcolor' value='#d4d9a2' /><param name='allowScriptAccess' value='sameDomain' />");
    document.write("<embed src='"+swfuri+"' play='true' loop='true' quality='high' menu='false' bgcolor='#d4d9a2' swLiveConnect='false' width='506' height='70' name='homeflash' type='application/x-shockwave-flash' allowscriptaccess='sameDomain'>");
    document.write("</embed></object></div>");
  }
	else {
		document.write("<div id='divflash'>")
		document.write("<a href='http://ksjtracker.mit.edu/'><img src='img/home/flashalt.gif' width='506' height='70' border='0' alt='Knight Science Journalism Tracker' title='' /></a>")
		document.write("</div>")
	}
  // if no flash, don't write anything
}
