/*

  Lucio Tavernini - Navigation Menu

  Import: 'relURL' and 'refURL'.

*/ 

//  These lines are for the printer button at the end of some pages.
var pic = new Array(2)
pic[0] = new Image()
pic[1] = new Image()

pic[0].src = "b-print-out.gif"
pic[1].src = "b-print-over.gif"

var k = 0
function changePic() {
  document.bprint.src = pic[++k%2].src
}

//  Put in frame.
if (top == self) 
  if (relURL != '') location.replace(relURL)
  else if (refURL != '') location.replace(refURL)
  else location.replace('tavernini.com')

//  Write to document.
function put(s) {
  if (top != self) parent.frames[0].document.writeln(s)
}

//  This is the menuEntry object.
function menuEntry(hRef, label, height, newWin) {
  this.hRef = hRef		//  Link 
  this.label = label		//  What to call the link
  this.height = height		//  Height in pixels 
  this.newWin = newWin	        //  true <=> Open in a new windoe
}

standard_height = 17
hr_height = 6
hr_width = 6

var menuArray = new Array()

//  UTSA-Related Entries
menuArray[menuArray.length] = new menuEntry('home.html', 'Home', standard_height, false)
menuArray[menuArray.length] = new menuEntry('tavernini.html', 'Flash Page', standard_height, false)
menuArray[menuArray.length] = new menuEntry('courses.html', 'Courses I\'m Teaching', standard_height, false)
menuArray[menuArray.length] = new menuEntry('course_notes.html', 'Course Notes', standard_height, false)
menuArray[menuArray.length] = new menuEntry('da.html', 'Differential Automata', standard_height, false)
menuArray[menuArray.length] = new menuEntry('numex.html', 'Numerical Examples', standard_height, false)

//  Personal Entries
menuArray[menuArray.length] = new menuEntry('<HR>', hr_width, hr_width, false)
menuArray[menuArray.length] = new menuEntry('favorites.html', 'My Favorites', standard_height, false)
menuArray[menuArray.length] = new menuEntry('news.html', 'News Links', standard_height, false)
menuArray[menuArray.length] = new menuEntry('javascript.html', 'JavaScript Animation', standard_height, false)

menuArray[menuArray.length] = new menuEntry('<HR>', hr_width, hr_width, false)

menuArray[menuArray.length] = new menuEntry('./licciardi/index.html', 'The Licciardi Archive', standard_height, true)
menuArray[menuArray.length] = new menuEntry('./espresso/index.html', 'The Espresso Files', standard_height, true)
menuArray[menuArray.length] = new menuEntry('./gallery/index.html', 'The Gallery', standard_height, true)

menuArray[menuArray.length] = new menuEntry('<HR>', hr_width , hr_width, false)

//  ------------------------------
//  Generate HTML navigation page.
//  ------------------------------
put('<HTML>')
put("<!-- This frame is generated on the fly by 'common.js'.                          -->")
put("<!-- If you're not sure how this works, drop me a line at 'lucio@tavernini.com'. -->")
put('<HEAD>')
put('<TITLE>Lucio Tavernini Menu Page</TITLE></HEAD>')
put('<SCRIPT SRC="globals.js"><\/SCRIPT>')            // The "important news" message is here. 
put('<STYLE>')
put('  A {TEXT-DECORATION: none; COLOR: A0C0C0}')
put('  A:hover {color:white; text-decoration: underline; background: 000040}')
put('</STYLE>')
put('<BODY BGCOLOR=253385 TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 TEXT=FFFFFF>')

//  Generate table of links.
put('<TABLE WIDTH=180 BORDER=0 CELLSPACING=0 CELLPADDING=0>')
put('  <TR>')
put('    <TD ALIGN=LEFT WIDTH=80><IMG BORDER=0 WIDTH=80 HEIGHT=80 SRC="round_c.jpg"></TD>')
put('    <TD WIDTH=100 NOWRAP>&nbsp;</TD>')
put('  </TR>')

//  This header begins each row:
header = '<TR><TD COLSPAN=2 HEIGHT=18 ALIGN=CENTER><FONT SIZE=-1 FACE="ARIAL,HELVETICA">'

//  Are there important news?  'IMPORTANT_NEWS' is defined in 'common.js'.
if (IMPORTANT_NEWS !== '') {
  put('  ' + header)
  put('    Students: There are<BR><A HREF="javascript:alert(IMPORTANT_NEWS)"><FONT ')
  put('    COLOR=00FFFF>important news</A>.</FONT></TD></TR>')
  put('  ' + header + '<HR WIDTH=40 SIZE=3 NOSHADE></TD></TR>')
}
//  Generate links from array.
for (var i = 0; i < menuArray.length; i++) with (menuArray[i]) {
  //  This header begins this row:
  header = '  <TR><TD COLSPAN=2 HEIGHT=' + height + ' ALIGN=CENTER><FONT SIZE=-1 FACE="ARIAL,HELVETICA">'
  put(header)
  if (hRef == '<HR>') put('    ' + '<HR WIDTH=' + label + ' SIZE=' + height +  ' NOSHADE></TD></TR>')
  else if (hRef == '') put('    ' + label + '</TD></TR>')
  else if (hRef == relURL) put('    <B>' + label + '</B></TD></TR>')
  else if (hRef == refURL) put('    <A HREF="' + hRef + '" TARGET=_top><FONT FACE="Arial,Helvetica" COLOR=FFFFFF><I><B>' + 
    label + ' <</B></I></FONT></A></TD></TR>')
  else if (newWin) put('    <A HREF="' + hRef + '" TARGET=_blank>' + label + '</A></TD></TR>')
  else put('    <A HREF="' + hRef + '" TARGET=_top>' + label + '</A></TD></TR>')
}

//  Generate email link.
put(header + '<A HREF="mailto:lucio@tavernini.com">Send Email</A></FONT></TD></TR>')


//  Close the table, then terminate.
put('  <TR>')
put('    <TD ALIGN=LEFT><IMG BORDER=0 WIDTH=80 HEIGHT=80 SRC="round_b.jpg"></TD>')
put('    <TD>&nbsp;</TD>')
put('  </TR>')
put('  <TR>')
put('    <TD HEIGHT=1900 BGCOLOR=000000 WIDTH=80 NOWRAP>&nbsp;</TD>')
put('  </TR>')
put('</TABLE>')
put('</BODY>')
put('</HTML>')