var mainFlag=false;			// used to indicate if you are over the main menu
var menuCoords; // Coordinates defining defining each menu item
var leftNav = false;
function init(pag) {
menuCoords = new Array(); // Coordinates defining the right bound position of each Menu Item and ending with the farthest right position	
if (pag == "hm") {
menuCoords[0] = new Array(55,0,153,13);
menuCoords[1] = new Array(177,0,266,13);
menuCoords[2] = new Array(387,0,527,13);
menuCoords[3] = new Array(552,0,637,13);
menuCoords[4] = new Array(83,14,182,26);
menuCoords[5] = new Array(223,14,391,26);
menuCoords[6] = new Array(439,14,603,26);
} else {
menuCoords[0] = new Array(0,1,101,14);
menuCoords[1] = new Array(101,1,187,14);
menuCoords[2] = new Array(283,1,425,14);
menuCoords[3] = new Array(425,1,512,14);
menuCoords[4] = new Array(31,15,122,28);
menuCoords[5] = new Array(148,15,309,28);
menuCoords[6] = new Array(334,15,498,28);
}
showDiv("mainMenuMap");
/*
if (document.all && document.all.leftNavMap){
showDiv('leftNavMap');
} else if (document.leftNavMap){
showDiv('leftNavMap');
}
*/
if (isDiv("leftNavMap")) {
showDiv('leftNavMap');
}
}
function jaInit(lang) {
if (lang == "j") {
menuCoords = new Array(); // Coordinates defining the right bound position of each Japanese Menu Item and ending with the farthest right position	
menuCoords[0] = new Array(280,95,400,117);
menuCoords[1] = new Array(510,95,550,117);
menuCoords[2] = new Array(660,95,720,117);
menuCoords[3] = new Array(830,60,973,90);
showDiv('mainMenuMap');
} else if (lang == "j2") {
menuCoords = new Array(); // Coordinates defining the right bound position of each Japanese Menu Item and ending with the farthest right position	
menuCoords[0] = new Array(200,95,250,117);
menuCoords[1] = new Array(360,95,490,117);
menuCoords[2] = new Array(600,95,640,117);
menuCoords[3] = new Array(750,95,803,117);
menuCoords[4] = new Array(830,60,973,90);
showDiv('mainMenuMap');
}
/*
if (document.all && document.all.leftNavMap){
showDiv('leftNavMap');
} else if (document.leftNavMap){
showDiv('leftNavMap');
}
*/
if (isDiv("leftNavMap")) {
showDiv('leftNavMap');
}
}
function overMenu(whichMain,c1,c2,c3,c4){
var menNum = whichMain-1;
if (menNum <= 6){
hideDiv("mainMenuHover"); // for Mac compatibility
clipDiv("mainMenuHover",menuCoords[menNum][1],menuCoords[menNum][2],menuCoords[menNum][3],menuCoords[menNum][0]);
showDiv("mainMenuHover");
mainFlag = true;
} else {
hideDiv("leftNavHover"); // for Mac compatibility
clipDiv("leftNavHover",c2,c3,c4,c1);
showDiv("leftNavHover");
leftNav = true;
}
}
function offMenu(){
if (mainFlag){
mainFlag = false;
eval("setTimeout('delayIt(1)',100)");
} else if (leftNav) {
leftNav = false;
eval("setTimeout('delayIt(2)',100)");
}
}
function delayIt(which) {
if (which == 1 && mainFlag == false){
clipDiv('mainMenuHover',0,0,0,0);
} else if (which == 2 && leftNav == false){
clipDiv('leftNavHover',0,0,0,0);
}
}
/***************************************************
This function is for the left nav functionality in IE
****************************************************/
function startList() {
if (document.all&&document.getElementById) {
if (isDiv("mainnavcontainer")) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
if (isDiv("subnav")) {
navRoot = document.getElementById("subnav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
}
var timer = 0;
var prev_idNum = "";
var reset = false;
function loadMenu(idNum) {
if ((idNum && (prev_idNum != idNum)) || !idNum) {
if (prev_idNum != "") {
for (var k = 1; k<=10; k++) {
if (document.getElementById('mmenu'+k+'Hover')) {
var hoverId = "mmenu"+k+"Hover";
var item = document.getElementById(hoverId);
var regId = "mmenu"+k;
item.id = regId;
}
}
document.getElementById('smenu'+prev_idNum).style.display='none';
}
if (!reset) {
for (var i = 1; i<=10; i++) {
if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
}
reset = false;
} 
}
if (idNum) { 
var m = "mmenu"+idNum;
var s = "smenu"+idNum;
var main = document.getElementById(m);
var sub = document.getElementById(s);
if (main) {var newId = "mmenu"+idNum+"Hover";}
if (sub) {
sub.style.display='block';
if (main) {main.id = newId;}
clearTimeout(timer); 
}
prev_idNum = idNum; 
//hideMenu(); 
}
}
function resetMenu(menu){
reset = true; 
clearTimeout(timer);
loadMenu(menu);
}
function hideMenu(){
timer = setTimeout("loadMenu()",2000);
}
function hilightImg(imgNum) { 
imgSrc = document.getElementById(imgNum).src;
if (imgSrc.indexOf("0r") == -1) {
document.getElementById(imgNum).src = "/images/home/ma_hm_0000r" + imgNum + ".gif";
} else {
document.getElementById(imgNum).src = "/images/home/ma_hm_0000n" + imgNum + ".gif";
}
}
function hilightMiscImg(imgNum) { 
imgSrc = document.getElementById(imgNum).src;
imgId = imgNum.substring(imgNum.length-1, imgNum.length);
if (imgSrc.indexOf("0r") == -1) {
document.getElementById(imgNum).src = "/images/misc/ma_ms_0000r" + imgId + ".gif";
} else {
document.getElementById(imgNum).src = "/images/misc/ma_ms_0000n" + imgId + ".gif";
}
}
/*****************************************
function to change tabs on the home page
*****************************************/
function changeTab(container,which){
container = document.getElementById(container);
var imgCollection = container.getElementsByTagName('IMG');
if (document.getElementById(which)) {
var newTab = document.getElementById(which);
}
if (newTab.className.indexOf("Selected") == -1) {
newClass = which.substring(0,2)+"Selected";
newTab.className = newClass;
}
for (x=0; x<imgCollection.length; x++) {
if (imgCollection[x] != newTab) {
if ((imgCollection[x].className) && (newTab.className.indexOf("Selected") != -1)) {
imgCollection[x].className = "";
} 
} 
}
}
