
var currentLocation = location.href.toUpperCase();
var szWebPath = "http://www.addonmail.com"

if (currentLocation.search(/ADDONMAILPROD\//) != -1)
	szWebPath = "http://addonmailprod"
	
if (currentLocation.search(/WEBSITE1\//) != -1)
	szWebPath = ".."

if (currentLocation.search(/NOUVEAU\//) != -1)
	szWebPath = "http://www.addonmail.com/_B6CD0EE5-827C-4d3d-AA74-B0F473CC6159/Nouveau"

// Global
var PRODUCTS = new Array()
PRODUCTS[0] = '<font style="color:white; font-size:11px; background-color:#434343; height:20px; padding-top:5px; padding-left:10px;" class="dropmenuTitle"><font style="font-size:9px;" color=#ff9900>&bull;</font> PSTTOOLS SUITE<br></font>'
PRODUCTS[1] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/PSTStationCorporate.asp">PSTStation Corporate</a>'
PRODUCTS[2] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/BackupMyFolder.asp">BackupMyFolder!</a>'
PRODUCTS[3] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/MailControl.asp">MailControl</a>'
PRODUCTS[4] = '<font style="color:white; font-size:11px; background-color:#434343; height:20px; padding-top:5px; padding-left:10px;" class="dropmenuTitle"><font style="font-size:9px;" color=#ff9900>&bull;</font> ATTACHMENT TOOLS<br></font>'
PRODUCTS[5] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/Attach2Link.asp">Attach2Link</a>'
PRODUCTS[6] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/AttachTracker.asp">AttachTracker</a>'
PRODUCTS[7] = '<font style="color:white; font-size:11px; background-color:#434343; height:20px; padding-top:5px; padding-left:10px;" class="dropmenuTitle"><font style="font-size:9px;" color=#ff9900>&bull;</font> AUTOMATION TOOLS<br></font>'
PRODUCTS[8] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/MPPrint.asp">MP*Print</a>'
PRODUCTS[9] = '<font style="color:white; font-size:11px; background-color:#434343; height:20px; padding-top:5px; padding-left:10px;" class="dropmenuTitle"><font style="font-size:9px;" color=#ff9900>&bull;</font> X400 PRODUCTS<br></font>'
PRODUCTS[10] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/UAFI.asp">UA-FI</a>'
PRODUCTS[11] = '<a style="font-weight:bold;" class="dropmenudiv" href="' + szWebPath + '/Products/MailmaX400.asp">MailmaX.400</a>'

var iDefaultWidth = 950
var iMenuWidth = 101.8
var iEndMenuWidth = iDefaultWidth - (iMenuWidth * 7)

var myNavigator = navigator.appName.toUpperCase();
var isIE
if (myNavigator.search(/INTERNET EXPLORER/) == -1)
  isIE = false
else
  isIE = true

function WriteMenu(menuColor, menuType, linkLevel){
	var szMenu, szPath
	
	szPath = ""
	if (linkLevel == '1')
		szPath = "../"
	if (linkLevel == '2')
		szPath = "../../"
	
	if (menuColor=="Orange"){
		szBKColorCode = "#FF9900"
	}
	else if (menuColor=="Vert"){
		szBKColorCode = "#8FBC8B"
	}
	
	if (menuType == "Products")
	{
		szPath = szPath + "AOMProducts/"
	}
	
	szMenu = '<table width="' + iDefaultWidth + '" align="center" border="0" cellpadding="0" cellspacing="0">'
	
	// Bannière
	if ((menuType == "Home") || (menuType == "Products"))
	{
	    szMenu += '<tr style="background-color:white;">'
			szMenu += '<td style="border-left:1px solid #DDD; border-bottom:1px solid #DDD; border-right:1px solid #DDD;">'
				szMenu += '<table width="100%" height="90" border="0" cellspacing="0" cellpadding="0"><tr>'
				szMenu += '<td width="50%"><a href="' + szWebPath + '/AOMProducts/home.asp"><img type=image border=0 src="' + szWebPath + '/Img/logo.png" style="height:77; width:175; margin-left:5px;"></a></td>'
					szMenu += '<td width="50%" style="text-align:right; vertical-align:top;"><a href="' + szWebPath + '/AOMProducts/Store/store.asp"><img style="margin-right:20px;" border="0" src="' + szWebPath + '/Img/online_shop.png" alt="Acheter en ligne"></a></td>'
				szMenu += '</tr></table>'
			szMenu += '</td>'
		szMenu += '</tr>'
		szMenu += '<tr><td height=5px></td></tr>'
	}
	else if (menuType == "SolutionsFR") 
	{
	    szMenu += '<tr bgcolor="white">'
			szMenu += '<td style="border-left:1px solid #DDD; border-bottom:1px solid #DDD; border-right:1px solid #DDD;">'
				szMenu += '<table width="100%" height="90" border="0" cellspacing="0" cellpadding="0"><tr>'
					szMenu += '<td width="50%"><img src="' + szWebPath + '/Img/logo-solutions.png" style="height:77; width:179; margin-left:5px;"></td>'
					szMenu += '<td width="50%" style="vertical-align:top;">'
						szMenu += '<a href="' + szWebPath + '/AOMProducts/Store/store.asp"><img style="margin-left:235px;" border="0" src="' + szWebPath + '/Img/online_shop.png" alt="Acheter en ligne"></a>'
						szMenu += '&nbsp;&nbsp;&nbsp;'
						szMenu += '<a style="text-decoration:none; vertical-align:super; color:gray; font-family:arial; font-size:12px; font-weight:bold;" href="' + szWebPath + '/AOMProducts/Solutionsaddonmailen.htm"><img border="0" src="' + szWebPath + '/Img/flag_en.png" alt="Change the language"> English version</a>'
					szMenu += '</td>'
				szMenu += '</tr></table>'
			szMenu += '</td>'
	    szMenu += '</tr>'
	    szMenu += '<tr><td height=5px></td></tr>'
	}
	else if (menuType == "SolutionsEN") {
	    szMenu += '<tr bgcolor="white">'
			szMenu += '<td style="border-left:1px solid #DDD; border-bottom:1px solid #DDD; border-right:1px solid #DDD;">'
				szMenu += '<table width="100%" height="90" border="0" cellspacing="0" cellpadding="0"><tr>'
				szMenu += '<td width="50%"><img src="' + szWebPath + '/Img/logo-solutions.png" style="height:77; width:179; margin-left:5px;"></td>'
					szMenu += '<td width="50%" style="vertical-align:top;">'
						szMenu += '<a href="' + szWebPath + '/AOMProducts/Store/store.asp"><img style="margin-left:225px;" border="0" src="' + szWebPath + '/Img/online_shop.png" alt="Acheter en ligne"></a>'
						szMenu += '&nbsp;&nbsp;&nbsp;'
						szMenu += '<a style="text-decoration:none; vertical-align:super; color:gray; font-family:arial; font-size:12px; font-weight:bold;" href="' + szWebPath + '/AOMProducts/Solutionsaddonmail.htm"><img border="0" src="' + szWebPath + '/Img/flag_fr.png" alt="Changer la langue"> Version fran&ccedil;aise</a>'
					szMenu += '</td>'
				szMenu += '</tr></table>'
			szMenu += '</td>'
	    szMenu += '</tr>'
	    szMenu += '<tr><td height=5px></td></tr>'
	}

	// Menus
	if (menuType == "Home" || menuType == "Products") 
	{
	    szMenu += '<tr><td>'
	    szMenu += '<table id="Tprod" background="' + szWebPath + '/Img/menu.png" style="background-repeat:no-repeat;" height=40" width="' + iDefaultWidth + '" border="0" cellpadding="0" cellspacing="0"><tr>'

	    szMenu += WriteMenuLink('HOME', '' + szWebPath + '/AOMProducts/home.asp', 'menuBlanc', '' + menuColor + '')
	    szMenu += WriteSubMenu('PRODUCTS', PRODUCTS, 'menuBlanc', 'MenuLien', '' + menuColor + '', 180)
	    szMenu += WriteMenuLink('SERVICES', '' + szWebPath + '/AOMProducts/Services/servicespstrecovery.htm', 'MenuBlanc', '' + menuColor + '')
	    szMenu += WriteMenuLink('SUPPORT', '' + szWebPath + '/AOMProducts/Support/support.asp', 'menuBlanc', '' + menuColor + '')
	    szMenu += WriteMenuLink('DOWNLOAD', '' + szWebPath + '/AOMProducts/Download.htm', 'menuBlanc', '' + menuColor + '')
	    szMenu += WriteMenuLink('SOLUTIONS', '' + szWebPath + '/AOMProducts/Solutions/Solutionssmbs.htm', 'menuBlanc', '' + menuColor + '')
	    szMenu += WriteMenuLink('RESELLERS', '' + szWebPath + '/AOMProducts/Resellers/MapWorldAOM.htm', 'menuBlanc', '' + menuColor + '')
	    szMenu += WriteEndLink()

	    szMenu += '<tr></table>'
	    szMenu += '<td></tr></table>'
	}
	
	//szMenu += '<div id="menu_child_TEST" style="z-index:99; position:absolute; visibility:visible; background-color:#f2f2f2; width:200px;"><table style="border:1px solid gray;" width="200px" border="0" cellspacing="0" cellpadding="0"><tr><td id="menu_TEST0" style="height:20px; border-bottom:1px solid #CFCFCF;" onMouseOver="selectLien(this, \'red\');" onMouseOut="changerBouton(this.id, \'#f2f2f2\');">TEST</td></tr></table></div><script type="text/javascript">at_attach("menu_parent_TEST", "menu_child_TEST", "hover", "y", "pointer");</script>'
	
	return szMenu
}

function changeFullLine(ID, IDParent, szBKColorCode) {
	// Hand
	if (ie4){
		ID.style.cursor='hand';
	}
	else if (ns6){
		ID.setAttribute('style','cursor:pointer;');
	}
	
	// Colors
	//document.getElementById(ID).style.backgroundColor = szBKColorCode;
	document.getElementById(IDParent).style.backgroundColor = szBKColorCode;
}

function WriteSubMenu(menuName, menuTable, menuClassTitle, menuClassLink, menuColor, menuSize){
	var szMenu, szClassCode, szClassMenuCode, szBKColorCode, szSelColorCode
	
	if (menuColor=="Orange"){
	    szBKColorCode = "gray"
	    szSelColorCode = "#FDC67A"
		szClassCode = "menuOrange"
		szClassMenuCode = "dropmenudiv"
	}
	else if (menuColor=="Vert"){
		szBKColorCode = "#8FBC8B"
		szSelColorCode = "#228B22"
		szClassCode = "menuVert"
		szClassMenuCode = "dropmenudivVert"
	}

	szMenu = '<td class="' + szClassCode + '" id="' + menuName + '1" style="border-right:1px solid white; width:' + iMenuWidth + 'px;" onmouseover="changerImage(this.id, \'' + szWebPath + '/Img/menuItemSel.png\');" onmouseout="changerImage(this.id, \'' + szWebPath + '/Img/menuItem.png\');">'
		
		// Titre
		szMenu += '<div id="menu_parent_' + menuName + '" class="menuBlanc">' + menuName + '</div>'
		
		// Sous-menu
		szMenu += '<div id="menu_child_' + menuName + '" style="z-index:99; position:absolute; visibility:hidden; background-color:#f2f2f2; width:' + menuSize + 'px;">'
			szMenu += '<table style="border:1px solid gray;" width="100%" border="0" cellspacing="0" cellpadding="0">'
		
			for (var i=0; i < menuTable.length; ++i) {
				if (menuTable[i].substr(0, 2) == "<a") {
					// Link
					szMenu += '<tr>'
					if (isIE) {
						szMenu += '<td id="menu_' + menuName + i + '" style="height:20px; border-bottom:1px solid #CFCFCF;" onMouseOver="selectLien(this,\'' + szBKColorCode + '\');" onmouseout="changerBouton(this.id, \'#f2f2f2\');">'
					} else {
						szMenu += '<td class="titleItem" id="menu_' + menuName + i + '" style="height:20px; border-bottom:1px solid #CFCFCF;">'
					}
					szMenu += menuTable[i]
					szMenu += '</td></tr>'
				} else if (menuTable[i].substr(0, 2) == "<f") {
					// Title
					szMenu += '<tr>'
					szMenu += '<td id="menu_' + menuName + i + '" style="height:20px; border-bottom:1px solid #CFCFCF; font-family:Arial;">'
							szMenu += menuTable[i]
						szMenu += '</td>'
					szMenu += '</tr>'
				} else if (menuTable[i].substr(0, 2) == "<l") {
					// Title
					szMenu += '<tr style="height:10px;"><td></td></tr>'
				}
			}
			
			szMenu += '</table>'
			szMenu += '</div>'
			szMenu += '<script type="text/javascript">at_attach("menu_parent_' + menuName + '", "menu_child_' + menuName + '", "hover", "y", "pointer");</script>'
	szMenu += '</td>'
	
	return szMenu;
}

function WriteMenuLink(menuName, menuLink, menuClass, menuColor){
	var szMenu, szClassCode, szClassMenuCode, szBKColorCode, szSelColorCode
	
	if (menuColor=="Orange"){
	    szBKColorCode = "#FDC67A"
		szSelColorCode = "#FDC67A"
		szClassCode = "menuOrange"
		szClassMenuCode = "dropmenudiv"
	}
	else if (menuColor=="Vert"){
		szBKColorCode = "#8FBC8B"
		szSelColorCode = "#228B22"
		szClassCode = "menuVert"
		szClassMenuCode = "dropmenudivVert"
	}

	szMenu = '<td class="' + szClassCode + '" id="' + menuName + '1" style="border-right:1px solid white; width:' + iMenuWidth + 'px; height:40px;" onmouseover="changerImage(this.id, \'' + szWebPath + '/Img/menuItemSel.png\');" onmouseout="changerImage(this.id, \'' + szWebPath + '/Img/menuItem.png\');">'
	// Titre
	//szMenu += '<div><a class="' + menuClass + '" href="' + menuLink + '" tabindex="1">' + menuName + '</a>'	
	szMenu += '<div><a class="' + menuClass + '" href="' + menuLink + '" tabindex="1">' + menuName + '</a>'	
	szMenu += '</td>'
	
	return szMenu;
}

function WriteEndLink() {
	return '<td class="menuOrange" style="width:' + iEndMenuWidth + 'px;"></td>';
}

