/* Java script for Bill Murdocks web pages*/
/* Originally based on sheet from Kalyan Moy Gupta */

function dynamicFraming() {
FRAMESET_TEMPLATE =
'<html> \
<head> \
<meta http-equiv="Content-Type" \
content="text/html;charset=iso-8859-1"> \
<title>Bill Murdock</title> \
<LINK REL=stylesheet type="text/css" HREF="jwmcss.css"> \
<BASE TARGET = "_top"> \
</head> \
<frameset framespacing="0" border="false" frameborder="0" \
rows="55,*,55" cols="*"> \
   <frame name="HEADER" scrolling="no" noresize target="Content" \
   src="titleMain.html" marginwidth="0" marginheight="0"> \
   <frameset cols="1*,480,1*" frameborder="0" rows="*"> \
        <frame name="MENU" target="CONTENT" scrolling="NO" \
	src="menuMain.html" marginwidth="0" \
        marginheight="0"> \
        <frame name="CONTENT" src="___CONTENT_SOURCE___" scrolling="Auto" \
	marginwidth="0" marginheight="0" \
        TARGET="CONTENT"> \
        <frame name="SIDEBAR" target="CONTENT" scrolling="NO" \
	src="sideBarBlank.html" marginwidth="0" \
        marginheight="0"> \
  </frameset> \
  <frame name="FOOTER" scrolling="no" noresize target="Content" \
  src="footerMain.html" marginwidth="0" marginheight="0"> \
  <noframes> \
  <body> \
<font size="+2"> \
<p>Hello, all! I am m Dr. J. William Murdock (Bill Murdock). I work in \
the T.J. Watson Research Center at IBM. I am a computer scientist; my \
research area is Artificial Intelligence. Specific topics of interest \
to me include knowledge-based reasoning, functional models of \
processes, reflection, explanation, design, planning, learning, \
cognitive science, and natural-language processing.</p> \
</font> \
  </body> \
  </noframes> \
  </frameset> \
</html>';

PARENTED_FLAG = "?parented";

if( location.search != PARENTED_FLAG )
{
   var url = location.href;
   var hash = location.hash;
   var prehash = url;
   if (hash != "") {
      prehash = url.substring(0, url.indexOf('#'));
   }
   var contentFrameUrl = prehash + PARENTED_FLAG + hash;
//   alert(contentFrameUrl);

   var framesetHtml = FRAMESET_TEMPLATE.
       replace(/___CONTENT_SOURCE___/, contentFrameUrl);

   document.write(framesetHtml);
   document.close();
}
else
{
   parent.document.title = parent.contentFrame.document.title;
}
}

function recentVer()
 {
 return document.getElementById;
 }

function home()
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarBlank.html";
  window.parent.frames["CONTENT"].location="index.html?parented";
  }

function contact() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarBlank.html";
  window.parent.frames["CONTENT"].location="contact.html?parented";
  }

function projects() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarProjects.html";
  window.parent.frames["CONTENT"].location="projects.html?parented"; 
  }

function publications() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarPublications.html";
  window.parent.frames["CONTENT"].location="publications.html?parented"; 
  }

function presentations() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarPresentations.html";
  window.parent.frames["CONTENT"].location="presentations.html?parented"; 
  }

function work() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarWork.html";
  window.parent.frames["CONTENT"].location="work.html?parented"; 
  }

function fun() 
  {
  clearBold();
  window.parent.frames["SIDEBAR"].location="sideBarFun.html";
  window.parent.frames["CONTENT"].location="fun.html?parented"; 
  }

function clearBold()
  {
    window.parent.frames["MENU"].document.getElementById("homeLabel").innerHTML="Home";
    window.parent.frames["MENU"].document.getElementById("contactLabel").innerHTML="Contact";
    window.parent.frames["MENU"].document.getElementById("projectsLabel").innerHTML="Projects";
    window.parent.frames["MENU"].document.getElementById("publicationsLabel").innerHTML="Publications";
    window.parent.frames["MENU"].document.getElementById("presentationsLabel").innerHTML="Presentations";
    window.parent.frames["MENU"].document.getElementById("workLabel").innerHTML="Work Links";
    window.parent.frames["MENU"].document.getElementById("funLabel").innerHTML="Fun Links";
  } 

function setHomeLabel()
  {
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("homeLabel").innerHTML="<font color=\"green\">Home</font>";
  }
  }

function setContactLabel()
  {
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("contactLabel").innerHTML="<font color=\"green\">Contact</font>";
  }
  }

function setProjectsLabel()
  {
  window.parent.frames["SIDEBAR"].location="sideBarProjects.html";
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("projectsLabel").innerHTML="<font color=\"green\">Projects</font>";
  }
  }

function setPubsLabel()
  {
  window.parent.frames["SIDEBAR"].location="sideBarPublications.html";
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("publicationsLabel").innerHTML="<font color=\"green\">Publications</font>";
  }
  }

function setPresentationsLabel()
  {
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("presentationsLabel").innerHTML="<font color=\"green\">Presentations</font>";
  }
  }

function setWorkLabel()
  {
  window.parent.frames["SIDEBAR"].location="sideBarWork.html";
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("workLabel").innerHTML="<font color=\"green\">Work Links</font>";
  }
  }

function setFunLabel()
  {
  window.parent.frames["SIDEBAR"].location="sideBarFun.html";
  if (recentVer()) {
    window.parent.frames["MENU"].document.getElementById("funLabel").innerHTML="<font color=\"green\">Fun Links</font>";
  }
  }

/* I used to have many of these lines:
      if (navigator.appName != "Netscape") {}
   I'm leaving the code there, just in case it comes up again */

/* Similar samples:

var newline=null
function populate(textareaObject){
   if (navigator.appVersion.lastIndexOf('Win') != -1)
      newline="\r\n"
      else newline="\n"
   textareaObject.value="line 1" + newline + "line 2" + newline 
   + "line 3"
}

if(navigator.appName == "Netscape")
{
 window.location = "NetscapeHome.html"
}

 */

function makeMonths ()
 {
 this[0]="January";
 this[1]="February";
 this[2]="March";
 this[3]="April";
 this[4]="May";
 this[5]="June";
 this[6]="July";
 this[7]="August";
 this[8]="September";
 this[9]="October";
 this[10]="November";
 this[11]="December";
 return this;
 }

// code commented out because it does not work on my new server
function writeModifiedDate()
 {
/*  months = new makeMonths ();
  lmDate = new Date (document.lastModified);
  if (lmDate.getFullYear) {
    document.write("<hr><p class=\"note\">Document Last Modified: "+months[lmDate.getMonth()]+" "+lmDate.getDate()+", "+lmDate.getFullYear()+"</p>");
  } else {
    document.write("<hr><p class=\"note\">Document Last Modified: "+months[lmDate.getMonth()]+" "+lmDate.getDate()+", "+lmDate.getYear()+"</p>");
  } */
 }
