// Define Menus for English, German and Chinese
// Change first item of each array to work for each site

var aMenus = new Array ( _TertiaryMenu);

var menuIndex = 0;

document.writeln ("<div id=\"rightmenu\">");
	 if (Get_Cookie("Roles") && Get_Cookie("Roles").indexOf("Registered Users") != -1  ) { // User logged on
        
            document.writeln("<span style='FONT-SIZE: 12px;COLOR:#0066CC;FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none;align=right'>" + _LoggedIn + " <strong>" +  urlDecode(Get_Cookie("Username")) + "<\/strong><br><br><\/span>");
            
            menuIndex = 1;

	        //document.writeln("<a href=\"" + aMenus[y][2][1] + "\"" + aMenus[y][2][2] + "><span class=\"button\">" + aMenus[y][2][0] + "<\/span><\/a>");
        } else {
			menuIndex = 0;
        }

for (y=menuIndex; y<aMenus[0].length; y++) {
        DisplayMenu(0, y);        
}

document.writeln ("<\/div>");

function DisplayMenu(lang, menuitem){
		
		
		
			if (aMenus[lang][menuitem][3] == true && Get_Cookie("Roles") == null ) {

				return;
								
			} else {
							
				document.write("<div class=\"menuitem\"><a href=\"" + aMenus[lang][menuitem][1] + "\"" + aMenus[lang][menuitem][2] + "");
				document.write(" class=\"button");
				if (menuitem==aMenus[lang].length-1) { document.write(" lastbutton") }; 
				document.writeln("\">" + aMenus[lang][menuitem][0] + "<\/a><\/div>");
			}
}


/*
function Get_Cookie(name) {
    var start = document.cookie.indexOf(name+"=");
    var len = start+name.length+1;
    if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
    if (start == -1) return null;
    var end = document.cookie.indexOf(";",len);
    if (end == -1) end = document.cookie.length;
    return unescape(document.cookie.substring(len,end));
}
*/

function doLogout () {

	if (confirm(_ConfirmLogoOut)) document.location.href="/logout.aspx";
}
