// @version  $Revision: 1.7 $  $Date: 2005/07/13 22:27:42 $  $Author: andy $

var contactDivs = new Array();
var currContactLink = '';
var currContactSubLink = '';

// Build the contact locations menus from the locations menu array
function buildContactMenus(language) {
	var contactHtml = '';
	for (i=0; i<aMenu.length; i++) {
		contactDivs[i] = 'Region'+i;
		contactHtml += '<div id="divRegion'+i+'" class="locCol" style="display:none;">';
		contactHtml += '<div class="locColHdr">'+countryCityText+'</div>';
		for (j=0; j<aMenu[i].length; j+=3) {
			contactHtml += "<a href=\"localHome.jsp?Country="+aMenu[i][j+1]+"&language="+language+"\" onmouseover=\"showAddress('"+aMenu[i][j+1]+"', "+(j/3)+", this);\">"+aMenu[i][j]+"</a>";
		}
		contactHtml += '</div>';
	}
	document.write(contactHtml);
}

// Shows the div specified by divname. linkref used for changing on state of link
function showDiv(divname, linkref) {
	gE('locAddress').style.display = 'none';
	if (currContactSubLink != '') {
		currContactSubLink.className = 'none';
	}

	// Reset last link
	if (currContactLink != '') {
		if (currContactLink.className != 'selectedIndent') currContactLink.className = 'none';
		else currContactLink.className = 'locIndent';
	}

	// Hide all other divs
	for (i=0; i < contactDivs.length; i++) {
		if (contactDivs[i] != divname) {
			document.getElementById('div'+contactDivs[i]).style.display = 'none';
		}
	}
	currContactLink = linkref;
	// Highlight current link
	if (currContactLink.className != 'locIndent') {
		linkref.className = 'selected';
	} else {
		linkref.className = 'selectedIndent';
	}
	document.getElementById('div'+divname).style.display = 'block';
}

// Show the address referenced by num. linkref used for higlighting
function showAddress(num, linkref) {
	var addressHtml = '';
	// find matching id
	for (var i = 0; i<lMenu.length; i++) {
		if (lMenu[i][0] == num) break;
	}
	// loop through address info
	for (j = 0; j<lMenu[i][1].length; j+=2) {
		addressHtml += "<b>"+lMenu[i][1][j]+"</b><br />";
		if (lMenu[i][1][j+1][0])addressHtml += lMenu[i][1][j+1][0]+"<br />";
		if (lMenu[i][1][j+1][1])addressHtml += lMenu[i][1][j+1][1]+"<br />";
		if (lMenu[i][1][j+1][2])addressHtml += lMenu[i][1][j+1][2]+"<br />";
		if (lMenu[i][1][j+1][3])addressHtml += lMenu[i][1][j+1][3]+"<br />";
		if (lMenu[i][1][j+1][4])addressHtml += lMenu[i][1][j+1][4]+"<br />";
		if (lMenu[i][1][j+1][5])addressHtml += lMenu[i][1][j+1][5]+"<br />";
		if (lMenu[i][1][j+1][6])addressHtml += lMenu[i][1][j+1][6]+"<br />";
		if (lMenu[i][1][j+1][7])addressHtml += "<a href=\""+lMenu[i][1][j+1][7]+"\" target=\"new\" >"+lMenu[i][1][j+1][8]+"</a><br />";
		if (lMenu[i][1][j+1][9])addressHtml += "<a href=\""+lMenu[i][1][j+1][9]+"\" target=\"new\" >"+lMenu[i][1][j+1][10]+"</a><br />";
		addressHtml += "&nbsp;<br />"
	}
	// write info
	wH(gE('locAddressDiv'), addressHtml);
	gE('locAddress').style.display = 'block';

	if (currContactSubLink != '') {
		currContactSubLink.className = 'none';
	}

	currContactSubLink = linkref;
	linkref.className = 'selected';
}
