var TkFragmentNow = Class.create();
TkFragmentNow.prototype = {
  initialize: function(assetPath) {
    this.assetPath = assetPath;
  },

  write: function() {
    var dayNames = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
    var monthNames = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
    var now = new Date();
    document.write(dayNames[now.getDay()] + ',&#160;' + monthNames[now.getMonth()] + '&#160;' + now.getDate() + ',&#160;' + now.getFullYear());
  }
}

function tkAddBookmark(title, url) {
  if (window.sidebar) { // Firefox
    // window.sidebar.addPanel(title, url, '');
    alert('Please press Ctrl-D to bookmark this page.');
  } else if (window.opera && window.print){ // Opera
	var a = document.createElement('a');
	a.setAttribute('href', url);
	a.setAttribute('rel', 'sidebar');
	a.setAttribute('title', title);
	a.click();
  } else if (document.all) { // Internet Explorer
	window.external.AddFavorite(url, title);
  }
}

var TkFragmentCopyright = Class.create();
TkFragmentCopyright.prototype = {
  initialize: function(assetPath, options) {
    this.assetPath = assetPath;
    this.node = g_navNode_Root;
    this.options = {
      className: 'navigation',
      showhome: true
    }
    Object.extend(this.options, options || {});
    this.once = false;
  },

  write: function() {
    document.write('<span class="' + this.options.className + '">');
    this.writeNode(this.node);
    document.write('</span>');
  },

  writeNode: function(node) {
    var level = node.m_level;
    if (level == 1 || (level == 0 && this.options.showhome)) {
      var html = '';
      if (this.once) {
        html += ' | ';
      }
      html += '<a href="' + node.m_href + '">' + node.m_label + '</a>';
      document.write(html);
      this.once = true;
    }
    for (var i = 0; i < node.m_subNodes.length; i++) {
      this.writeNode(node.m_subNodes[i], node.m_id);
    }
  }
}
