base = "http://www.cs.unc.edu/~reb/";

function displayHeader(title, title2){
  document.write(   '<P><CENTER class="header">' + title  + '</center>\n');
  if(!isEmpty(title2))
    document.write('<BR><CENTER class="header">' + title2 + '</center>\n');
  breadCrumb();
  document.write('</P>');
  return;
}

function displayFooter(){
  //document.write('<P align="right">reb&#64;cs.unc.edu</P>\n');
  document.write('<P align="right">reb \'at\' cs.unc.edu</P>\n');

  //for(var i = 0; i <500; i++){
  //  document.write(i + ': &#' + i + ';<BR>\n'); 
  //}  
  return;
}

function isEmpty(s){
  s = String(s);
  if(s == "" || s == "null" || s == "undefined")
    return true;
  return false;
}

function breadCrumb(){   
  var path = String(document.URL).split("~reb/");
  if(path.length != 2)
    return;
  var dirs = path[1].split("/");
  var current  = "";
  var file = "index.html";
  var i;
  var length = dirs.length - 1;
  if(length != 0)
    document.write('<A class="breadcrumb" href="' + base + file + '">Home</A>');
  if(dirs[length] == "index.html" || isEmpty(dirs[length]))
    length--;
  for (i=0;i<length;i++){
    var d = dirs[i];
    current += d + "/";
    if(d != "assignments" && d != "spring-2004" && d != "summer-2004"){
      d = String(d.charAt(0)).toUpperCase() + d.substring(1, d.length);
      //if the last 3 are numbers add a space
      if(!isNaN(d.substring(d.length-3, d.length))){
        d = d.substring(0, d.length - 3) + " " + d.substring(d.length-3, d.length);
      }
      else if(!isNaN(d.substring(d.length-1, d.length))){
        d = d.substring(0, d.length - 1) + " " + d.substring(d.length-1, d.length);
      }
      document.write('<font  class="breadcrumb">-></font><A class="breadcrumb" href="' + base + current + file + '">'+ d + '</A>');
    }
  }
  return;
}
