/// Author				: Chbeir Elias 
/// Co- Authors			: Richard Jean-Francois, De Bisschop Sabine
/// Creation Date		: 04 June 2002
/// Modified by			: Chbeir Elias
/// Modification Date	: 22 January 2004
///
/// Summary :
/// 
/// You can find the following functions in this file:
///
/// +   ChangeDestinationModule(newSrcValue)
/// +   ChangeDestinationPageModule(destination, newSrcValue)
/// +   DetectBrowser()
/// +   GetSelectedNodeFromUrl()
/// +   HighLightNode(selectedNode)
/// +   NextAndPreviousItems(nodeID, rank, originalBank)
/// +   SetMode(nodeID, mode)
/// +   ShowItems()
/// +   ShowNextAndPreviousEditions(NextAndPrevious, previousItemImg, ...)
/// +   ShowSubItems(module)
/// +	buildPMTlink(...)
/// +	BuildThemesModule(lang)
/// +   .....


var Items               = new Array(); // Array that holds main Items; ones used as titles for sub items
var IDs                 = new Array(); // Array that holds the ids of the sub items (articles, news, ...)
var TypeItems			= new Array();	// Array that holds the ids of the type items (articles, news, ...)
var mLang				= "";			// language of site

var e                   = 0;           // counter for Main Items (Editions, Magazines, ...)
var f                   = 0;           // counter for Main Items (Editions, Magazines, ...)
var g					= 0;		   // counter for showMore/less image
var i                   = 0;           // counter for Sub Items (Articles, News, ...)
var t                   = 0;           // counter for Sub Themes
var counter             = 0;          

var rowsToShow          = 4;           // number of sub items to show under each main item
var selectedNode        = 0;           // selected node in page
var storedSelectedNode  = 0;           // holds previous selectedNode
var pageNodeToHighlight = 0;           // holds the id that can reference the current page; used to highlight
                                       // current page name in a module
                                                                  
                                       
var Menu_previousTheme		= "";		   // keeps ID of previous selected theme in main menu
var moreItemsIMG		= "";		   // keeps name of image "+-items"	


var tc = 0;					// Counter for Thematic Pages
var subtc = 0;				// Counter for SubThemes

var ThemesArray = new Array();			// Array that holds all themes 
var Themes = new Array();				// Array that holds all Thematic Pgaes
var SubThemes = new Array();			// Array that holds all subthemes

var SnelMenuID			= 0;		   // snelMenu selected value	

var themeCounter		= 0;
var subthemeCounter		= 0;

/////////////////////////////////////////////////////////////////////////////////                      


/// <author>Chbeir Elias</author>
/// <summary>
/// Change the nodeid (src value) in current url
/// </summary>
/// <returns>current url with the updated nodeid value</returns>
function ChangeDestinationModule(newSrcValue)
{
	return ChangeDestinationPageModule("", newSrcValue)
}


//////////////////////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Change the nodeid (sev value) in a given url
/// </summary>
/// <returns>given url with the updated nodeid value</returns>
function ChangeDestinationPageModule(destination, newSrcValue)
{


    var subparts;
    var partname;
    var nodeFromUrl = 0;
    var url         = "";
    
    if(destination == "")
		// get desired value from querystring
		url = document.location.toString();
	else
		url = destination;
		
	if(url.toString().indexOf("src") >= 0)
	{
		var urlLength = url.length;
		var srcStart  = url.indexOf("src") + 3; // +3 so to bypass the length of the word src
		var srcEnd    = "";
		var subUrl    = url.substring(srcStart).toString();
		var parts;
		
		// normal url
		if(subUrl.indexOf("=") == 0)
		{
			parts = subUrl.split("&");
			srcEnd = srcStart + parts[0].toString().length;
		}
		
		// url using isapi filter
		if(subUrl.indexOf("/") == 0)
		{
			parts = subUrl.split("/");
			
			if(parts[0].toString().length == 0)
				srcEnd = url.toString().length - 4; // at end, there should be ".htm" which is of length 4
			else
				srcEnd = srcStart + parts[0].toString().length;
		}
		
		srcStart += 1;  // +1 so to bypass the separator "=" or "/" after src
		
		return url.replace(url.substring(srcStart, srcEnd), newSrcValue);
	}
	
	return url;
}


/////////////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Show the content of a HTML string in a DIV whatever is the browser
/// </summary>
/// <returns>Nothing</returns>
function DisplayList(monthsString, _layer, _secLayer)
{
	var NS  = navigator.appName == "Netscape";
	var NS5 = (NS && parseInt(navigator.appVersion) > 4);
	var NS4 = (document.layers) ? true : false;
	var IE4 = (document.all) ? true : false;

	if (NS4)
	{
		listToDisplay = "<span>" + monthsString + "</span>";
		
		eval("document." + _layer + ".document." + _secLayer + ".document.write(monthsString)"); 
		eval("document." + _layer + ".document." + _secLayer + ".document.close()");
		//alert("NS4");
	}
	else 
	{
		if (NS5) 
		{
			eval("document.getElementById('" + _secLayer + "').innerHTML = monthsString");
			//alert("NS5");
		}
		else
		{
			// IE4+
			eval(_secLayer + ".innerHTML = monthsString");
		}
	}
}


/////////////////////////////////////////////////////////////////////////


/// <author>Richard Jean-Francois</author>
/// <summary>
/// Get the browser type at the client
/// </summary>
/// <returns>detected browser</returns>
function DetectBrowser()
{
	var Brw;
	
	if(document.all)
	{
		Brw = "MSIE";
	}
	if(document.layers)
	{
		Brw = "NS";
	}
	if(document.getElementById)
	{
		Brw = "NS6";
	}
	return Brw;
}


///////////////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Get the selected node from the url by searching for the 'src' value in a url
/// </summary>
/// <returns>selected node</returns>
function GetSelectedNodeFromUrl()
{
	var subparts;
	var partname;
	var nodeFromUrl = 0;
	
	// get desired value from querystring
	var querystring = document.location.search;
	var queryparts  = querystring.split("&");
	
	for(var i = 0; i < queryparts.length; i++)
	{
		subparts = queryparts[i].split("=");
		partname = subparts[0].toString();
		
		if(partname.toLowerCase() == "src")
			nodeFromUrl = subparts[1];
	}
	
	// if isapi filter used (ex. "/map/show/111/src/11.htm")
	if(querystring == "")
	{
		var url = document.location;
		
		if(url.toString().indexOf("src") >=0)
		{
			queryparts = url.toString().split("src/");
			var src = queryparts[1];
			
			if(src.toString().indexOf("/") >= 0)
			{
				queryparts = src.toString().split("/");
				nodeFromUrl = queryparts[0];
			}
			else
			{
				queryparts = src.toString().split(".");
				nodeFromUrl = queryparts[0];
			}
		}
	}
	
	return nodeFromUrl;
}


/////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Highlights the cell for the selected node
/// </summary>
function HighlightNode(selectedNode)
{
	var nodeToHighlight = GetSelectedNodeFromUrl();
	
	if (nodeToHighlight == 0)
		nodeToHighlight = selectedNode;
		
	selectedNode = nodeToHighlight;
	
	SetMode("ID" + selectedNode, "on"); selectedNode = 0;
	
}


/////////////////////////////////////////////////////////////////

/// <author>Chbeir Elias</author>
/// <summary>
/// NextAndPreviousItems acts like an object that whil hold a nodeid and its rank,
/// along with the original rank of current nodeid in a certain module
/// </summary>
function NextAndPreviousItems(nodeID, rank, originalRank)
{
	this.NodeID       = nodeID;
	this.Rank         = rank;
	this.OriginalRank = originalRank;
}


/////////////////////////////////////////////////////////////////


/// <author>Richard Jean-Francois</author>
/// <co-author>Chbeir Elias</co-author>
/// <summary>
/// Change Class Name of a certain item given its nodeid and the mode (on, off)
/// </summary>
function SetMode(nodeID, mode)
{
	var x;
	
	if((nodeID == 0)||(nodeID == "ID0"))
	{
		var ident = "";
		if(nodeID.toString().indexOf('ID') >=0)
			ident = "ID";
			
		nodeID = ident + GetSelectedNodeFromUrl();
	}
	
	if(mode.toLowerCase() == "on")
		if(storedSelectedNode == nodeID)
			return;
			
	storedSelectedNode = nodeID;
	
	var cName;
	var cItem;
	var browser = DetectBrowser();
	var cArrowImg;
	var flechaBlanca = "/site_images/MThem3b/flecha_blanca";
	
	//Detect browser
	switch (browser)
	{
		case "MSIE" :
			cItem = document.all(nodeID);
			cArrowImg = document.all(nodeID + "_Img");
			break;
		case "NS" :
			cItem = document.layers[nodeID];
			cArrowImg = document.layers[nodeID + "_Img"];
			break;
		case "NS6" :
			cItem = document.getElementById(nodeID);
			cArrowImg = document.getElementById(nodeID + "_Img");
			break;
	}
	
	if(cItem == null)
		return;
		
	// Get current class name
	cName = cItem.className;
	
	// Switch to new mode
	switch(mode.toLowerCase())
	{
		case 'on' :
			if(cName.indexOf('_on') == -1)
			{
				cItem.className = cName + '_on';
				if(cArrowImg != null)
					cArrowImg.src = flechaBlanca + "2.gif";
			}
			
			break;
		case 'off' :
			var cPos = cName.indexOf('_on');
			if(cPos != -1)
				cItem.className = cName.substring(0,cPos);
			break;
	}
}


/////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Show only a certain number of rows (sub items) in required module(s)
/// hide the others items in the module(s)
/// </summary>

function ShowItems()
{
	var module = "";
	var noOfRows = 0;
	
	
	
	// form every module, show a certain number of items
	for(var k=0; k < Items.length; k++)
	{
	 for(var item = 0; item < Items[k].length; item++)
	 {
		module = Items[k][item];
		noOfRows = 0;
		
		
		// loop only within elements having the module in theis id;
		// as an example : if "MThemList" is a module, the the id must be as "MThemList_123456"
		
		for(var id = 1; id < IDs.length; id++)
		{			
			if(IDs[id].toString().indexOf(module) >= 0)
			{
				noOfRows++;
				if(noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.all(IDs[id]).style.display = "block";
				}
				else
				{
					document.all(IDs[id]).style.display = "none";
				}
			}			
		}
	 }
	}
}


/////////////////////////////////////////////////////////////////


/// <author>De Bisschop Sabine</author>
/// <summary>
/// Show only a certain number of rows (sub items) in required TYPE module(s)
/// hide the others items in the module(s)
/// </summary>
function ShowSimplyItems(lang)
{
	var module = "";
	var noOfRows = 0;
	mLang = lang;
	
	// form every module, show a certain number of items
	for(var k=0; k < TypeItems.length; k++)
	{
		module = TypeItems[k].toString();
		noOfRows = 0;
		
		// loop only within elements having the module in theis id;
		// as an example : if "MThemList" is a module, the the id must be as "MThemList_123456"
		
		for(var id = 1; id < IDs.length; id++)
		{			
			if(IDs[id].toString().indexOf(module + "_") >= 0)
			{
				noOfRows++;
				if(noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.all(IDs[id]).style.display = "block";
				}
				else
				{				
					document.all(IDs[id]).style.display = "none";
				}
			}			
		}		
		
	}
}


/////////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Shows the next and previous images and names with hyperlinks to
/// the next and previous editions
/// </summary>
function ShowNextAndPreviousEditions(NextAndPrevious, 
									 previousItemImg, 
									 previousItemName, 
									 nextItemImg, 
									 nextItemName)
{
	var foundPrevious = false;
	var foundNext = false;
	var addSeparatorBar = false;
	var separatorBar = "|";
	var previousHref = "";
	var nextHref = "";
	
	if (NextAndPrevious.length != 0)
	{
		var originalRank = NextAndPrevious[0].OriginalRank;
		
		if (NextAndPrevious.length == 1)
		{
			if (NextAndPrevious[0].Rank < NextAndPrevious[0].OriginalRank)
			{
				previousHref = ChangeDestinationModule(NextAndPrevious[0].NodeID);
				foundPrevious = true;
			}
			if (NextAndPrevious[0].Rank > NextAndPrevious[0].OriginalRank)
			{
				nextHref = ChangeDestinationModule(NextAndPrevious[0].NodeID);
				foundNext = true;
			}
		}
		if (NextAndPrevious.length == 2)
		{
			previousHref = ChangeDestinationModule(NextAndPrevious[0].NodeID);
			nextHref = ChangeDestinationModule(NextAndPrevious[1].NodeID);
			foundPrevious = true;
			addSeparatorBar= true;
			foundNext = true;
		}
	}
	
	var previousItem = "";
	var nextItem = "";
	
	if (foundPrevious)
	{
		if (previousItemImg != "")
			previousItem += "&nbsp;<a href=" + previousHref + "><img src=" + previousItemImg + " border=0></a>";
		if (previousItemName != "")
			previousItem += "&nbsp;<a href=" + previousHref + " class=MArchMag3_4>" + previousItemName + "</a>";	
	}
	
	if (addSeparatorBar)
		previousItem += "&nbsp;" + separatorBar;
	
	if (foundNext)
	{
		if (nextItemName != "")
			nextItem += "&nbsp;<a href=" + nextHref + " class=MArchMag3_4>" + nextItemName + "</a>";
		if (nextItemImg != "")
			nextItem += "&nbsp;<a href=" + nextHref + "><img src=" + nextItemImg + " border=0></a>";		
	}	
	
	document.write(previousItem + nextItem);
}


//////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Show all of the sub items within a module,
/// hiding items in all other modules exceeding rowsToShow
///
/// modif SDB - January 7th 2004
/// implementing function "ShowSubThemes(themeID)" to get it Netscape-compliant
/// </summary>
function ShowSubItems(module)
{	
	var verTodosItem;
	var itemModule;
	
	//changing image
	switchImg(module);
	
	// start with showing items (not exceeding rowsToShow) in all modules
	//ShowItems();
	ShowSimplyItems(mLang);
	
	// for every module, except current one, reset the hyperlink id to show
	for (var item = 0; item < Items.length; item++)
	{
		itemModule = Items[item];
			
		if (itemModule.toString().toLowerCase() != module.toString().toLowerCase())
		{
			verTodosItem = document.all(itemModule + "_hide");
			
			
			if (verTodosItem != null)
			{
				itemModule = itemModule.toString().toLowerCase();
				if (verTodosItem.toString().toLowerCase().indexOf(itemModule) >= 0)
					document.all(itemModule + "_hide").id = itemModule + "_show";
			}
		}
	}

	// get hyperlink object of current module to see if we need to show or hide items in module
	verTodosItem = document.all(module + "_hide");
	
	// if hide was on then set hyperlink id to show and hide items exceeding rowsToShow
	if (verTodosItem != null)
	{
		document.all(module + "_hide").id = module + "_show";
		
		var noOfRows = 0;
		
		for (var id = 1; id < IDs.length; id++)
		{
			if (IDs[id].toString().indexOf(module + "_") >= 0)
			{
				noOfRows++;
				if (noOfRows <= rowsToShow) // show elements until max number defined in var rowsToShow
				{	
					document.all(IDs[id]).style.display = "block";	
				}
				else
				{
					document.all(IDs[id]).style.display = "none";	
				}
			}
		}
	}
	
	// if show was on then set hyperlink id to hide and show all items
	if (verTodosItem == null)
	{
		document.all(module + "_show").id = module + "_hide";
		
		for (var item = 1; item < IDs.length; item++)
		{
			if (IDs[item].toString().indexOf(module) >= 0)
				document.all(IDs[item]).style.display = "block";
		}	
	}		
}


//////////////////////////////////////////////////////////////


var openedListID = 0;
function ShowSubThemes(themeID)
{
	var browser = navigator.userAgent;
	
	if(browser.indexOf("MSIE")>0)
	{	
		if (openedListID != 0)
		{	document.all(openedListID).style.display = "none"; }
			
		if (openedListID != themeID)
		{	document.all(themeID).style.display = "block"; }
			
		//if (openedListID == themeID)
		//{	document.all(themeID).style.display = "block";	}	
		
		if((themeID.indexOf("ID")==0)&&(themeID.length==8))
		{
			if (Menu_previousTheme != "")
			{ document.all(Menu_previousTheme + "_theme").style.color = "#336633";	}	// set color previous selected folder green
		
			document.all(themeID + "_theme").style.color = "#FF6633";		// set color selected folder red	
		}	
		
	}
	else
	{
		if (openedListID != 0)
		{	
			document.getElementById(openedListID).style.display = "none"; 
		}
			
		if (openedListID != themeID)
		{	document.getElementById(themeID).style.display = "table-row"; }
			
		//if (openedListID == themeID)
		//{	document.getElementById(themeID).style.display = "table-row";	}	
		
		if((themeID.indexOf("ID")==0)&&(themeID.length==8))
		{
			if (Menu_previousTheme != "")
			{ document.getElementById(Menu_previousTheme + "_theme").style.color = "#336633"; }	// set color previous selected folder green
				
			document.getElementById(themeID + "_theme").style.color = "#FF6633";		// set color selected folder red	
	}
		
	}	
	
	
	openedListID = themeID;	
	Menu_previousTheme = themeID;
}


//////////////////////////////////////////////////////////////


/// <author>De Bisschop Sabine</author>
/// <summary>
/// Check the bullet of the selected subitems,
/// unchecking bullets of all other subitems
/// </summary>
function checkBullet(folderID)
{
	//check bullet in theme table
	var imgL = document.images.length;
	var lastIndex = document.images.item(1).src.length;
	var firstIndex = document.images.item(1).src.indexOf("/img/");
	
	for(i=0;i++; i< imgL)	//uncheck all bullets !! bullet_on.gif = UNchecked
	{
		if(document.images.item(i).src.substr(firstIndex,lastIndex) == "/img/b_off.gif")
		{
			document.images.item(i).src = "/img/b_on.gif";
		}
	}
	eval("b"+folderID).src = "/img/b_off.gif"; // check selected bullet !! bullet_off = checked
	
	document.all("L"+folderID).style.color = "#FF9900";	//set selected text orange
}



/// <author>De Bisschop Sabine</author>
/// <summary>
/// set font-color of selected sub-sub-item
/// </summary>
function setSubSelectionColor(prefix, myColor)
{
	var m_url = window.location.href;
	var start, end;
	start = m_url.indexOf("src/");
	end = m_url.indexOf(".htm");
	
	var subsubthemeID = m_url.substring(start+4,end);	
	document.all(prefix + subsubthemeID).style.color = myColor;
}


/// <author>De Bisschop Sabine</author>
/// <summary>
/// switch button image more/less items
/// </summary>

function switchImg(module)
{
	moreItems = eval("document.img" + module).src.toString().indexOf("moreItems");
	lessItems = eval("document.img" + module).src.toString().indexOf("lessItems");
	
	
	//if yet a button in - view, reset it to + view
	if(moreItemsIMG.toString() != "")
	{
		eval(moreItemsIMG.toString()).src = "/site_images/" + lang + "/moreItems.gif";
	}
	
	//on image click, switch more / less 
	if (moreItems > 0)
	{
		eval("document.img" + module).src = "/site_images/" + lang + "/lessItems.gif";
		moreItemsIMG = "document.img" + module;
	}
	else if (lessItems > 0)
	{
		eval("document.img" + module).src = "/site_images/" + lang + "/moreItems.gif";
		moreItemsIMG = "";
	}		
}


/// <author>De Bisschop Sabine</author>
/// <summary>
/// build array of themes/subthemes and corresponding nodeID's under a certain rootfolder
/// </summary>

function Theme(nodeid, name)
{
	this.nodeid = nodeid;
	this.name = name;					
}


/// <author>De Bisschop Sabine</author>
/// <summary>
/// Show/Hide layers, by passing info (layer name + show/hide) as parameter
/// </summary>	

function showHideLayers() 
{ 
  var i,p,v,obj,args=showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=FindObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}


function FindObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}


//////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// Build array of Thematic Pages 
/// </summary>
function ThemePage(iD, pmtID)
{
	this.ID = iD;
	this.PmtID = pmtID;
}


/// <author>Chbeir Elias</author>
/// <summary>
/// Build array of themes/subthemes and corresponding nodeID's under a certain rootfolder
/// </summary>
function SubTheme(nodeID, parentID, subThemeName, mainThemeName)
{
	this.NodeID = nodeID;
	this.ParentID = parentID;
	this.Name = subThemeName;
	this.MainThemeName = mainThemeName;
}


/// <author>De Bisschop Sabine</author>
/// <author>Modified by Chbeir Elias on 21/01/2004</author>
/// <summary>
/// build link by adding thematic PAGE pmtID's
/// (if PAGE-PMTthemeID = GETMAINSUBTHEME-parentID, get PAGE PMTid)
/// </summary>	
function buildPMTlink(ParentID, NodeID, myClass, myID)
{
	for(ii=0; ii< Themes.length; ii++)
	{	
		if(Themes[ii].ID == ParentID)
		{	
			return "<a href='/map/show/" + Themes[ii].PmtID + "/src/" + NodeID + ".htm' class='" + myClass + "' id='" + myID + "'>";
		}
	}	
}




/// <author>Chbeir Elias</author>
/// <summary>
/// Build Themes Module; function created in order to lower the html weight of the module (thus, page less heavier).
///
/// weight before using this function = 156 kb
/// weight after using this function = 11 kb
/// </summary>
function BuildThemesModule(lang)
{
	var MainTheme = "";
	var themesMenu = "";
	var mainThemeName = "";
	var topmenu = "";
	
	if (lang =="fr")
		topmenu ="topmenu";

	if (lang =="nl")
		topmenu ="topmenuSmal";

    for (themeID = 0; themeID < Themes.length; themeID++)
    {
        themeHasItems = false;
        
        themesMenu = "" +
                    "<tr id='ID" + Themes[themeID].ID + "' style=display:none>" +
                    "	<td colspan=6 valign=top>" +
                    "		<table border=0 cellspacing=0 cellpadding=0>";
            
        for (subThemeID = 0; subThemeID < SubThemes.length; subThemeID++)
        {          
        	// Search for each subtheme to see if it belongs to current main theme
        	//write subthemes
        	if (SubThemes[subThemeID].ParentID == Themes[themeID].ID)
        	{
	       		themeHasItems = true;
        		mainThemeName = SubThemes[subThemeID].MainThemeName;

				themesMenu += "" +
                		"<tr>" +
                		"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=169 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=169 height=1></td>" +
                		"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=1 height=1><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=7 height=1><img src=/img/s2.gif width=7 height=1></td>" +
                		"</tr>" +
                		"<tr>" +
                		"	<td width=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1></td>" +
                		"	<td width=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1></td>" +
                		"	<td width=169 class=submenu>" +
                		"		<table border=0 cellspacing=0 cellpadding=0>" +
                		"			<tr>" +
                		"				<td valign=top><img name='b" + SubThemes[subThemeID].NodeID + "' id='b" + SubThemes[subThemeID].NodeID + "' src='/img/b_on.gif' border=0>&nbsp;&nbsp;&nbsp;</td>" +
                		"				<td valign=top>" +
                						buildPMTlink(Themes[themeID].ID, SubThemes[subThemeID].NodeID, "submenu", "L" + SubThemes[subThemeID].NodeID) +
                						SubThemes[subThemeID].Name +
                		"				</a></td>" + 
                		"			</tr>" +
                		"		</table>" +
                		"	</td>" +
                		"	<td width=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1></td>" +
                		"	<td width=1><img src=/img/s.gif width=1></td>" +
                		"	<td width=7 background=/img/s2.gif><img src=/img/s2.gif width=7></td>" +
                		"</tr>" +
                		"<tr>" +
                		"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=169 height=1 bgcolor=#999999><img src=/img/s.gif width=169 height=1></td>" +
                		"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=1 height=1><img src=/img/s.gif width=1 height=1></td>" +
                		"	<td width=7 height=1><img src=/img/s2.gif width=7 height=1></td>" +
                		"</tr>";
        	}
        }
		
		themesMenu += "" +
					"		</table>" +
					"	</td>" +
					"</tr>";
		
		if (themeHasItems) //write main themes
		{
			MainTheme += "" +
					"<tr>" +
					"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=169 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=169 height=1></td>" +
					"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 height=1><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=7 height=1><img src=/img/s2.gif width=7 height=1></td>" +
					"</tr>" +
					"<tr>" +
					"	<td width=1 bgcolor=#FFFFFF height=1><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 height=17 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=169 class='" + topmenu + "'>" +
					"		&nbsp;<a href='javascript:ShowSubThemes(\"ID" + Themes[themeID].ID + "\")' class='" + topmenu + "' id=ID" + Themes[themeID].ID + "_theme>" + mainThemeName + "</a></td>" +
					"	<td width=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=7><img src=/img/s2.gif width=7 height=17></td>" +
					"</tr>" +
					"<tr>" +
					"	<td width=1 height=1 bgcolor=#FFFFFF><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=169 height=1 bgcolor=#999999><img src=/img/s.gif width=169 height=1></td>" +
					"	<td width=1 height=1 bgcolor=#E9E9E9><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=1 height=1><img src=/img/s.gif width=1 height=1></td>" +
					"	<td width=7 height=1><img src=/img/s2.gif width=7 height=1></td>" +
					"</tr>" + themesMenu;  
		}
	}

    document.write(MainTheme);
}


//////////////////////////////////////////////////////////////


/// <author>Chbeir Elias</author>
/// <summary>
/// function written to Display a Static Module for TA called "TA Info";
/// required only in order to make module lighter 
///
/// weight before using this function = 10 kb
/// weight after using this function = 2 kb
/// </summary>


var OverTA = new Array();

function OverTAitem(name, url, target)
{
	this.Name = name;
	this.Url = url;
	this.target = target;
}

OverTA[0] = new OverTAitem("Wie zijn wij ?", "/map/show/17457/src/236191.htm", "_self");
OverTA[1] = new OverTAitem("Jobs", "/map/show/17167.htm", "_self");
OverTA[2] = new OverTAitem("Voordelen", "/map/show/17412/src/235791.htm", "_self");
OverTA[3] = new OverTAitem("Publicaties", "/map/show/17262/src/72071.htm", "_self");
OverTA[4] = new OverTAitem("Pers", "/public/nl/sendmail_press.aspx", "_self");
OverTA[5] = new OverTAitem("Zich abonneren", "http://www.totaal-service.be", "_blank");

OverTA[6] = new OverTAitem("Qui sommes-nous ?", "/map/show/16522/src/236231.htm", "_self");
OverTA[7] = new OverTAitem("Jobs", "/map/show/16332.htm", "_self");
OverTA[8] = new OverTAitem("Avantages", "/map/show/15912/src/235801.htm", "_self");
OverTA[9] = new OverTAitem("Publications", "/map/show/16512/src/72091.htm", "_self");
OverTA[10] = new OverTAitem("Presse", "/public/FR/sendMail_press.aspx", "_self");
OverTA[11] = new OverTAitem("S'abonner", "http://www.serviceglobal.be", "_blank");


function DisplayOverTAitem(lang)
{
	var display = "";
	var start = 0;
	var end = 0;

	if (lang == "nl")
	{
		start = 0;
		end = 6;	
	}
	
	if (lang == "fr")
	{
		start = 6;
		end = 12;	
	}

	for (i = start; i < end; i++)
        {
        	display += "" +
                        "<tr>" +
                        "<td width='1' height='1' bgcolor='#ffffff'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' height='1' bgcolor='#ffffff'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='169' height='1' bgcolor='#ffffff'><img src='/img/s.gif' width='169' height='1'></td>" +
                        "<td width='1' height='1' bgcolor='#ffffff'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' height='1'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='7' height='1'><img src='/img/s2.gif' width='7' height='1'></td>" +
                        "</tr>" +
                        "<tr>" +
                        "<td width='1' bgcolor='#ffffff' height='1'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' height='17' bgcolor='#e9e9e9'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='169' class='topmenu'>" +
                        "	&nbsp;<a href='" + OverTA[i].Url + "' target='" + OverTA[i].target + "' class='topmenu'>" + OverTA[i].Name + "</a></td>" +
                        "<td width='1' bgcolor='#e9e9e9'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' bgcolor='#ffffff'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='7'><img src='/img/s2.gif' width='7' height='17'></td>" +
                        "</tr>" +
                        "<tr>" +
                        "<td width='1' height='1' bgcolor='#ffffff'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' height='1' bgcolor='#e9e9e9'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='169' height='1' bgcolor='#999999'><img src='/img/s.gif' width='169' height='1'></td>" +
                        "<td width='1' height='1' bgcolor='#e9e9e9'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='1' height='1'><img src='/img/s.gif' width='1' height='1'></td>" +
                        "<td width='7' height='1'><img src='/img/s2.gif' width='7' height='1'></td>" +
                        "</tr>";
        }	

	document.write(display);
}


//////////////////////////////////////////////////////////////


/// <author>sdb</author>
/// <summary>
/// function written to Display a Static Module for TA called "Bookmark";
/// required to show module only for PC && IE browser 
/// </summary>

function  addToBookmark(m_lang)
{
	var bookmarkurl;
	if (m_lang=="NL")
	{
		bookmarkurl = "http://www.test-aankoop.be/"; 
	var bookmarktitle="Test-Aankoop - consumenten organisatie";
	}
	else
	{
		bookmarkurl = "http://www.test-achats.be/";
		var bookmarktitle="Test-Achats - organisation des consommateurs";
	}
	
	window.external.AddFavorite(bookmarkurl,bookmarktitle);
}

function checkAddBookmark(m_lang)
{
	
	var BM_title, BM_text, BM_button; 
	
	if (m_lang=="NL")
	{
		BM_text = "of voeg deze site toe aan de <a href=javascript:addToBookmark('" + m_lang + "');>favorieten</a> van uw browser.";
		BM_button = "<img src='/site_images/NL/bevestig.gif' border='0' height='13' width='59' alt='bevestig'>";
	}
	else
	{
		BM_text = "ou ajoutez ce site aux <a href=javascript:addToBookmark('" + m_lang + "');>favoris</a> de votre navigateur.";
		BM_button = "<img src='/site_images/FR/valider.gif' border='0' height='13' width='59' alt='validez'>";
	}
	
	
		
	//write text "add to favorites"
	if ((navigator.appVersion.indexOf("MSIE") > 0)&& (parseInt(navigator.appVersion) >= 4)&&(navigator.appVersion.indexOf ("Mac")<0)) 
	{
		document.write("<tr><td colspan='4' class='poll' height='4'><img src='/img/s.gif' border='0' height='4' width='120'></td></tr>"
		+ "<tr><td class='poll'>&nbsp;</td><td colspan='2' class='poll'>" + BM_text + "</td>"
		+ "<td class='poll'>&nbsp;</td></tr>"
		+ "<tr><td colspan='4' class='poll' height='4'><img src='/img/s.gif' border='0' height='6' width='120'></td></tr>");
	}
}

function writeLinkStart(m_lang)
{
	
	if (m_lang=="NL")
	{
		if (document.all){
		document.write('<a class=\'red\' href=\"#\" onClick="this.style.behavior=\'url(#default#homepage)\';this.setHomePage(\'http://www.test-aankoop.be\');" title=\" IE users: Click here to make the Guide your browser Start Page. (Opera: > Navigation > Set Home Page) \">');
		document.write('Start Page</a>');
		}
		// If it's Netscape 6, tell user to drag link onto Home button
		else if (document.getElementById){
		document.write('<a class=\"red\" style=\'cursor:help\' href="http://www.yoursite.com" title=\" Make the Web Evangelism Guide your browser Start Page: drag this link onto the browser top-left Home graphic button \" onClick=\'return false\'>Start Page</a>');
		}
		// If it's Netscape 4 or lower, give instructions to set Home Page
		else if (document.layers){
		document.write('<span class=\"popup2\" title=\' Make the Guide your browser Start Page: - Go to Preferences in the Edit Menu. Choose Navigator from the list on the left. Click on the Use Current Page button. \'>Start page</span>');
		}
		// If it's any other browser, for which I don't know the specifications of home paging, display instructions
		else {
		document.write('<span class=\"popup2\" title=\' Make the Guide your browser Start Page: - Go to Preferences in the Edit Menu. Choose Navigator from the list on the left. Click on the Use Current Page button. \'>Start page</span>');
		}
	}
}


