var imageHash = new Array();

function getElement(id)
{
   return document.getElementById
      ? document.getElementById(id)
      : document.all
      ? document.all[id]
      : null;
}

function initPage()
{
   var image = [
      [ "email0",        14, 10 ],
      [ "email1",        14, 10 ],

      [ "SubMenu1Bg1",    8, 26 ],
      [ "SubMenu1Bg2",    1, 26 ],
      [ "SubMenu1Bg3",    8, 26 ],
                         
      [ "SubMenu1On1",    8, 26 ],
      [ "SubMenu1On2",    1, 26 ],
      [ "SubMenu1On3",    8, 26 ],
                         
      [ "SubMenu3Bg11",   8, 26 ],
      [ "SubMenu3Bg12",   1, 26 ],
      [ "SubMenu3Bg13",   8, 26 ],
                         
      [ "SubMenu3Bg21",   8, 26 ],
      [ "SubMenu3Bg22",   1, 26 ],
      [ "SubMenu3Bg23",   8, 26 ],
                         
      [ "SubMenu3Bg31",   8, 26 ],
      [ "SubMenu3Bg32",   1, 26 ],
      [ "SubMenu3Bg33",   8, 26 ],
                         
      [ "SubMenu3On11",   8, 26 ],
      [ "SubMenu3On12",   1, 26 ],
      [ "SubMenu3On13",   8, 26 ],
                         
      [ "SubMenu3On21",   8, 26 ],
      [ "SubMenu3On22",   1, 26 ],
      [ "SubMenu3On23",   8, 26 ],
                         
      [ "SubMenu3On31",   8, 26 ],
      [ "SubMenu3On32",   1, 26 ],
      [ "SubMenu3On33",   8, 26 ],
                         
      [ "ButtonBg11",     8, 26 ],
      [ "ButtonBg12",     1, 26 ],
      [ "ButtonBg13",     8, 26 ],
      [ "ButtonBg14",     8, 26 ],
                         
      [ "ButtonOn11",     8, 26 ],
      [ "ButtonOn12",     1, 26 ],
      [ "ButtonOn13",     8, 26 ],
      [ "ButtonOn14",     8, 26 ],

      [ "SubMenu3Bg11os", 8, 26 ],
      [ "SubMenu3Bg13os", 8, 26 ],
      [ "SubMenu3Bg31os", 8, 26 ],
      [ "SubMenu3Bg33os", 8, 26 ],
      [ "SubMenu3On11os", 8, 26 ],
      [ "SubMenu3On13os", 8, 26 ],
      [ "SubMenu3On31os", 8, 26 ],
      [ "SubMenu3On33os", 8, 26 ],

      [ null,            0,  0 ]
   ];

   for (i = 0; image[i][0] != null; i++) {
      imageHash[image[i][0]] = new Image(image[i][1], image[i][2]);
      imageHash[image[i][0]].src = "/images/" + image[i][0] + ".jpg";
   }

   return true;
}

function updateSubMenu1Bg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu1On1";
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu1On2";
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu1On3";
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu1Bg1";
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu1Bg2";
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu1Bg3";
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color ="#595959";
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu1Fg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu31Bg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3On11";
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3On12";
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3On13";
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3Bg11";
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3Bg12";
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3Bg13";
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#595959";
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu31Fg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + part)) != null) {
         hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "underline";
      }
   } else {
      if ((hnd = getElement(id + part)) != null) {
         hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu32Bg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3On21";
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3On22";
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3On23";
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3Bg21";
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3Bg22";
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3Bg23";
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#595959";
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu32Fg(id, part, on)
{
   return updateSubMenu31Fg(id, part, on);
}

function updateSubMenu33Bg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3On31";
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3On32";
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3On33";
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "SubMenu3Bg31";
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "SubMenu3Bg32";
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "SubMenu3Bg33";
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#595959";
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateSubMenu33Fg(id, part, on)
{
   return updateSubMenu31Fg(id, part, on);
}

function updateSubMenu4(id, on)
{
   var suffix = [ "11", "12", "13", "21", "22", "23", "31", "32", "33", null ];

   if (on) {
      for (i = 0; suffix[i] != null; i++) {
         if ((hnd = getElement(id + suffix[i])) != null) {
            hnd.className = "SubMenu4On" + suffix[i];
         }
         if ((hnd = getElement(id + "Link")) != null) {
            hnd.style.textDecoration = "underline";
         }
      }

   } else {
      for (i = 0; suffix[i] != null; i++) {
         if ((hnd = getElement(id + suffix[i])) != null) {
            hnd.className = "SubMenu4Bg" + suffix[i];
         }
         if ((hnd = getElement(id + "Link")) != null) {
            hnd.style.textDecoration = "none";
         }
      }
   }

   return true;
}

function updateButton(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "ButtonOn11";
         if (part == 1) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2a")) != null) {
         hnd.className = "ButtonOn12";
         if (part == '2a') hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "ButtonOn12";
         if (part == 2) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "2b")) != null) {
         hnd.className = "ButtonOn12";
         if (part == '2b') hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "ButtonOn13";
         if (part == 3) hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

   } else {
      if ((hnd = getElement(id + "1")) != null) {
         hnd.className = "ButtonBg11";
         if (part == 1) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2a")) != null) {
         hnd.className = "ButtonBg12";
         if (part == '2a') hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2")) != null) {
         hnd.className = "ButtonBg12";
         if (part == 2) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "2b")) != null) {
         hnd.className = "ButtonBg12";
         if (part == '2b') hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "3")) != null) {
         hnd.className = "ButtonBg13";
         if (part == 3) hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#595959";
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateButtonFg(id, part, on)
{
   if (on) {
      if ((hnd = getElement(id + part)) != null) {
         hnd.style.cursor = "pointer";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "underline";
      }
   } else {
      if ((hnd = getElement(id + part)) != null) {
         hnd.style.cursor = "default";
      }
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.textDecoration = "none";
      }
   }

   return true;
}

function updateEmail(id, on)
{
   if (on) {
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#004899";
         hnd.style.textDecoration = "underline";
      }

      if ((hnd = getElement(id + "Icon")) != null) {
         hnd.src = imageHash["email1"].src;
      }

   } else {
      if ((hnd = getElement(id + "Link")) != null) {
         hnd.style.color = "#595959";
         hnd.style.textDecoration = "none";
      }

      if ((hnd = getElement(id + "Icon")) != null) {
         hnd.src = imageHash["email0"].src;
      }
   }

   return true;
}
