/*
Copyright Reazon Systems, Inc.  All rights reserved.

This code is protected by US and International Copyright laws.  Reproduction, distribution, 
display, modification and use of the code without written permission of the Reazon Systems, Inc. is prohibited..  
*/

//xyz = document.getElementById("TopMenuTDHOME");
//xyz.innerHTML='';
//showElement(xyz, 'hidden');

//alert('inside topmenu.js');

//globalvars
var g_topMenuVisibility;
var g_topItem;
var g_subItem;
var g_rsUrlToken;
var g_application_IsDevelopment;
var g_visibleTopMenuAry = new Array(); //associative array
var g_topMenuBits = new Array();
var g_topMenuCaptions = new Array();
var g_topMenuUrls = new Array();
var g_topMenuTDBaseClass = new Array();
var g_session_IsAdmin;
var g_mbrRoles;
var g_submenuDisplayed = '';  //global flag showing whether a current submenu is displayed (it holds the name of top menu associated with it).
var g_breadcrum = "";
var g_IsHiddenTopMenu = false;  //indicates if top menu caption should show in submenu (in case when top menu is invisible)

var selectedColor="s";
var unselectedColor="b";
selectedBullet = "";

//the following came from the bottom of cttopmenu
var origMenu = null;  
var displayedMenu;
var origSubmenu = null;  
var displayedSubmenu;
var submenuTimeoutId = null;
var submenuWarningDisplayTimeout = null;

function moveTopMenu() {  //move topmenu form bottom to top of the page.
  var topMenuContainer = document.getElementById('topMenuContainer');
  var topMenuOrig = document.getElementById('topMenuOrig');
	topMenuContainer.innerHTML = topMenuOrig.innerHTML;
	topMenuOrig.innerHTML = '';
}

/*
	forceInclude:  force this top menu to be included, even it's set to be invisible
*/
function topMenuTab(bitVal, name, caption, url, baseClass, /*selectedColor, unselectedColor, */ forceInclude, mnuroles, altLabel, title) {
	//side effect: create the arrays
	g_topMenuBits[name] = bitVal;
	g_topMenuCaptions[name] = caption;
	g_topMenuUrls[name] = url;

	//alert(name + ' - ' + hideTab);	
	//if menu is not visibile for this site, return
	//alert(g_topMenuVisibility + "  " + bitVal);
	if (forceInclude)
		g_visibleTopMenuAry[name] = true;
	else {
		if (
				(g_topMenuVisibility > 0 && (g_topMenuVisibility & bitVal) == 0) || 
				(mnuroles > 0 && (mnuroles & g_mbrRoles) == 0)
			) {
			
			g_visibleTopMenuAry[name] = false;
			
			//if (forceInclude) 
				//alert('NoShow:' + name);
	
			return;
		} else {  //make it visible temporarily
			g_visibleTopMenuAry[name] = true;
		}
	}

	if (!altLabel) altLabel = caption;
	if (!title) title = "";
	
	isSelected = g_topItem == name;
	if (isSelected) {  //if selected tab
		lcClass= baseClass + "selected";  //topmenuitemSelected
		//lcImgFlag=selectedColor;
		lcCornerUnderline="silver";
		lcUnderline="blank";
		lcBullet=selectedBullet;
		
		g_breadcrum = g_breadcrum + '<a class="topmenuBreadcrum" ';

		//append current topmenu breadcrum
		if (url > '')
			g_breadcrum = g_breadcrum + 'href="' + url + '">';
		else
			g_breadcrum = g_breadcrum + 'name="topMenu_breadcrum_"' + name + '">';
			

		g_breadcrum = g_breadcrum + caption + '</a>&nbsp;&gt;';
			
	} else {		//if not selected tab
		lcClass= baseClass + "off";  //topmenuitemOff
		//lcImgFlag=unselectedColor;
		lcCornerUnderline="white";
		lcUnderline="white";
		lcBullet="";
	}

	TdId = "TopMenuTD" + name;  //id for the current TD element

	g_topMenuTDBaseClass[TdId] = baseClass; 

//	document.write("<TD valign=bottom><table border=0 cellpadding=0 cellspacing=0><tr>");
	
	//left of tab image
	//document.write("<TD><img src='/images/tabs/images/tab_" + lcImgFlag + "_l.gif' border='0'></TD>");
	
	//Tab background image
	//document.write("<TD background='/images/tabs/images/tab_" + lcImgFlag + "_m.gif' "); 
	//document.write("<TD background='/images/tabs/images/tab_" + lcImgFlag + "_m.gif' ID='#TdId#' "); 

	//document.write("<table border='0' cellpadding='0' cellspacing='1' style='float:left; margin:0px;'><tr><td ID=\'" + TdId + "\' "); 
	document.write("<LI ID=\'" + TdId + "\' "); 

	document.write('class=' + lcClass + '>');

	document.write(title);
	
	//alert(caption + "..." +  url);
	if (url > '') {  //url is a javascript function
		if (String(url).substring(0, 1) == "$") {
			//alert(String(url).substring(1, String(url).length));
			document.write("<a href=\"javascript:void(0);\"");
			document.write("onclick='" + String(url).substring(1, String(url).length) + ";return false;'");
		} 
		else { //url is normal 
			document.write("<a href=\"" + appendUrlToken(url) + "\"");
		}
	}
	else {
		document.write("<a href=\"javascript:void(0);\"");
		document.write("onclick=\"showMenu('" + TdId + "', 'divSubmenu_" + name + "');return false;\"");
	}
	
	document.write('class="' + lcClass + '" title="' + altLabel + '" >'); 

//	if (name == 'HOME')  //if it's home page of main server, show a home icon.
//		document.write(lcBullet + '<img src="/images/icons/16/home.gif" alt="home" style="margin:1px;">');  //the margin of 1px is needed to make the image of the correct height or tab won't show properly.
//	else
		document.write(lcBullet + caption);

//	if (url == '')  //if has submenu
//		document.write(" <img src='/images/icons/12/arrowheaddown.gif'>");

	//document.write("</a></td></tr></table>");
	document.write("</a>");

	document.write("</LI>");
	

	//Space tabs by leaving a space on the right of each button
	//gap between menu items
	//document.write('<span class="topmenuitemtabfiller" width="1"><img src="/images/pixels/pixelblank.gif" width="1" height="1" alt=""></span>');
	
}
 
function subMenuTab(topmenu, submenu, caption, url, disabled, mnuroles) {
	if (
			(mnuroles > 0 && (mnuroles & g_mbrRoles) == 0)
			) {
		return;
	}
	
	if (g_topItem == topmenu) { //this is the current menu bar
		if (g_subItem == (g_topItem + "__" + submenu)) {  //if submenu is selected
			lcClass="submenuitemselected";
			//lcImgFlag="b";
			lcBullet=selectedBullet;

			g_breadcrum = g_breadcrum + ' <a href="' + appendUrlToken(url) + '">' + caption + '</a> &gt; ' ;
		} else {	//submenu is not selected
			lcClass="submenuitemoff";
			//lcImgFlag="s";
			lcBullet="";
	}
	} else { // this is not the current menu bar
		lcClass="submenuitemUncurrent";
		//lcImgFlag="s";
		lcBullet="";
	}

	document.write("<TD "); 
	document.write("class=\"" + lcClass + "\" ");
	document.write("	nowrap>");
	if (disabled && ! g_application_IsDevelopment) {
		document.write("<span class=\"submenuitemdisabled\">");
		document.write("&nbsp;&nbsp;" + lcBullet + caption + "&nbsp;&nbsp;");
		document.write("</span>");
	}
	else { //if not disabled
		
		document.write("<a href=\"" + appendUrlToken(url) + "\"");
		document.write("class=\"" + lcClass + "\" >");
		document.write("&nbsp;&nbsp;" + lcBullet + caption + "&nbsp;&nbsp;");
		document.write("</a>");
	}

	document.write("</TD>");
	
	subMenuDivider();

}

function subMenuDivider() {
	document.write('<TD class="submenuitemtabfiller" width="90%"><img src="/images/pixels/pixelblank.gif" width="3" height="1" alt=""></TD>'); 
}



function subMenuBegin(topMenu, selectedTopMenu) {
	
//	    document.write('<div id="divSubmenu_' + topMenu + '" align="left" style="visibility: hidden; position: absolute; top:20; left:20; z-index:1000;">'); 
//alert(selectedTopMenu + ' - ' + topMenu);
		var isCurrentTopMenu = selectedTopMenu == topMenu;
		
		if (isCurrentTopMenu) {
			g_submenuDisplayed = selectedTopMenu;  //global flag showing a submenu is displayed.

			clsName = 'Current';
		}
		else {
			clsName = 'Uncurrent';
		}
// container table
/*	 if (selectedTopMenu != topMenu) {  //current submenu
		document.write('<div id="divSubmenu_' + topMenu + '" align="left" style="visibility: hidden; position: absolute; top:0; left:0; z-index:1000;">'); 
	  	document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td>');

		document.write('<Table cellspacing="0" cellpadding="0" border="0">');
		document.write('<TR>'); 
		//document.write('<TD valign="middle"><span id="spanSubmenuWarning" class="submenuWarning" style="display:none;">&nbsp;Please select &raquo;&nbsp;</span><TD>');
		document.write('<TD valign="middle"><img src="/images/pixels/pixelsilver.gif" border="0"  height="1" width="5"></TD>');
		document.write('<TD valign="middle"><img src="/images/pixels/pixelsilver.gif" border="0"  height="3" width="3"></TD>');
	} 
	else {	//other submenus
*/

		document.write('<div class="DivSubmenuContainer' + clsName + '" id="divSubmenu_' + topMenu + '" align="left" >'); 
		
		//if this is current top menu, show topmenu title / breadcrum.  Use &nbsp; or IE may wrap the line (IE gets moody and wraps the same line every once in awhile
		/*
		if (isCurrentTopMenu) {
			//g_breadcrum = '<strong>You\'re in: </strong>';

			// append top menu is not home, append a link to home
			//if (topMenu != 'HOME')
			//	g_breadcrum = g_breadcrum + '<a href="/?' + g_rsUrlToken + '" class="topmenuBreadcrum">home</a>&nbsp;&gt;&nbsp;';
	
			g_breadcrum = g_breadcrum + '<a class="topmenuBreadcrum" ';

			//append current topmenu breadcrum
			if (g_topMenuUrls[topMenu] > '')
				g_breadcrum = g_breadcrum + 'href="g_topMenuUrls[topMenu]">';
			else
				g_breadcrum = g_breadcrum + 'name="topMenu_breadcrum_"' + topMenu + '">';
				

			g_breadcrum = g_breadcrum + g_topMenuCaptions[topMenu];
			g_breadcrum = g_breadcrum + '</a>&nbsp;&gt;';
			
		}
		*/

		
		document.write('<table class="submenucontainer' + clsName + '" cellpadding="0" cellspacing="0" border="0" >');
		document.write('<tr><td class="submenucontainer' + clsName + 'Title">');

		if (isCurrentTopMenu) {
			document.write('<span id="spanSubmenuWarning" style="display:none;"><img src="/images/icons/16/animated/arrow_right_blue_red.gif" alt="&raquo;&raquo;&raquo;" title="&raquo;&raquo;"></span></td><TD>');  //&nbsp;&nbsp;
		} else {
			//document.write('<span class="submenuhelper"><BR>&nbsp;&nbsp; please select:<BR>&nbsp;</span>');
		}
		
		//document.write('</td></tr>');
		//document.write('<tr><td class="submenucontainer' + clsName + '">');
		document.write('<Table cellspacing="0" cellpadding="0" border="0" width="100%" >');
		document.write('<TR>');
		
		//begin underline
		document.write('<TD class="submenuitemtabfiller' + clsName + '"><img src="/images/pixels/pixelblank.gif" width="10" height="1" alt=""></TD>');
		
		//if top menu is hidden, show its caption in the submenu
		//if (g_IsHiddenTopMenu && selectedTopMenu == topMenu) 
		//	document.write('<TD class="submenutitle' + clsName + '" nowrap valign="top"><div class="submenutitle' + clsName + '">you\'re in<br><strong>' + g_topMenuCaptions[topMenu] + '</strong>: </div> </TD>');
		
}

function subMenuEnd() {
	//document.write("<TD valign='middle'><img src='/images/pixels/pixelsilver.gif' border='0' height='18' width='1'></TD>");
	//document.write("<TD valign='middle'><img src='/images/pixels/pixelsilver.gif' border='0'  height='3' width='3'></TD>");
	//document.write("<TD valign='middle'><img src='/images/pixels/pixelsilver.gif' border='0'  height='1' width='5'></TD>");
	
	//this is needed by firefox to extend the line below the tabs
	document.write('<TD class="submenuend' + clsName + '"><img class="submenuEnd' + clsName + '" src="/images/pixels/pixelblank.gif" height="1" alt=""></TD>');
	document.write('</TR>');
	document.write('</TABLE>');
	document.write('</td>'); //container
	//document.write('<TD class="submenuitemtabfiller' + clsName + '" width="90%"><img src="/images/pixels/pixelblank.gif" width="1" height="1" alt=""></TD>'); //container
	document.write('</tr></table>'); //container
 	document.write('</div>');
}


function renderTopMenu(topItem, subItem, curPageTitle, isLoggedIn, session_mbrroles, session_MbrLoginName, request_rsURLToken, request_SiteSettings_TopMenuVisibility, siteType, request_ServerTypeId, session_IsTutor, session_IsClub, session_IsFaculty, session_IsAdmin, application_IsDevelopment, session_PagePrefix) {
	g_topMenuVisibility = request_SiteSettings_TopMenuVisibility;  //set global var
	g_topItem = topItem;
	g_mbrRoles = session_mbrroles;
	g_rsUrlToken = request_rsURLToken;
	g_application_IsDevelopment= application_IsDevelopment.toLowerCase() == 'yes';
	g_session_IsAdmin = session_IsAdmin.toLowerCase() == 'yes';
	
	//append home to all breadcrums if current page is not HOME
	if (g_topItem != 'HOME')
		g_breadcrum = g_breadcrum + '<a href="/?' + g_rsUrlToken + '" class="topmenuBreadcrum">home</a>&nbsp;&gt;&nbsp;';

	
	isLoggedIn = isLoggedIn.toLowerCase();
	
	var bgon="";
	var bgoff="";

	if (!topItem) {
		topItem = "0";
	}

	if (!subItem) {
		subItem = "0";
	}


	topItem = topItem.toUpperCase();
	
	
	// prefix subItem with TopItem to avoid javascript conflicts when submens of two different menus have the same name
	subItem = topItem + "__" + subItem.toUpperCase();
	g_subItem = subItem;	//set global var
	
	// First level menu (public)
	//document.write('<Table border="2" cellspacing="0" cellpadding="1" width="100%" align="center">');
	//document.write('<TR>');
			// horizontal indent and height adjuster
			//document.write('<td class="topmenuitemtabfiller"><img src="/images/pixels/pixelblank.gif" height="22" width="2" border="0"></td>');
			//document.write('<td valign="top" nowrap class="genericsmall">smart menu:</td>');
			//document.write('<td width="99%">');
			
			//this table is needed for when the top menu has too many choices and forces the submenu off the page, especially in Firefox
			document.write('<Table width="100%" cellpadding="0" cellspacing="0"><TR><TD>');
			document.write('<UL id="topmenu_main">');
				topMenu1();  
				
				//document.write('<td class="topmenuitemtabfiller"><img src="/images/pixels/pixelblank.gif" width="10" border="0"></td>');
				
				topMenu2();  //line 2 (not showing on the second line anymore)
				//special_CurMenu();  //show current top menu tab and its submenu
				special_enableSubMenuForHiddenTopMenu();  //show current sub menu even if the top menu is originally hidden

				//document.write('<td class="topmenuitemtabfiller"><img src="/images/pixels/pixelblank.gif" width="10" border="0"></td>');
				
				document.write('<li class="topmenuGap">&nbsp; &nbsp;</li>');
				
				//more... as a regular tab
				/*
				if (g_IsHiddenTopMenu) {  //if a hidden top menu is selected, make More... the selected tab
					tmptopMenuCaption = g_topMenuCaptions[g_topItem];
					tmpTopItem = g_topItem;
					g_topItem = 'DIRECTORY';
					topMenuTab(268435456, "DIRECTORY", "more...", "$special_Directory(1)", "o", "s", true, 0);
					g_topItem = tmpTopItem;
				} else {
					topMenuTab(268435456, "DIRECTORY", "more...", "$special_Directory(1)", "o", "s", true, 0);
				}
				*/
				
				//Show the temporary tab
				if (g_IsHiddenTopMenu) {  //if a hidden top menu is selected, show the tab here
					topMenuTab(g_topMenuBits[g_topItem], g_topItem, g_topMenuCaptions[g_topItem], g_topMenuUrls[g_topItem], "topmenuitemTemp", true, 0);
				}

				//more...  as a link
				document.write('<LI class="moreTab" ID="TopMenuTD_SeeAll"><a class="moreTab" ');
				document.write('href="javascript:void(0);" onclick="special_Directory(1)"');
				document.write('>more...</a></LI>');	

			document.write('</ul>');
			document.write('</TD"></TR></TABLE>');
			//document.write('</td>');

			//document.write('<TD width="99%"><img src="/images/pixels/pixelblank.gif" height="1" width="2" border="0"></TD>');
			
			/*
			//subMenuDivider();
			document.write('<TD nowrap valign="top" align="right">');
			/*
			//jump menu
			document.write('><SPAN class="topmenuitemoff"><a href="javascript:void(0);;"	');
			document.write('class="submenuitemoff"');
			document.write('onclick="showSeeAll();return false;">');
			document.write('jump!</a');
			document.write('></SPAN>');
			subMenuDivider();
			* /

			//subMenuDivider();

			// login
			if (g_mbrRoles <= 1) { // if not logged in, show a login button, else, show a logout
				document.write('<div class="loginbutton"><a class="loginbutton" ');
				document.write('href="login.cfm' + (request_rsURLToken > '' ? "?" + request_rsURLToken : "") + '"');
				document.write('>login</a></div>');			
				document.write('<div class="loginbutton"><a class="loginbutton" ');
				document.write('href="s_newmbreditc.cfm' + (request_rsURLToken > '' ? "?" + request_rsURLToken : "") + '"');
				document.write('>sign up</a></div>');			
				
				//subMenuDivider();
				//topMenuTab(-1, "LOGIN", "login", "login.cfm", "o", "s", true, 0);
				
				//document.write('<TD nowrap valign="top">');
				//document.write('<SPAN class="topmenuitemoff"><a href="login.cfm' + (request_rsURLToken > '' ? "?" + request_rsURLToken : "") + '"');
				//document.write('class="submenuitemoff"');
				//document.write('>&nbsp;&nbsp;login&nbsp;&nbsp;</a>');
				//document.write('</SPAN></TD>');
				//subMenuDivider();
			} else {
				document.write('<div class="loginbutton"><a class="loginbutton" ');
				document.write('href="logoutc.cfm' + (request_rsURLToken > '' ? "?" + request_rsURLToken : "") + '"');
				document.write(' title="' + session_MbrLoginName + '">logout</a></div>');			
				//topMenuTab(-1, "LOGOUT", "logout", "logoutc.cfm", "o", "s", true, 0, 
				//		   'logout ' + session_MbrLoginName);
				
			}
			
			//topMenuTab(-1, "ACCOUNT", "my account", "s_profileshellc.cfm", "o", "s", true);

			document.write('</TD>');
			
			*/
			//document.write('<td class="topmenuitemtabfiller"><img src="/images/pixels/pixelblank.gif" height="1" width="2" border="0"></td>');

		//document.write('</TR>');
	//document.write('</TABLE>');
	
	/*
	// Second level menu (protected)
	if (isLoggedIn == 'yes') {
	
		document.write('<Table cellspacing="0" cellpadding="1" border="0" width="100%" align="center">');
		
		document.write('<TR>');
			
			// horizontal indent
			document.write('<td><img src="/images/pixels/pixelblank.gif" height="22" width="2" border="0"></td>');
			//document.write('<td valign="top" nowrap class="genericsmall">my stuff:</td>');
			
			document.write("<TD nowrap>" + session_MbrLoginName + "'s private zone: </TD>");

			document.write('<td width="99%">');
			//topMenuTab(1, "STUDYGROUP", "debug 0", "", "o", "s", true, 0);
			topMenu2();  //custom menu
			document.write('</td>');

			
			document.write('<TD><img src="/images/pixels/pixelblank.gif" height="1" width="2" border="0"></TD>');
	
			//subMenuDivider();
			//document.write('<TD nowrap valign="top">');
			//topMenuTab(-1, "ACCOUNT", "my account", "s_profileshellc.cfm", "o", "s", true);
			//document.write('</TD>');
			//subMenuDivider();
			
			
			//horizontal indent
			document.write('<td><img src="/images/pixels/pixelblank.gif" height="1" width="2" border="0"></td>');
			
		document.write('</TR></TABLE>');
		
	}  //end if 

	*/
	// leave a gap under current submenu
	//document.write('<Table cellspacing="0" cellpadding="0" border="0" width="100%" align="center" class="topmenusubmenufiller">');
	//document.write('<Table cellspacing="0" cellpadding="0" border="0" width="100%" align="center" class="topmenusubmenufiller">');
	//document.write('<TR><TD><img src="/images/pixels/pixelSilver.gif" width="100%" height="1" border="0"></TD></TR>');
	//document.write('<TR><TD><img src="/images/pixels/pixelBlank.gif" width="100%" height="10" border="0"></TD></TR>');
	//document.write('<TR><TD><img src="/images/pixels/pixelSilver.gif" width="100%" height="1" border="0"></TD></TR>');
	//document.write('<TR><TD><img src="/images/pixels/pixelBlank.gif" width="100%" height="10" border="0"></TD></TR>');
	//document.write('</TABLE>');
	
	//document.write('<div class="sectiontitle2">');
	//document.write(g_topMenuCaptions[g_topItem]);
	//document.write('</div>');
	
	 /* firefox is one pixel different from IE.  add 1 pixel to the bottom or the submenu will get stuck to top menu's right side in FF */
	//document.write('<div class="submenu"><img src="/images/pixels/pixelBlank.gif" width="1" height="1" border="0" ></div>'); 

	document.write('<Table id="submenuBanner" class="submenuBanner" border="0" cellspacing="0" cellpadding="0" width="100%" align="center">'); //submenu background including gap between top menu and submenu
	
	document.write('<TR>');
	document.write('<TD valign="top">');  //valign=top is needed to keep the embedded DIV in the correct location


	// Anchor the div inside of it to the left of the screen.  Without it, the div would jump to the top
	//	document.write('<div align="left" style="position:relative; top:0; width: 17px; height: 17px; z-index:1000">');
	document.write('<div style="position:absolute; z-index:1;" >');  //z-index is needed to make sure it is not blocked by xsite admin menus
	//submenu shell
	

	subMenu();

	document.write('</div>');


//	document.write('</div>');
			
	//Includes spacing / gap above the main page title.  Use class submenubreadcrum here to match the spacing with the actuall breadcrum, especially for when
	// user changes broswer font size
	document.write('</td>');

	//placeholder for submenu to push the page down.  It has to be under the submenu for NS to work correctly.
	//document.write('<td><img src="/images/pixels/pixelblank.gif" height="16" width="1" border="0" alt=""></td>');  

	/*
	document.write('<TD style="padding: 5 0 0 0;" nowrap>');
			if (siteType == "") {
				document.write('<a href="contactuseditc.cfm?showcontactlist=no">suggestion box</a>');
			}
			
	document.write('</TD>');
	*/
	
	/* right border */
	//document.write('<TD><img src="/images/pixels/pixelblank.gif" height="3" width="1" border="0" alt=""></TD>');
	document.write('</TR>');
	document.write('</TABLE>');
	
	//underline below submenu
	//document.write('<div class="submenuunderline"><img src="/images/pixels/pixelblank.gif" width="1" height="1" border="0" alt=""></div>');
	
	//if (g_submenuDisplayed > ' ') //if a submenu is displayed, put this gap behind it to push the page down. 
 	//	document.write('<div class="submenuBreadcrum">&nbsp;</div><img src="/images/pixels/pixelblank.gif" width="1" height="16" border="0" alt="">');

	//if there's no current submenu or the url of current page is different from submenu
	if (!g_submenuDisplayed)
		g_breadcrum = g_breadcrum + '&nbsp;' + curPageTitle +'&nbsp;&gt;&nbsp;';


	//if (g_breadcrum > '')
	//Show breadcrums everywhere except home page and home page of xsites
	if (g_topMenuBits[g_topItem] != 1 && g_topMenuBits[g_topItem] != 134217728) {
		document.write('<div class="topmenuBreadcrum">');
		document.write(g_breadcrum);
		document.write('</div>');
	}

	//extra space/gap between submenu and page title/content
	document.write('<div class="submenu_page_gap"><img src="/images/pixels/pixelblank.gif" width="1" height="10" border="0" alt=""></div>');

	initMenu();
	
	//check if there is a submenu to be displayed at this time and set the submenubanner accordingly
	// Moved to InitMenu()
	// if (g_submenuDisplayed)
 	//	initSubmenu("divSubmenu_" + topItem);  //show current menu
	//else {
	//	var submenuBannerObj = document.getElementById("submenuBanner");
	//	submenuBannerObj.className = "submenubanner_noSubmenu";
	//}
	
	//debug
	//lskdwol = document.getElementById('topmenu_main');
	//alert(lskdwol.innerHTML);

}	
	
	/* render path 
	lcPathTitle = ListToArray(#ATTRIBUTES.PathTitle#, ",");
	lcPathUrl = ListToArray(#ATTRIBUTES.PathUrl#, ",");
	PathLen = ArrayLen(lcPathTitle);
	
	<CFLOOP from="1" to="#PathLen#" index="i">
		<CFOUTPUT>
			<a href="#lcPathUrl[i]#">#lcPathTitle[i]#</a>
		</CFOUTPUT>
			<CFIF i < PathLen>
				/
			}
	</CFLOOP>
	*/
	
/*	<script language="javascript" >
		
		
}
*/

function initMenu() {
	if (g_topItem) {
		origMenu = document.getElementById("TopMenuTD" + g_topItem);
		origSubmenu = document.getElementById("divSubmenu_" + g_topItem);  //init original submenu obj
		
		if(!origSubmenu) {
			var submenuBannerObj = document.getElementById("submenuBanner");
			submenuBannerObj.className = "submenubanner_noSubmenu";
		}
		
		showMenuObj(origMenu, origSubmenu, "click");	//show submenu
	}

}		


//initialize submenu 
//params: 
//	newSubmenuName: submenu name
//
//Called when page is loaded to display current submenu
/*function initSubmenu(submenuName) {
	origSubmenu = document.getElementById(submenuName);  //init original submenu obj
	if (origSubmenu) {
		origMenu = document.getElementById("TopMenuTD" + g_topItem);
		//displayedSubmenu = document.getElementById(submenuName);  //init displayed submenu obj
		showMenuObj(origMenu, origSubmenu, "click");	//show submenu
	}
}		
*/

function appendUrlToken(url) {
	if (g_rsUrlToken == "") {  //if there is no URL token
		return url;
	} else {  //there is a url token
		if (url.indexOf("?") > 0)
			return url + "&" + g_rsUrlToken;
		else
			return url + "?" + g_rsUrlToken;
	}
}

function rsLoadUrl(u) { //append url token and load url.  called by popup menu
	document.location = appendUrlToken(u);
}


function special_Directory(purpose) {

	toggleMainPopupWindowAndSetTopLeft(
			'/directorylisteditc.cfm?purpose=' + purpose +
			'&framed=yes&ispopup=yes&popuptitle=Directory&popupwidth=700px&popupheight=400px&' + g_rsUrlToken,
			'loading Directory...', '100px', '100px');
}

function special_CurMenu() {
	//if curmenu is not showing, show it
	if (g_visibleTopMenuAry[g_topItem] == false) {
		//show currently selected menu in the current menu section
		topMenuTab(1, g_topItem, g_topMenuCaptions[g_topItem], g_topMenuUrls[g_topItem], "o", "s", true, 0, "current selection", "you're in:");
	}
}

//show current sub menu even if the top menu is originally hidden
function special_enableSubMenuForHiddenTopMenu() {
	//if curmenu is not showing, show it
	if (g_visibleTopMenuAry[g_topItem] == false) { 
		g_visibleTopMenuAry[g_topItem] = true;  //mimic a visible top menu even though it's not showing (top menu is renedered already)
		g_IsHiddenTopMenu = true;  //side effect.  Tells submenu to show the caption of top menu because top menu is invisible
	}
}


function special_MostRecent(Num) {
	//if curmenu is not showing, show it
	if (g_visibleTopMenuAry[g_topItem] == false) {
		document.write("most recent: ");
		
		//show currently selected menu in the current menu section
		topMenuTab(1, g_topItem, g_topMenuCaptions[g_topItem], g_topMenuUrls[g_topItem], "o", "s", true, 0, "most recent");
	}
}

