/* /////////////////////////////////////////////////////////////////////
#
#    mycourse.js
#
#    This is a Javascript file that supports my classes
#
#    Copyright 2001-2010 Christopher C. Ferguson
#    All rights reserved. This program may not be copied, duplicated or
#    emulated without the expressed written consent of Christopher C. Ferguson
#
#
#    Last Update: Feb 2 2010
#
#/////////////////////////////////////////////////////////////////////   */

baseURL = "http://www.canyons.edu"
baseHREF = baseURL + "/departments/comp_sci/ferguson/"

officeHours = "TTH 12:30-1:30 PM, W 5:00-6:00 PM Hasley Hall 331 (or by appt.)"

semName = "Spring 2012"
doSurvey = "no"
message = ""
aspurl = baseHREF + "js/weeklynotes.asp"


//set up the code that decides how many weeks of notes to display
lessonNumber = 1  //  fail safe  -   set the MINIMUM number of weeks to display (in case CPU clock is wrong)
startsec =  1328558560025 - (4 * 86400000) // + 3 * 604800000 // change this number, start of term  1313612250472
// set startsec at beginning of term, subtract/add 604800000  for one week, subtract/add 86400000  for a day 
/* this is current time in seconds    now = new Date ();  nowseconds = now.getTime(); alert(nowseconds); */
// set startsec to the value of nowseconds (above) and subtract/add to adjust to the day you want new notes to appear
springbreak = 1             // 1 means NO springbreak adjustment, 0 means adjust weeks for springbreak
now = new Date ()
seconds = now.getTime()
//alert(seconds + ' ' + (seconds - startsec)  + ' ' + now.toDateString() );  // for debug if needed

weeknum = Math.floor((seconds - startsec)  / 604800000)  + springbreak
days = (seconds - startsec)  / 86400000 // number of days since start
//document.write('weeknum is '+weeknum+ ' seconds '+ seconds  + ' startsec '+ startsec + ' days '+ days  + '</TR></TD><TR><TD>\n')
// for debug of the new weekly notes posting



courseInfo = new Array ("111","282","235","182","236","232","190","191")

//<B>Evening Section:</B> Lecture W 6:00-9:00 PM, Lab TH 6:00-9:00 PM, HSLH-133"
courseTimes = new Array ("<!--Lecture TTH 8:00-9:20AM, Lab TTH 9:30-10:50AM,  HSLH-133<BR>--><B>Evening Section: </b>Lecture W 6:00PM-9:05PM, Lab TH 6:00PM-9:05PM,  HSLH-133<BR>" ,
             "TTH 11:00 AM - 12:20 PM , HSLH-133",
             "TTH 11:00 AM - 12:20 PM, HSLH-133",
             "Lecture TTH 8:00 AM - 9:20 AM, Lab TTH 9:30 AM - 10:50 AM, HSLH-133",
             "TTH 11:00 AM - 12:20 PM, HSLH-133",
             "MW 5:30 - 6:50 PM, HSLH-133"
             )

courseNames = new Array ("Introduction to Algorithms and Programming: Java",
             "Advanced Data Structures",
             "Programming C",
             "Data Structures and Program Design",
             "Object Oriented Programming C++",
             "Concepts of Programming Languages",
             "Web Programming: Javascript",
             "CGI Programming: Perl")

bookNames = new Array (
             "Introduction to Java Programming, Brief Version 7th Ed., Author: Liang, ISBN: 0-13-604258-9",
             "Data Structures and Algorithms in Java, 2nd Edition, LaFore",
             "",
             "Data Structures and Algorithms in Java, 2nd Edition, LaFore",
             "",
             "",
             "")

			 //NOTE the spaces on the LAST 3, that is so we can offer 2 option
testNames = new Array ("Quiz 1",
             "Midterm",
             "Quiz 2",
             "Final",
              "Quiz 1 ",
              "Midterm ",
              "Quiz 2 ", 
			  "Final ")

			  // NOTE the last 3 match the last 3 above, alternative dates
testDates = new Array ("March 1 (thurs)",
             "March 29 (thurs)",
             "May 3 (thurs)",
             "May 31 (thurs)",
             "Feb. 29 (weds)",
             "March 28 (weds)",
             "May 2 (weds)",
			 "May 30 (weds)")

			 // uses array courseInfo above
finalDates = new Array ("May 30 (weds)",
             "Dec. 8 (thurs)",
             "May 31 (thurs)",
             "May 31 (thurs)",
             "May 31 (thurs)",
             "May 31 (thurs)")


/* -------------------------------------------------------------------------------------  */

function instructor() {
   document.write('<B><P>Instructor: </B>Chris Ferguson, Office Hours:   ' + officeHours)
   document.write('<BR>Call or email for an appointment, Phone: (661) 362 - 3473 (email is better)')
   document.write('<P>Email: <A HREF="mailto:chris.ferguson@canyons.edu"><FONT SIZE=2>chris.ferguson@canyons.edu</FONT></A> </P>')
   document.write('<p>Web Page: <a href=' + baseURL + '/departments/comp_sci/ferguson>'+ baseURL + '/departments/comp_sci/ferguson</a><br>')
}  // end instructor()

function bookinfo(coursenum) {
   for (i=0; i < courseInfo.length; i++ ) {
     if ( courseInfo[i] == coursenum ) {
      document.write(bookNames[i])
     }
   }

}  // end bookinfo()

function instructor() {
   document.write('<B><P>Instructor: </B>Chris Ferguson, Office Hours:   ' + officeHours)
   document.write('<BR>Call or email for an appointment, Phone: (661) 362 - 3473 (email is better)')
   document.write('<P>Email: <A HREF="mailto:chris.ferguson@canyons.edu"><FONT SIZE=2>chris.ferguson@canyons.edu</FONT></A> </P>')
   document.write('<p>Web Page: <a href=' + baseURL + '/departments/comp_sci/ferguson>'+ baseURL + '/departments/comp_sci/ferguson</a><br>')
}  // end instructor()

function broadcastmessage() {
   now = new Date()
   seconds = now.getTime()
   
   document.write("<B><FONT SIZE=+2 COLOR=red>" + message + "</FONT></B><BR>")
 }  // end broadcastmessage()

function getSemName() {
   document.write(semName)
}  // end getSemName()

function getWeekNum() {
   if ( weeknum > lessonNumber && weeknum < 17 ) { 
	  return weeknum 
   }
   else {
	  return lessonNumber
   }
}  // end getSemName()


function notes(coursenum) {
   document.write('<TABLE WIDTH=100% BORDER=0><TR><TD>\n')

   if ( weeknum > lessonNumber && weeknum < 17 ) { 
       lessonNumber = weeknum
   }
   for(i=lessonNumber; i>=1; i--) {
         document.write('<li><a href=' + aspurl + '?week=' + i + '&coursenum=' + coursenum + '>Lecture Notes - Week ' + i + '</a></li>\n');
   }
   document.write('</TD></TR></TABLE>\n\n')
}  // end notes()

function whenwhere(coursenum) {
   for (i=0; i < courseInfo.length; i++ ) {
     if ( courseInfo[i] == coursenum ) {
      document.write('<B>When and Where:</B> ')
      document.write(courseTimes[i])
     }
   }

}  // end whenwhere(coursenum)

function getCourseName(coursenum) {
   for (i=0; i < courseInfo.length; i++ ) {
     if ( courseInfo[i] == coursenum ) {
      document.write('<B>' + courseNames[i] + '</B> ')
     }
   }

}  // end getCourseName(coursenum)


function getTestTime(testname) {
   for (i=0; i < testNames.length; i++ ) {
     if ( testNames[i] == testname ) {
      document.write(testname + '&nbsp; - &nbsp;<B>' + testDates[i] + '</B> <BR>')
     }
   }

}  // end getTestTime(testname)

function getFinalTime(coursenum) {
   for (i=0; i < courseInfo.length; i++ ) {
     if ( courseInfo[i] == coursenum ) {
      document.write('<B>Final: ' + finalDates[i] + '</B> ')
     }
   }

}  // end getFinalTime(coursenum)


function ShowSurvey(coursenum) {
     if ( doSurvey == "yes" ) {
        if (coursenum == "112")  { document.write("<b>Evening Section:</b> ")}
      document.write('<A HREF='+ baseHREF+ 'cs' + coursenum + '/cs' + coursenum + 'Survey.html>Survey</A>')
     }

}  // end ShowSurvey(coursenum)

function showBaseHREF() {

      document.write('<BASE HREF='+ baseHREF + '>')


}  // end showBaseURL()

