var MY_OFFICE = "SB 4.02.46" 
var PAR
var THIS_COURSE

var IMPORTANT_NEWS = ''  

/*
'Class survey date is 30 March for all courses.\n\n' +
  'Exams have been rescheduled as shown below.             \n\n' +
  'MAT 3013:\n'+
  '    Exam 2: 1 April\n\n' +
  'MAT 3213:\n'+
  '    Exam 2: 1 April\n\n' +
  'MAT 4213:\n'+
  '    Exam 2: 6 April\n\n' 
*/

/*
var IMPORTANT_NEWS = 'The revised exam schedule follows. Only the date for Exam 2 in MAT 4213 has been changed.    \n\n' +
  'MAT 3013:\n'+
  '    Exam 1: 18 February\n' +
  '    Exam 2: 25 March\n\n' +
  'MAT 3213:\n'+
  '    Exam 1: 23 February\n' +
  '    Exam 2: 1 April\n\n' +
  'MAT 4213:\n'+
  '    Exam 1: 11 February\n' +
  '    Exam 2: 6 April\n\n' 
*/


/*
var IMPORTANT_NEWS = 'This website will not be available for a few hours on 09/27/2009:\n\n' +
  'Server outage notification:\n\n'+
  '  SERVER: Raid (207.45.187.26)\n' +
  '  DATE: September 27th, 2009 @ 1:00am (EST)\n' +
  '  MAINTENANCE WINDOW: 09/27/2009 @ 1:00am (EST) - 09/27/2009 @ 7:00am (EST)\n' +
  '  EXPECTED DURATION: 4 - 6 hours'
*/


/*
var IMPORTANT_NEWS = 'The Spring 2009 portion of this site is under construction. ' +
  'The information will not necessarily be accurate until this notice disappears.'
*/


/*
var IMPORTANT_NEWS = 'Effective Immediately: Calculus I (MAT 1214 02F 32540) will meet in BB 3.03.24.\n' +
  'Lectures, labs, exams, final, will take place there.\n\n\n' +
  'Revised Final Exam Schedule\n\n' +
  '   MAT 3013 Foundations of Mathematics: 8 July (Tuesday) 10:30 am - 12:00 noon     \n\n' +
  '   MAT 1214 Calculus I: 8 July (Tuesday) 1:30-3:00 pm\n\n' +
  'Last class day: 3 July (Thursday)\n\n' +
  'MAT 1214 Calculus I Exams 3 and 4 will start at 4:20 pm. \n' + 'Ms. Fies will run the lab from 4:00 pm to 4:20 pm. \n\n'
*/


/*
var IMPORTANT_NEWS = 'IMPORTANT NEWS\n\nThursday, June 28, 2007: All afternoon classes and programs are canceled. ' +
  'MAT 1214 will not meet today.  If UTSA will be open tomorrow, we will do the exam review then and ' +
  'will have the exam on Monday.  Otherwise, we\'ll have the exam review on Monday and the exam on Tuesday. ' +
  'MAT 3013 has already met today.  If UTSA will be open tomorrow, we\'ll have the exam then.  Otherwise, we\'ll have ' +
  'the exam on Monday.\n\n' +
  'Friday, June 29, 2007: Everything should go as planned yesterday.\n\n' +
  'Saturday, June 30, 2007: As rescheduled earlier, we\'ll have Exam 4 in MAT 1214 on Monday, July 2, 2007.\n\n'
*/


/***********************************************************************/
/***********************************************************************/

// Replace spaces with underscores.      
function underscore(s) {
  var i
  var t = ''
  for (i = 0; i <= s.length - 1; i++) t += s.charAt(i) == ' ' ? '_' : s.charAt(i)
  return t
}

function popWin(URL, width, height) {
  window.open(URL,"", "width=" + width + ",height=" + height + 
  ",screenX=50,screenY=50,resizable=0,toolbar=0,directories=0,status=0,menubar=0,scrollbars=0")
}

function put(s) {
  document.writeln(s)
}

function getParString() {
  URLString = new String(parent.location)
  startIndex = URLString.indexOf('?')
  if (startIndex == -1) return ''
  return URLString.slice(startIndex + 1, URLString.length)
}

//  HTML Emitter for Course Pages
function putHeader(title, courseOutlineURL) {
  var temp = getParString()
  temp += '///'
  put('<TR><TD>')
  put('<FONT SIZE=-1 FACE="ARIAL,HELVETICA"><B><BR>UTSA<BR>Lucio Tavernini - Course Homepage<BR>')
  PAR = temp.split('/')  //  PAR[0] = term,  PAR[1] = section,  PAR[2] = year
  put(title + '<BR>')
  if (PAR[2] != '') 
    put(PAR[0].charAt(0).toUpperCase() + PAR[0].substring(1) + ' ' + PAR[2] + ' - Section ' + PAR[1].toUpperCase() + '</B>')
  put('</TD></TR>')

  put('<TR><TD><FONT SIZE=-1 FACE="ARIAL,HELVETICA">')
  if (NUM_SEM_SHOWN == 0) put('<P>Current information is not yet available.</P>')
  else { 
    put('<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="See the Course Outline (Syllabus)." ' +   
      'ONCLICK="window.parent.location=\'./' + courseOutlineURL + '?' + getParString() + '\'">')
    put('</FORM></CENTER>')
  }
  put('</TD></TR>')

  // Class Notes and Teaching Style 
  put('<TR><TD><FONT SIZE=-1 FACE="ARIAL,HELVETICA"><P><B>Class Notes and Teaching Style</B></P>') 
  put('<P>I lecture using a tablet PC connected to a projector.  Everything I write is uploaded in PDF format to the course website ' +
    'where it remains available for all to see.  We\'ll have a record of what I present at each lecture, with a time stamp for that day.' +
    '</P>')

  if (NUM_SEM_SHOWN > 0) {
    put('<P>The course tablet files become available  as soon as I upload them ' +
      'to the course web server.  To view these files, click the \'Select Section\' button, if ' +
      'one is showing, then select a course section, then click the \'View Tablet Notes\' button.</P>')

    // Select Section/View Table Notes Button 
    if (getParString() != '') {
      put('<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="View Tablet Notes" ') 
      temp = "./tablet_notes/" + PAR[2] + '_' + PAR[0] + '/' + underscore(THIS_COURSE.name) + '.' + PAR[1] 
      temp = temp.toLowerCase() 
      put('ONCLICK="window.parent.location=\'' + temp + '/\'"> &nbsp ')
    }
    else {
      put('<CENTER><FORM><INPUT TYPE="BUTTON" VALUE="Select Section" ' +   
        'ONCLICK="window.parent.location=\'./courses.html\'">')
      put('</FORM></CENTER>')
    }
  }
  put('</TD></TR>')
}

// Main
if ( location.host == "65.254.34.153" 
  || location.host == "65.254.59.234" 
  || location.host == "tavernini.homedns.org" 
  || location.host == "www.tavernini.com" 
  || location.host == "tavernini.us" 
  || location.host == "www.tavernini.us")
  top.location.replace('http://tavernini.com' + parent.location.pathname + '?' + getParString())

  

