<!--

// ----------------------------------------------
// StyleSwitcher functions written by Paul Sowden
// http://www.idontsmoke.co.uk/ss/
// - - - - - - - - - - - - - - - - - - - - - - -
// For the details, visit ALA:
// http://www.alistapart.com/stories/alternate/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

// Membership

function getCookie(Name) {
	var search = Name + "="
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(search) 
		if (offset != -1) { // if cookie exists 
			offset += search.length 
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset) 
			// set index of end of cookie value
			if (end == -1) 
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		} 
	}
}

function showLogin(loginpage, whereami) {
  var cookie=getCookie("fc_firstname");
  if (cookie) {
    //var cookiep=getCookie("inc_perm");
    document.write('<p id="unlocked">Hi '+cookie+'. <a href="http://www.fastcompany.com/mbr/profile/fc/main?origin='+whereami+'">View Your Profile</a> | <a href="http://www.fastcompany.com/mbr/logout/fc/main?origin='+whereami+'">Sign Off</a></p>');
  } else {
    document.write('<p id="locked"><a href="http://www.fastcompany.com/mbr/login/fc/main?origin='+whereami+'">Members sign in</a> | Not a member? <a href="http://www.fastcompany.com/mbr/profile/fc/main?origin='+whereami+'">Sign up</a></p>');
  }
}

// Company of Friends functions

function showLoginCoF(whereami) {
  var cookie=getCookie("fc_firstname");
  if (cookie) {
    //var cookiep=getCookie("inc_perm");
    document.write('<p id="unlocked">Hi '+cookie+'. <a href="http://www.fastcompany.com/mbr/profile/fc/cof?origin='+whereami+'">View Your Profile</a> | <a href="http://www.fastcompany.com/mbr/logout/fc/cof?origin='+whereami+'">Sign Off</a></p>');
  } else {
    document.write('<p id="locked"><a href="http://www.fastcompany.com/mbr/login/fc/cof?origin='+whereami+'">Members sign in</a> | Not a member? <a href="http://www.fastcompany.com/mbr/profile/fc/cof?origin='+whereami+'">Sign up</a></p>');
  }
}

function launch_bizcard(id) {
   bizCard = window.open('http://www.fastcompany.com/cof/business_card.jsp?id='+id,'bizcard','dependent=yes,directories=no,height=550,width=550,hotkeys=no,location=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
   bizCard.focus();
}

function launch_bizcard_from_lyrisid(id) {
   bizCard = window.open('http://www.fastcompany.com/cof/business_card.jsp?lyrisid='+id,'bizcard','dependent=yes,directories=no,height=550,width=550,hotkeys=no,location=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
   bizCard.focus();
}

function launch_search_page() {
   searchPage = window.open('http://www.fastcompany.com/cof/member_search.jsp?nowrap=1','search','dependent=yes,directories=no,height=550,width=500,hotkeys=no,location=no,menubar=no,personalbar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no');
   searchPage.focus();
}

// end CoF functions

// Breadcrumb

function lastGuide() {
	var last_guide = "last_guide="
	if (document.cookie.length > 0) { // if there are any cookies
		offset = document.cookie.indexOf(last_guide) 
		if (offset != -1) { // if cookie exists 
			offset += last_guide.length 
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset) 
			// set index of end of cookie value
			if (end == -1) 
				end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		} 
		else { return ""; }
	}
	else { return ""; }
}

// Div toggle

function toggle( targetId ){
  if (document.getElementById){
  		target = document.getElementById( targetId );
  			if (target.style.display == "none"){
  				target.style.display = "";
  			} else {
  				target.style.display = "none";
  			}
  	}
}

// Featured Services

function showFeatured() {
    document.write('<ul class="styled">');
   	document.write('<li><strong>Microsoft</strong> <a href="http://www.inc.com/partners/businessinsights/">Visit the New Business Insight Center on Inc.com</a></li>');
	document.write('<li><strong>ClassesUSA</strong> <a href="http://trax.fastcompany.com/k/w/featuredserv/classesusa">Find an Online Degree Program from an Accredited University.</a></li>');
	document.write('<li><strong>Business.com</strong> <a href="http://trax.fastcompany.com/k/w/featuredserv/bcom">Directory of 400,000+ cataloged business-oriented web sites.</a></li>');
	document.write('<li><strong>Oracle</strong> <a href="http://trax.fastcompany.com/k/w/oracle/microsite">Visit the Business Challenges Center sponsored by Oracle.</a></li>');
	document.write('<li><strong>Google AdSense</strong> <a href="http://www.google.com/getadsense">Dollars and Sense: Earn money serving ads that are relevant to your content.</a></li>');
	document.write('<li><strong>IBM</strong> <a href="http://ad.doubleclick.net/clk;6634148;8625337;r?http://www.ibm.com/software/smb/retail6">Middleware is Everywhere.  See it with IBM software</a></li>');
	document.write('<li><strong>IBM How I Did It</strong> <a href="http://trax.inc.com/k/w/howididit">How do you grow a business 12,753&? Find out at How I Did It.</a></li>');
	document.write('<li><strong>American Airlines</strong> <a href="http://trax.inc.com/k/w/americanairlines/textlink">Next time, fly American. More flights to fit your needs.</a></li>');
	document.write('<li><strong>Microsoft</strong> <a href="http://trax.fastcompany.com/k/w/services/ms-secure-depend">Get your free eSecurity Guide for Small Business CD from Microsoft today</a></li>');
	document.write('</ul>');
}
//-->

// Dropdown Box
function goTo(pagename) {
if ((-1 < pagename.selectedIndex) && (pagename.options[pagename.selectedIndex].value != "nil")) {
val = pagename.options[pagename.selectedIndex].value;
if(val!="NoValue") {
parent.location.href=val;
return true;
}
}
}



function getLoc(page){
    opt = "document.pulldown." + page + ".selectedIndex].value";
    url = "document.pulldown." + page + ".options[" + opt;
    location = eval(url);
}
//-->


function MM_reloadPage(init) {  //reloads the window if Nav4 resized

  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }
  } else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function browserCheck(){
    var browsername = navigator.appName;
    var version = parseInt(navigator.appVersion);
    if( browsername == 'Netscape' && version == '4' ) alert( 'In order to view this website properly, please upgrade to Netscape 7 or greater.' );
}

// Random Image and Caption
<!-- hide from old browsers
var numImages = 29;     // <=== Adjust the number of image files here
var theImages = null;
var theAltTags = null;
theAltTags = new initArray(numImages);
theAltTags[1] = "Jack Reese painting equipment in rigging shop.  (Photo by Tom Kleindinst, WHOI) ";
theAltTags[2] = "The GumbyMoor going over the side during deployment test cruise. (Photo by Jayne Doucette, WHOI)";
theAltTags[3] = "Path behind Fye Laboratory that connects Fenno House with Clark Laboratory during Blizzard of 2005.  (Photo by Tom Kleindinst, WHOI)";
theAltTags[4] = "Like many expeditions involving WHOI scientists and engineers, the cruises to the Lau Basin require a multidisciplinary team. Participants include engineers Dana Yoerger (1), Rod Catanach (2), Al Bradley (3), Joint Program engineering student Mike Jakuba (4), geologist Dan Fornari (5), biologist Tim Shank (6) and geochemists Meg Tivey (7) and Jeff Seewald (8). (Photo by Tom Kleindinst, WHOI)";
theAltTags[5] = "Tetjana Ross (in red) and Andone Lavery preparing to do a profile with a fast-response temperature-conductivity probe. The profiles are done to characterize the double-diffusive interface. (Photo by Tom Kleindinst, WHOI) ";
theAltTags[6] = "High resolution hydrographic surveys of continental shelf and slope north of Cape Hatteras and deployment of shallow water mooring array. (Photo by Chris Linder, WHOI) ";
theAltTags[7] = "R/V Knorr at the WHOI dock. (Photo by Tom Kleindinst, WHOI) ";
theAltTags[8] = "Tubeworms at the Rosebud site. Dive and Discover, Expedition 9, Return to the Galapagos Rift.  (Copyright WHOI) ";
theAltTags[9] = "Steward Carl Wood and Alvin pilot Anthony Tarantino signal that Alvin has cleared the ship and is ready to be lowered. Dive and Discover Expedition 9, Return to the Galapagos Rift.  (Photo by Amy Nevala, WHOI)";
theAltTags[10] = "Adam Soule, Dan Fornari and Rhian Waller with compressed styrofoam cups that were decorated by first and sixth grade classes at Grace-St. Luke's Episcopal School in Memphis, Tennessee. Alvin carries the cups in a mesh bag to the ocean floor where they are compressed by the pressure at depth. Dive and Discover Expedition 9, Return to the Galapagos Rift. (Photo by Amy Nevala, WHOI)";
theAltTags[11] = "Octopus seen from Alvin. Dive and Discover Expedition 9, Return to the Galapagos Rift. (Photo by Bruce Strickrott, WHOI) ";
theAltTags[12] = "Bruce Strickrott jumping from Alvin while Ken Feldman remains on the sub conducting final safety checks. Atlantis in the background. Dive and Discover Expedition 9, Return to the Galapagos Rift. (Photo by Amy Nevala, WHOI)";
theAltTags[13] = "Chris Moody, steward on R/V Oceanus, prepares a meal.  (Photo by Mike Carlowicz, WHOI)";
theAltTags[14] = "R/V Tioga in the Cape Cod Canal. (Photo by John Dyke, WHOI)";
theAltTags[15] = "Postdoc Dave Ralston and Jay Sisson recover a mooring buoy. The round object at the top of the mooring is a radar reflector. (Photo by Jim Kent, WHOI) ";
theAltTags[16] = "A bird (booby) hitching a ride on the back of a turtle. Dive and Discover Expedition 9, Return to the Galapagos Rift. (Photo by Amy Nevala, WHOI) ";
theAltTags[17] = "Chris Roman, Brendan Foley and Matt Grund prepare SeaBED for deployment. (Photo by Ann Stone, WHOI) ";
theAltTags[18] = "Dara Scott and Will Handley working on Jason II on R/V Melville, Spring 2005.  (Photo by Tom Bolmer, WHOI) ";
theAltTags[19] = "Hovey Clifford and Summer Student Fellows prepare to unload the sediment sample from the retrieved box corer on R/V Tioga. (Photo by Jayne Doucette, WHOI)";
theAltTags[20] = " John Farrington, Jim Kent and Bob Detrick at the grills during the 2005 WHOI Summer Picnic. (Photo by Jayne Doucette, WHOI)";
theAltTags[21] = "MIT/WHOI Joint Program Commencement, September 2005 (Photo by Jayne Doucette, WHOI) ";
theAltTags[22] = "Jeff Donnelly (in red shirt) at Woodneck Beach with Ocean Science Journalism Fellows Paul Thacker and Sara Pratt.  (Photo by Tom Kleindinst, WHOI)";
theAltTags[23] = "Remote Environmental Monitoring Units (REMUS) being tested off the WHOI dock.  (Photo by Tom Kleindinst, WHOI)";
theAltTags[24] = "A crane lifts Alvin from Atlantis to Smith highbay for overhaul. (Photo by Tom Kleindinst, WHOI)";
theAltTags[25] = "Aerial view of Woods Hole Village. (Photo by Bird's Eye View) ";
theAltTags[26] = "Members of the Alvin overhaul team  including from front to back, Pat Hickey, Anton Zafereo, Anthony Tarantino, Gavin Eppard, Mike McCarthy, Anthony Berry, Bruce Strickrott, Mark Spear  (Photo by Tom Kleindinst, WHOI) ";
theAltTags[27] = "The Queen Ann's Revenge and crew Clockwise from left: Brad Rosenheim, Matius Cape, Mary Lardie, Rick Healy, Angie Dickens and Emma Teuten. Anything but a boat Regatta held in honor of WHOI's 75th Anniversary.  (Photo by John Hayes, WHOI) ";
theAltTags[28] = "The Graphics team racing the Lulu2 Anything but a boat Regatta held in honor of WHOI's 75th Anniversary.  (Photo by Jayne Doucette, WHOI) ";
theAltTags[29] = "Jingle Bell Runners, left to right, Lane  Abrams , Ann Tarrant, Tom Bolmer, Anna Nikolopoulos , Uli Riemenschneider, Ann Stone , Stace Beaulieu and Rick Chandler. (Photo by Sandra Murphy, WHOI)";

function getRandomNumber(n) {
        //Returns a pseudorandom number between 1 and n
        today = new Date();
        var bigNum = today.getSeconds() * today.getTime() * Math.sqrt(today.getMinutes());
        var randNum = (bigNum % n) + 1;
        return Math.floor(randNum);
}
function initArray(n) {
        this.length = n;
        for(var i = 1; i <= n; i++) {
                this[i] = "";
                }
        return this;
}
function initImages() {
        //Name Images: imagenn where nn is a whole number
        //in the format "1" to "99"
        theImages = new initArray(numImages);
        for(i = 1; i <= numImages; i++) {
                theImages[i] = "img" + i + ".jpg"
        }
}
function getRandomImage() {
        var theIndex = getRandomNumber(numImages);
        return theIndex;
}
function loadImage() {
        var theIndex = getRandomImage();
        var theImageName = theImages[theIndex]; 
		var theAltTag = theAltTags[theIndex];
        theCaption = '<font size="-2">' + theAltTag + '</font>';	
        theImage = "http://www.whoi.edu/images/internal/rotating_images/" + theImageName;
        var theTag = '<IMG SRC= "' + theImage + '"';
        theTag += ' WIDTH=250 HEIGHT=168 BORDER="0"';
        theTag += ' ALT="' + theAltTag + ' &#169; WHOI">';
        document.write(theTag);
}

function loadCaption() {
		document.write(theCaption);
}
initImages();

// Popoff Window
var myWind
clk="null";
function Clk(button) {
		myWind= window.open(button,"subwindow","height=716,width=750,location=0,menubar=0,resizable=yes,scrollbars=1,status=1,titlebar=0,toolbar=0,hotkeys=0,screenx=40,screeny=40,left=0,top=0")
		myWind.focus()
}

//-->