var quote = String.fromCharCode(34);

function isExplorer () {
  return (getBrowserName() == "Microsoft Internet Explorer");
}

function isNetscape () {
  return (getBrowserName() == "Netscape");
}

function setBannerPosition () {
  var banner = document.getElementById("banner");
  if (banner) {
    if (isExplorer())
      banner.style.left = (document.body.offsetWidth / 3.3);
    if (isNetscape())
      banner.style.left = (window.innerWidth / 3.3);
  }
  return (true);
}

function setTextAreaSize () {
  var textArea = document.getElementById("textArea");
  if (textArea) {
    if (isExplorer()) {
      textArea.style.width = (document.body.offsetWidth - 20);
      textArea.style.height = (document.body.offsetHeight - 25);
    }
    if (isNetscape()) {
      textArea.style.width = (window.innerWidth - 40);
      textArea.style.height = (window.innerHeight - 40);
    }
  }
  return (true);
}

function setBrowserSize () {
  if (isExplorer()) window.top.resizeTo(799, 599);
  if (isNetscape()) window.resizeTo(799, 599);
  return (true);
}

function getBrowserName () {
  return (navigator.appName);
}

function getDate () {
  var now   = new Date();
  var day   = now.getDate();
  var month = now.getMonth() + 1;
  var year  = now.getFullYear();
  if (month < 10) month = "0" + month;
  return (day + "/" + month + "/" + year);
}

function menu (command, text, href, target) {
  switch (command) {
    case "create":
      document.write("<table width=", quote, "100%", quote, ">");
    break;
    case "add":
      document.write("<tr><td>");
      document.write("<p class=", quote, "defaultMenu", quote);
      document.write(" onmouseout=", quote, "this.className='defaultMenu';", quote);
      document.write(" onmouseover=", quote, "this.className='selectedMenu';", quote, ">");
      document.write("<img src=", quote, "../../img/emblem.gif", quote, " align=", quote, "left", quote, "/>");
      document.write("<a class=", quote, "menuText", quote, " href=", quote, href, quote, " target=", quote, target, quote, ">", text, "</a>");
      document.write("</p></td></tr>");
    break;
    case "break":
      document.write("<tr><td><br></td></tr>");
    break;
    case "done":
      document.write("</table>");
      document.writeln;
    break;
  }
  return (true);
}
