// no auto-init < 1.2
 

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


// Menu IDs for feature stories
var kEcoli = 0;
var kPets = 1;
var kCondor = 2;
var kQi = 3;
var kRobobug = 4;
var kTalk = 5;
var kOcean = 6;
var kBigSur = 7;
var kSierra = 8;
var kSpecies = 9;


function bigsur() { return kBigSur; }
function condor() { return kCondor; }
function ecoli() { return kEcoli;}
function ocean() { return kOcean; }
function pets() { return kPets; }
function qi() { return kQi;}
function robobug() { return kRobobug; }
function sierra() { return kSierra; }
function species() { return kSpecies; }
function talk() {
    return kTalk;
}


// 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[kBigSur] = new MenuItem('Big Sur\'s Scientific Time Capsule', 'One of California\'s most dramatic and pristine natural reserves offers unique ecological research, as <b>Brian Lee</B> discovers', 'Brian Lee', 'Lisa Apfelbacher', 'bigsur/index.html', 'writer', 'artist');
featureMenu[kCondor] = new MenuItem('Condors: A Modern Phoenix', 'A quarter-century ago, only 22 California condors were alive. Today they have risen from the ashes, but <B>Mar&iacute;a Jos&eacute; Vi&ntilde;as</B> reviews the man-made hazards they still face.', 'Mar&iacute;a Jos&eacute; Vi&ntilde;as', 'Pedro Fernandes', 'condor/index.html', 'writer', 'artist');
featureMenu[kEcoli] = new MenuItem('From Bowel to Bowl', 'Researchers search for the paths of E. coli contamination in spinach and other produce. <B>Rachel Courtland</B> joins them in the fields.','Rachel Courtland', 'Melisa Beveridge & Joe Hill', 'ecoli/index.html', 'writer', 'artist');
featureMenu[kOcean] = new MenuItem('Using Their Heads', 'The eating habits of elephant seals and albatrosses are helping researchers map the unknown ocean. <B>Megha Satyanarayana</B> tags along.', 'Megha Satyanarayana', 'Jenny Parks & Amy Whitesides', 'ocean/index.html', 'writer', 'artist');
featureMenu[kPets] = new MenuItem('One Medicine, Many Challenges', 'Cat kidney transplants show how veterinarians translate human medicine into better care for pets &#8212; if you can afford it, says <b>Ewen Callaway</B>.', 'Ewen Callaway', 'Jennifer Rodriguez', 'pets/index.html', 'writer', 'artist');
featureMenu[kQi] = new MenuItem('May the Qi Be with You', 'Does an Eastern tradition rooted in several millennia of history and philosophy have a role in modern-day health care? <B>Marcus Woo</B> investigates.', 'Marcus Woo', 'Beatriz Carmen Mendoza', 'qi/index.html', 'writer', 'artist');
featureMenu[kRobobug] = new MenuItem('Don\'t Let the Robo-bugs Bite', 'Silicon insects are hopping towards existence in a lab at UC Berkeley. <B>Sarah Williams</B> takes a look.', 'Sarah Williams', 'Juan Cristobal Calle & Suzannah L. Alexander', 'robobug/index.html', 'writer', 'artist');
featureMenu[kSierra] = new MenuItem('The Sierra Nevada Enigma', 'Geologists have used an unorthodox tool to address the mystery of a mountain range\'s age. <B>Brittany Grayson</B> digs in.', 'Brittany Grayson', 'Logan Parsons & Ann Sanderson', 'sierra/index.html', 'writer', 'artist');
featureMenu[kSpecies] = new MenuItem('Splitting Hares (and Birds and Primates and Algae)', 'Are multiple methods for classifying species throwing off the counts? <b>Alla Katsnelson</B> tallies the score.', 'Alla Katsnelson', 'Valerie L. Layne', 'species/index.html', 'writer', 'artist');
featureMenu[kTalk] = new MenuItem('Well, You Know, It\'s How We Talk', 'A psychologist tells <b>Clara Moskowitz</B> why she gives credit to the likes of \"like\".','Clara Moskowitz','Jessica Decker', 'talk/index.html','writer', 'artist');


// 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('<H1>')
    document.write(featureMenu[article].name)
    document.write('</H1> ')
//    document.write('<H3>by <A CLASS="author" HREF="#writer">')
//    document.write(featureMenu[article].author)
//    document.write('</A>')
//    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></H3>')
    document.write('<H4 CLASS="blurb">')
    document.write(featureMenu[article].blurb)
    document.write(' Illustrated by <B>' + featureMenu[article].illustrator + '</B>.')
    document.write('</H4> ')
//    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('<P class="nav"><FONT COLOR="818D9D"><B>IN THIS ISSUE</B></FONT><BR><BR>')
    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></A><BR>by ' + featureMenu[i].author + dividerString + featureMenu[i].illustrator + '</A></P><P class="nav">' // highlight article name
	}
	else navString += '<B><u>' + featureMenu[i].name + '</B></U></A><BR>by ' + featureMenu[i].author + dividerString + featureMenu[i].illustrator + '</A></p><P class="nav">'
	if (article == -1) {
	    navString += featureMenu[i].blurb + '<BR><BR>'
	}
	
    }
    
//    navString += '<BR><B>essays</B><P class="nav">'
    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 class="nav">' 
	}
	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 class="nav">' 
	}
    }

 

//    if (article != -1) {
//	navString += '<BR><A HREF="' + directoryPrefix[directoryDepth] + 'index.html" CLASS="navbar">table of contents</A><P class="nav">'
//    }
//    if (article != -1) {
         navString += '<BR><SPAN CLASS="navbar"><B>Editor</B><BR>Robert Irion<BR><BR><B>Consulting editor</B><BR>Jeff Wheelwright<BR><BR><B>Art editors</B><BR>Ann Caudle<BR>Jenny Keller<BR><BR><B>Web design</B><BR>Kenneth Chang<BR></SPAN><BR><BR><B><A HREF="http://scicom.ucsc.edu/SciWriting.html" CLASS="navbar"><U>about the UCSC Science Writing Program</U></A><BR><BR><A HREF="http://scicom.ucsc.edu/illus" CLASS="navbar"><U>about the UCSC Science Illustration 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('<P class="logo"><A class="logo" HREF="../index.html" CLASS="nounderline"><B>Science<BR>Notes<BR>2007</B></A></P>')
}
