function blinkIt() {
  if (!document.all) return;
  else {
    for(i=0;i<document.all.tags('blink').length;i++){
      s=document.all.tags('blink')[i];
      s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
    }
  }
}

function loadXMLDoc(dname) {
  try { //Internet Explorer
    xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  }
  catch(e) {
    try { //Firefox, Mozilla, Opera, etc.
      xmlDoc=document.implementation.createDocument("","",null);
    }
    catch(e) {
      //alert(e.message);
      return(null);
    }
  }

  try {
    xmlDoc.async=false;
    xmlDoc.load(dname);
    return(xmlDoc);
  }
  catch(e) {
    //alert(e.message);
    return(null);
  }
}

function txtperfTable(year) {
  var txt = "<table class='ptable' cellpadding='5' cellspacing='1' border='0'>";
  var x=xmlDoc.getElementsByTagName("GIG");
  for (var i=0;i<x.length;i++) {
    var myyear=x[i].getElementsByTagName("DATE")[0].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue;
    if ( myyear == year ) {
      txt = txt + "<tr>";
      var y = x[i].getElementsByTagName("DATE")[0];

      txt = txt + "<td class='contentcell'>";
      txt = txt + "<p>" + y.getElementsByTagName("DAY")[0].childNodes[0].nodeValue + " ";
      txt = txt + y.getElementsByTagName("MONTH")[0].childNodes[0].nodeValue;
      txt = txt + "</td>";

      txt = txt + "<td class='contentcell'>";
      txt = txt + "<p>" + x[i].getElementsByTagName("EVENT")[0].childNodes[0].nodeValue;
      txt = txt + "</td>";

      txt = txt + "<td class='contentcell'>";
      txt = txt + "<p>" + x[i].getElementsByTagName("VENUE")[0].childNodes[0].nodeValue;
      txt = txt + "</td>";
      txt = txt + "</tr>";
    }
  }
  txt = txt + "</table>";
  return txt;
}

function txtperfRow(year) {
  var txt = "<tr>";
  txt = txt + "  <td>";
  txt = txt + "    <table class='ptable' cellpadding=10 cellspacing=0 border=0>";
  txt = txt + "      <tr>";
  txt = txt + "        <td>";
  txt = txt + "          <p class='subheading'>" + year + "</p>";
  txt = txt + "          <p>";
  txt = txt + "            <table class='ptable' border=0 bgcolor=#3366CC cellpadding=2 cellspacing=2>";
  txt = txt + "              <tr><td>";
  txt = txt + txtperfTable(year);
  txt = txt + "              </td> </tr>";
  txt = txt + "            </table>";
  txt = txt + "          </p>";
  txt = txt + "        </td>";
  txt = txt + "      </tr>";
  txt = txt + "    </table>";
  txt = txt + "  </td>";
  txt = txt + "</tr>";
  return txt;
}

function perfTable(year) {
  document.write("<table cellpadding='10' cellspacing='1' border='0'>");
  var x=xmlDoc.getElementsByTagName("GIG");
  for (var i=0;i<x.length;i++) {
    var myyear=x[i].getElementsByTagName("DATE")[0].getElementsByTagName("YEAR")[0].childNodes[0].nodeValue;
    if ( myyear == year ) {
      document.write("<tr>");
      var y=x[i].getElementsByTagName("DATE")[0];

      document.write("<td class='contentcell'>");
      document.write("<p>" + y.getElementsByTagName("DAY")[0].childNodes[0].nodeValue + " ");
      document.write(y.getElementsByTagName("MONTH")[0].childNodes[0].nodeValue);
      document.write("</td>");

      document.write("<td class='contentcell'>");
      document.write("<p>" + x[i].getElementsByTagName("EVENT")[0].childNodes[0].nodeValue);
      document.write("</td>");

      document.write("<td class='contentcell'>");
      document.write("<p>" + x[i].getElementsByTagName("VENUE")[0].childNodes[0].nodeValue);
      document.write("</td>");
      document.write("</tr>");
    }
  }
  document.write("</table>");
}

function perfRow(year) {
  document.write("<tr>");
  document.write("  <td>");
  document.write("    <table cellpadding=10 cellspacing=10 border=0>");
  document.write("      <tr>");
  document.write("        <td valign=top align=left>");
  document.write("          <p class='subheading'>Past Performances - " + year + "</p>");
  document.write("          <p>");
  document.write("            <table bgcolor=#3366CC cellpadding=10 cellspacing=10>");
  document.write("              <tr><td>");
  perfTable(year);
  document.write("              </td> </tr>");
  document.write("            </table>");
  document.write("          </p>");
  document.write("        </td>");
  document.write("      </tr>");
  document.write("    </table>");
  document.write("  </td>");
  document.write("</tr>");
}

function switchMenu(obj) {
  var el = document.getElementById(obj);

  if ( el.style.display != "none" ) {
el.style.display = 'none';
  }
  else {
el.style.display = '';
  }
}

function showMe(year) {
  document.getElementById("show").innerHTML = txtperfRow(year);
}
function showPics() {
  document.getElementById("show").innerHTML = photoTable();
}
function photoTable() {
  document.write("<div id=show>");
  document.write("<table cellpadding=8 cellspacing=0 border=0>");
  document.write("  <tr>");
  document.write("    <td></td>");
  document.write("    <td>");
  document.write("      <p>");
  photoData();
  document.write("      </p>");
  document.write("    </td>");
  document.write("  </tr>");
  document.write("</table>");
//  document.write("</div>");


}
function photoData() {
//<div class="img">
//  <a target="_blank"><img src="/photos/performers/thumbs/davidh-02.jpg" alt="picture" width="105" height="70" /></a>
//  <div class="desc">David H</div>
//</div> <!-- img -->

  var x=xmlDoc.getElementsByTagName("PHOTO");
  var category;
  var pic;
  var caption;

  for (var i=0;i<x.length;i++) {
    category = x[i].getElementsByTagName("CATEGORY")[0].childNodes[0].nodeValue;
    pic = x[i].getElementsByTagName("NAME")[0].childNodes[0].nodeValue;
    caption = x[i].getElementsByTagName("CAPTION")[0].childNodes[0].nodeValue;

    document.write("<div class='img'>");
    document.write("  <a target='_new' href='/photos/" + category + "/" + pic + "'><img src='/photos/" + category + "/thumbs/" + pic + "' alt='Click to enlarge' width='100' height='150' /></a>");
    document.write("  <div class='desc'>" + caption + "</div>");
    document.write("</div>");
  }
}


function selectActive(id, pos) {
  if ( id == pos ) return 2;
  return 3;
}

function doSubMenu(activePos) {
  document.write("<div id='l1-1' class='pubmenulinks" + selectActive(1,activePos) + "'>");
  document.write(" <a class='pubmenulinks" + selectActive(1,activePos) + "' target='_top' href='/about.html'>Introduction</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(1,activePos) + "' target='_top' href='/performances.html'>Performances</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(1,activePos) + "' target='_top' href='/news.html'>News</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(1,activePos) + "' target='_top' href='/history.html'>History</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(1,activePos) + "' target='_top' href='/links.html'>Links</a>");
  document.write("</div>");

  document.write("<div id='l2-2' class='pubmenulinks" + selectActive(2,activePos) + "'>");
  document.write(" <a class='pubmenulinks" + selectActive(2,activePos) + "' target='_top' href='/performers.html'>Photos</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(2,activePos) + "' target='_top' href='/video.html'>Videos</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(2,activePos) + "' target='_top' href='/articles.html'>Articles</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(2,activePos) + "' target='_top' href='/credits.html'>Credits</a>");
  document.write("</div>");

  document.write("<div id='l3-3' class='pubmenulinks" + selectActive(3,activePos) + "'>");
/*
  document.write(" <a class='pubmenulinks" + selectActive(3,activePos) + "' target='_top' href='/workshops.html'>Workshops</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(3,activePos) + "' target='_top' href='/book.html'>Book Online</a>");
*/
  document.write("</div>");

  document.write("<div id='l4-4' class='pubmenulinks" + selectActive(4,activePos) + "'>");
  document.write(" <a class='pubmenulinks" + selectActive(4,activePos) + "' target='_top' href='/contact.html'>General Enquiries</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(4,activePos) + "' target='_top' href='/book.html'>Booking Info</a> \|");
  document.write(" <a class='pubmenulinks" + selectActive(4,activePos) + "' target='_top' href='/location.html'>Location</a>");
  document.write("</div>");
}

function doNewNav() {
  document.write("<ul id='sddm'>");
  document.write("<li><a href='i.html'>Home</a></li>");
  document.write("<li><a href='about_waitaiko.html' onmouseover='mopen(\"m2\")' onmouseout='mclosetime()'>About Us</a>");
  document.write("<div id='m2' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
/*
  document.write("<a href='about.html'>Introduction</a>");
  document.write("<a href='history.html'>History</a>");
*/
  document.write("<a href='about_waitaiko.html'>About Wai Taiko</a>");
  document.write("<a href='about_what_is_taiko.html'>What is Taiko?</a>");
  document.write("<a href='about_history_of_taiko.html'>History of Taiko</a>");
  document.write("<a href='performances.html'>Performances</a>");
  document.write("<a href='news.html'>News</a>");
  document.write("<a href='links.html'>Links</a>");
  document.write("<a href='credits.html'>Credits</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("<li><a href='media.html' onmouseover='mopen(\"m3\")' onmouseout='mclosetime()'>Media</a>");
  document.write("<div id='m3' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='media.html'>Photos</a>");
  document.write("<a href='video.html'>Video</a>");
  document.write("<a href='articles.html'>Newspaper Articles</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("<li><a href='workshops_info.html' onmouseover='mopen(\"m4\")' onmouseout='mclosetime()'>Workshops</a>");
  document.write("<div id='m4' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='workshops_info.html'>General Information</a>");
  document.write("<a href='workshops_registration.html'>Registration</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("<li><a href='contact.html' onmouseover='mopen(\"m5\")' onmouseout='mclosetime()'>Contact Us</a>");
  document.write("<div id='m5' onmouseover='mcancelclosetime()' onmouseout='mclosetime()'>");
  document.write("<a href='contact.html'>General Enquiries</a>");
  document.write("<a href='book.html'>Booking Information</a>");
  document.write("<a href='location.html'>Location</a>");
  document.write("</div>");
  document.write("</li>");
  document.write("</ul>");
  document.write("<div style='clear:both'></div>");
}

function doNav(activePos) {
  var nav = new Array();
  nav[0] = "/index.html";
  nav[1] = "/about.html";
  nav[2] = "/media.html";
  nav[3] = "/workshops.html";
  nav[4] = "/contact.html";

  document.write(" <div id='logoWrapper'> ");
  document.write(" <div id='logo'><a href='http://www.waitaiko.com/'><img src='/images/Logo.png' alt='Wai Taiko' title='Wai Taiko' width='155' height='45' /></a></div> ");
  document.write(" <div id='navWrapper'> ");
  document.write(" <div id='Table_01'> ");

  for (i=0; i < nav.length; i++) {
    j=i+1;
    if ( i == activePos ) {
      document.write(" <div id='navlinks" + i + "'><a target='_top'><img src='/images/menuSelected_0" + j + ".png' width='142' height='30' /></a></div> ");
    }
    else {
      document.write(" <div id='navlinks" + i + "'><a href='" + nav[i] + "' onmouseover=\"setVisible('l" + i + "-" + i + "');\" onfocus='if(this.blur)this.blur()' onmouseout=\"setVisible('l" + activePos + "-" + activePos + "');\"><img src='/images/menuUnselected_0" + j + ".png' width='142' height='30' id='Image" + j + "' onmouseover=\"MM_swapImage('Image" + j + "','','/images/menuMouse_0" + j + ".png',1)\" onmouseout='MM_swapImgRestore()' /></a></div> ");
    }
  }

  document.write(" </div> ");
  document.write(" </div> ");

  doSubMenu(activePos);

  document.write(" <div id='l0-0'></div> ");
  document.write(" </div> ");
}

function doFooter() {
  document.write("<div id='myFooter'>");
  document.write("  <p class='style5'>Copyright &#169;2009 Wai Taiko Drummers.  All rights reserved.</p>");
  document.write("</div>");
}

function doPerfList() {
  document.write("<div id='upcomingList'>");
  document.write("  <p class='style3'>Wai Taiko Concerts</p>");
  document.write("  <p class='style5'> <a href='12DaysXmas.html'>12 Days of Christmas</a></p>");
  document.write("  <p class='style5'> <a href='IGI.html'>Ichi Go Ichie</a></p>");
  document.write("  <p class='style5'> <a href='taiko_festival.html'>Taiko Festival</a></p>");
  document.write("  <p class='style5'> <a href='taste_of_japan.html'>A Taste of Japan</a></p>");
  document.write("</div>");
}
