// no auto-init < 1.2
 

// SECTIONS
var numFeatures = 10;
var numEssays = 0;


// Menu IDs for feature stories
var kAids = 0;
var kCarbon = 1;
var kFrog = 2;
var kHerb = 3;
var kMars = 4;
var kMeditate = 5;
var kQuarantine = 6;
var kSound = 7;
var kSupernova = 8;
var kSurf = 9;


function Aids() { return kAids; }
function Carbon() { return kCarbon; }
function Frog() { return kFrog;}
function Herb() { return kHerb; }
function Mars() { return kMars; }
function Meditate() { return kMeditate;}
function Quarantine() { return kQuarantine; }
function Sound() { return kSound; }
function Supernova() { return kSupernova; }
function Surf() {
    return kSurf;
}


// Menu IDs for bookkeeping links
var kContents = 0;
var kAboutSciCom = 1;

function Contents() { return kContents; }
function AboutSciCom() { return kAboutSciCom; }



var kStop = -1;
function Stop() { return kStop; }

function MenuItem(name, blurb, author, illustrator, destination, authoranchor, illustratoranchor) {
     this.name = name;
     this.blurb = blurb;
     this.author = author;
     this.illustrator = illustrator;
     this.destination = destination;
     this.authoranchor = authoranchor;
     this.illustratoranchor = illustratoranchor;
}

var featureMenu = new Array();
var essayMenu = new Array();

// Initialize Feature menu
featureMenu[kAids] = new MenuItem('The Coming Cure for AIDS?', 'A promising vaccine against HIV hits the pavement in San Francisco&#146;s civic center.', 'Hannah Hickey', 'Karly Maruyama &amp; Beth Guy', 'aids/index.html', 'Hickey', 'MaruyamaGuy');
featureMenu[kCarbon] = new MenuItem('Road Kill in the Deep Blue Sea?', 'Having survived millions of years in one of the world\'s harshest environments, do deep-sea animals now face a new threat? Our leftover carbon dioxide is heading their way.', 'Tonya Clayton', 'Fiona Morris', 'carbon/index.html', 'Clayton', 'Morris');
featureMenu[kFrog] = new MenuItem('Saving the Frogs of Calaveras County', 'Will the red-legged frogs once celebrated by Mark Twain join the global amphibian extinction before researchers even understand why?','Elise Kleeman', 'Kathy Jaramillo', 'frog/index.html', 'Kleeman', 'Jaramillo');
featureMenu[kHerb] = new MenuItem('Take Two Leaves and Call Me in the Morning', 'Do alternative therapies actually work? Clinical trials are posing the question.', 'Jessica Marshall', 'Mary J. Lai &amp; Melissa G. Streblow', 'herb/index.html', 'Marshall', 'StreblowLai');
featureMenu[kMars] = new MenuItem('Shake Hands with a Martian', 'Future missions to Mars will look for more than just water &#150; they&#146;ll look for signs of past life, too. But first they&#146;ll need the right tools for the job.', 'Matthew Early Wright', 'Emily Cooper &amp; Alice Hsieh', 'mars/index.html', 'Wright', 'CooperHsieh');
featureMenu[kMeditate] = new MenuItem('This Is Your Brain on Meditation', 'Modern Western science turns to ancient Eastern tradition to explore the workings of the human mind.', 'Raven Hanna', 'Russell House &amp; Victoria Fortune', 'meditate/index.html', 'Hanna', 'HouseFortune');
featureMenu[kQuarantine] = new MenuItem('Quarantining the Solar System', 'As scientists probe the solar system, they ponder the risks of harming extraterrestrial &#151; or earthly &#151; life.', 'Francoise Chanut', 'Anne Kafferle &amp; Ann Altstatt', 'quarantine/index.html', 'Chanut', 'KafferleAltstatt');
featureMenu[kSound] = new MenuItem('Getting the Vibe', 'Hearing yeast cells sing for the first time made one nanoscientist think that all of our cells vibrate. Now he wants to use those sounds to detect cancer.', 'Andreas von Bubnoff', 'Melissa Thomas', 'sound/index.html', 'VonBubnoff', 'Thomas');
featureMenu[kSupernova] = new MenuItem('Stars with a Bang', 'Supernovas illuminate our origins and the fate of the universe.', 'Susan D. Brown', 'Emma Burns', 'supernova/index.html', 'Brown', 'Burns');
featureMenu[kSurf] = new MenuItem('Solving for Glide', 'Fin makers with supercomputers want to help you with your surfing.','Hugh Powell','Matt Farrar', 'surf/index.html','Powell', 'Farrar');


// Menu IDs for essays

var directoryPrefix = new Array();
directoryPrefix[0] = ''
directoryPrefix[1] = '../'
directoryPrefix[2] = '../../'
directoryPrefix[3] = '../../../'

function DisplayTitle(article) {
    document.write(featureMenu[article].name)    
}

function DisplayHeadline(article, directoryDepth) {
    if (article < featureMenu.length) {

	document.write('<BR><IMG SRC="' + directoryPrefix[directoryDepth] +'images/spacer.gif" width="400" height="7"><BR>')
	document.write('<span class="headline">')
	document.write(featureMenu[article].name)
	document.write('</span>')
	document.write('<BR><IMG SRC="' + directoryPrefix[directoryDepth] +'images/spacer.gif" width="400" height="7"><BR>')
	document.write('<span class="byline">by ')
	
	// to change to links, change NAME to HREF 
	document.write('<A CLASS="byline" HREF="../writers.html#' + featureMenu[article].authoranchor + '">' + featureMenu[article].author + '</A>') 
	document.write('<BR>Illustrated by ') 
	document.write('<A CLASS="byline" HREF="../illustrators.html#' + featureMenu[article].illustratoranchor + '">' + featureMenu[article].illustrator + '</A>')
	document.write('<br><BR></span>')
    
    } else {
	article = article - featureMenu.length
	document.write('<BR><IMG SRC="' + directoryPrefix[directoryDepth] +'images/spacer.gif" width="400" height="7"><BR>')
	document.write('<span class="headline">')
	document.write(essayMenu[article].name)
	document.write('</span>')
	document.write('<BR><IMG SRC="' + directoryPrefix[directoryDepth] +'images/spacer.gif" width="400" height="7"><BR>')
	document.write('<span class="byline">by ')

	// to change to links, change NAME to HREF
	document.write('<A CLASS="byline" HREF="../writers.html#' + essayMenu[article].authoranchor + '">' + essayMenu[article].author + '</A>')
	if (essayMenu[article].illustrator != ' ') {
	    document.write('<BR>Illustrated by ')	    
	    document.write('<A CLASS="byline" HREF="../illustrators.html#' + featureMenu[article].illustratoranchor + '">' + essayMenu[article].illustrator + '</A>')
	}
	
	document.write('<br><BR></span>')
    }}

function DisplayAuthor(article) {
    document.write(featureMenu[article].author)
}

function DisplayIllustrator(article) {
    document.write(featureMenu[article].illustrator)
}

function DisplayBlurb(article) {
    document.write(featureMenu[article].blurb)
}

function DisplayHeader(article) {
    document.write('<SPAN CLASS="headline">')
    document.write(featureMenu[article].name)
    document.write('</SPAN> ')
    document.write('<SPAN CLASS="author">by <A CLASS="author" HREF="#writer">')
    document.write(featureMenu[article].author)
    document.write('</A></SPAN> ')
    document.write('<SPAN CLASS="blurb"> / </SPAN>')
    document.write('<SPAN CLASS="illustrator">illustrated by <A CLASS="illustrator" HREF="#illustrator">')
    document.write(featureMenu[article].illustrator)
    document.write('</A></SPAN> ')
    document.write('<SPAN CLASS="blurb">/ ')
    document.write(featureMenu[article].blurb)
    document.write('</SPAN> ')
    document.write('<BR><BR>')
    
}

function DisplayNav(article, directoryDepth) {
    var navString = ''
    var dividerString = ''
    if (article == -1) {
        dividerString = ' / illustrated by '
    }
    else {
        dividerString = '<BR>art:&nbsp;'
    }
//    navString += '<FONT FACE="verdana, geneva, helvetica" SIZE="1" COLOR="#990000">'
    
    document.write('<FONT COLOR="#777777" FACE="verdana,geneva,arial,helvetica" SIZE="1"><BR> <FONT COLOR="666699"><B>IN THIS ISSUE</B></FONT><P>')
    for (var i=0; i<featureMenu.length; i++) {
	navString += '<A HREF="' + directoryPrefix[directoryDepth] + featureMenu[i].destination + '" CLASS="navbar">'
	if (i == article) {
	    navString += '<B><u>' + featureMenu[i].name + '</B></U><BR>by ' + featureMenu[i].author + dividerString + featureMenu[i].illustrator + '</A><P>' // highlight article name
	}
	else navString += '<B><u>' + featureMenu[i].name + '</B></U><BR>by ' + featureMenu[i].author + dividerString + featureMenu[i].illustrator + '</A><P>'
	if (article == -1) {
	    navString += featureMenu[i].blurb + '<BR><BR>'
	}
	
    }
    
//    navString += '<BR><B>essays</B><P>'
    for (i=0; i<essayMenu.length; i++) {
	navString += '<A HREF="' + directoryPrefix[directoryDepth] + essayMenu[i].destination + '" CLASS="navbar">'
	if (i == article - featureMenu.length) {
	    navString += '<IMG SRC="' + directoryPrefix[directoryDepth] +'images/redRightArrow.gif" WIDTH="8" HEIGHT="8" BORDER="0" ALT=""> <B><u>' + essayMenu[i].name + '</B></U><BR>by ' + essayMenu[i].author // highlight article name
	    if (essayMenu[i].illustrator != ' ') {
	       navString += dividerString + essayMenu[i].illustrator
	    }
	    navString += '</A><P>' 
	}
	else {
	    navString += '<B><u>' + essayMenu[i].name + '</B></U><BR>by ' + essayMenu[i].author
	    if (essayMenu[i].illustrator != ' ') {
	       navString += dividerString + essayMenu[i].illustrator
	    }
	    navString += '</A><P>' 
	}
    }

 

//    if (article != -1) {
//	navString += '<BR><A HREF="' + directoryPrefix[directoryDepth] + 'index.html" CLASS="navbar">table of contents</A><P>'
//    }
    if (article != -1) {
         navString += '<BR><BR><B><A HREF="http://scicom.ucsc.edu/" CLASS="navbar"><U>about the UCSC Science Communication Program</U></A></B><BR><BR><BR><A HREF="http://scicom.ucsc.edu/SciNotes/" CLASS="navbar"><B><U>other issues of <I>Science Notes</I></U></B></A><BR><BR><BR></FONT>'
    }
    document.write(navString)
}

function DisplayLogo(directoryDepth) {
    document.write('<A HREF="../index.html" CLASS="nounderline"><B>Science Notes 2005</B></A>')
}
