
function errmsg(msg, url, line) {
  var txt;
  txt = "Javascript error has occurred\n";
  txt += "Error message: " + msg + "\n";
  txt += "URL: " + url + "\n";
  txt += "Line #: " + line ;
  alert(txt);
  return true;
}


window.onerror=errmsg;



function build_prof_menu(selected_item) {

  var down;
  down = "../"
  if (selected_item == "Index") {down = "";}
  // first row of menu items
  var title1     = ["Index", "quaver",  "Phantasm", "Parthenia", "Les Voix Humaines", "Fretwork", "Sonnambula" ];
  var link1      = [down+"professionals.html", 
		    down+"quaver/quaver.html",
		    down+"phantasm/phantasm.html", 
                    down+"parthenia/parthenia.html", 
		    down+"voixhumaines/voixhumaines.html", 
                    down+"fretwork/fretwork.html",
                    down+"sonnambula/sonnambula.html",
		   ]; 
  // second row of menu items		   
  var title2     = ["The Rose Consort of Viols", "The Spirit of Gambo", "The Yukimi Kambe Viol Consort"];
  var link2      = [down+"RoseConsort/roseconsort.html",
                    down+"gambo/gambo.html",
                    down+"ykvc/ykvc.html"
                   ];		   
  var n_items
  var item_num;
  var class1, class2, class3;
  
  // Build first row of menu. The first item ("index") is on the left of
  // the menu bar, all others are in a list to the right.
  if (selected_item === title1[0]) {class2 = "class=\"tmSelected\"";} else {class2 = ""}
  document.writeln();
  document.writeln('      <div id="top_menu_background_1">');
  document.writeln('        <ul class="top_menu_left">');
  document.writeln('          <li ' + class2 + '><a href=' + link1[0] + '>' + title1[0] + '</a></li>');
  document.writeln('        </ul>');
  document.writeln('        <ul class="top_menu_right">');
  n_items = title1.length;
  for (item_num=1; item_num<n_items; item_num++) {
    class1 = "";
    class2 = "";
    if (item_num === 1)    {class1 = "rmi";}
    if (selected_item === title1[item_num]) {class2 = "tmSelected";}
    class3 = class1 + ' ' + class2;
    if (class3.length > 1) {class3 = "class=\"" + class3 + "\"";}
    document.writeln('          <li ' + class3 + '><a href="', link1[item_num], '">', title1[item_num],  '</a></li>');
  }
  document.writeln('        </ul>');
  document.writeln('        <div style="clear:both"></div>');
  document.writeln('      </div> <!-- end top_menu_background_1 -->');


  // Build second row of menu.
  document.writeln();
  document.writeln('      <div id="top_menu_background_2">');
  document.writeln('        <ul class="top_menu_right">');
  n_items = title2.length;
  for (item_num=0; item_num<n_items; item_num++) {
    class1 = "";
    class2 = "";
    if (item_num === 0)        {class1 = "rmi";}
    // the following produces a black bar to the left of the left-most menu item.
    // This was added when YKVC were the only group on the second menu line, and
    // might be removed if more groups get added.
    if (item_num === n_items-1)             {class1 = (class1 + " lmi_special");}
    if (selected_item === title2[item_num]) {class2 = "tmSelected";}
    class3 = class1 + ' ' + class2;
    if (class3.length > 1) {class3 = "class=\"" + class3 + "\"";}
    document.writeln('          <li ' + class3 + '><a href="', link2[item_num], '">', title2[item_num],  '</a></li>');
  }
  document.writeln('        </ul>');
  document.writeln('        <div style="clear:both"></div>');
  document.writeln('      </div> <!-- end top_menu_background_2 -->');

} // end build_prof_menu


