
	/////////////////////////////////////////////////////////////////////////////
	// Class : ccom_top_nav_static_inc
	// Comments : 
	/////////////////////////////////////////////////////////////////////////////

	var HttpRelativeFragmentsRoot = g_HttpRelativeWebRoot + "fragments/"
		
	function NavImage(source,width,height)
	{
		this.width = width;
		this.height = height;
		this.source = source;
	}
			
	function getHeight()
	{
		return this.height;
	}

	function getWidth()
	{
		return this.width;
	}

	function getSource()
	{
		return this.source;
	}
	
		
	NavImage.prototype.getHeight = getHeight;
	NavImage.prototype.getWidth = getWidth;
	NavImage.prototype.getSource = getSource;
	
	function ccom_top_nav_static_inc ()		
	{
		this.m_HomeLevel = 0;
		this.m_StartLevel = 1;
		this.m_NumLevels = 10;
		this.m_EndLevel = 0;
		this.m_DefaultNumColumns = 3;
		this.m_ShowHome  = true;
		this.m_ShowSectionHeading = false;
		this.imgHandling = true;
		this.useAltHoverImg = true;
		this.childMenus = "";
		this.navIndex = 0;
		this.ImageMap = new Array();
		
		if(typeof(g_navNode_Path) != 'undefined'){
			this.m_NavPath  = g_navNode_Path;
		}
		else
		{
			/*NavPath doesn't exist on static site, set to empty array*/
			this.m_NavPath  = new Array();
		}
		
		if(g_ssSourceSiteId == "ss_project_ccom"){
		
			this.m_HomeLevel = 0;
			this.m_StartLevel = 1;
			this.m_NumLevels = 10;
			this.useAltHoverImg = false;
		
			this.ImageMap["716"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_home.gif",64,26); 
			this.ImageMap["764"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_company.gif",101,26); 
			this.ImageMap["765"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_responsibility.gif",163,26); 
			this.ImageMap["766"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_products&services.gif",142,26); 
			this.ImageMap["767"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_connections.gif",100,26);
			this.ImageMap["768"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_news.gif",102,26); 
			this.ImageMap["769"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_careers.gif",75,26); 
			this.ImageMap["961"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images/nav_contact.gif",86,26); 
		}
		else if(g_ssSourceSiteId == "CSEG_SALT")
		{
			this.m_HomeLevel = 0;
			this.m_StartLevel = 1;
			this.m_NumLevels = 10;
			
			this.ImageMap["1529"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_home.gif",87,26);
			this.ImageMap["1566"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_about.gif",112,26);
			this.ImageMap["1568"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_channels.gif",130,26);
			this.ImageMap["1569"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_products.gif",124,26);
			this.ImageMap["1570"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_brands.gif",121,26);
			this.ImageMap["1571"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_contacts.gif",134,26);
			this.ImageMap["1572"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_salt/nav_distributors.gif",125,26);
		}
		else if(g_ssSourceSiteId == "cseg_food")
		{
			this.m_HomeLevel = 2;
			this.m_StartLevel = 3;
			this.m_NumLevels = 10;

			/*NA*/
			this.ImageMap["1833"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_home.gif",100,26);
			this.ImageMap["1840"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_categories.gif",202,26);
			this.ImageMap["1841"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_products.gif",150,26);
			this.ImageMap["1842"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_brands.gif",138,26);
			this.ImageMap["1843"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_news.gif",128,26);
			this.ImageMap["1844"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_contacts.gif",123,26);
			
			/*EMEA*/
			this.ImageMap["1835"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_home.gif",100,26);
			this.ImageMap["1910"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_categories.gif",202,26);
			this.ImageMap["1913"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_products.gif",150,26);
			this.ImageMap["1916"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_brands.gif",138,26);
			this.ImageMap["1919"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_news.gif",128,26);
			this.ImageMap["1922"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_contacts.gif",123,26);
			
			/*LAT*/
			this.ImageMap["1838"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_home.gif",100,26);
			this.ImageMap["1911"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_categories.gif",202,26);
			this.ImageMap["1914"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_products.gif",150,26);
			this.ImageMap["1917"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_brands.gif",138,26);
			this.ImageMap["1920"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_news.gif",128,26);
			this.ImageMap["1923"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_contacts.gif",123,26);
			
			/*AP*/
			this.ImageMap["1839"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_home.gif",100,26);
			this.ImageMap["1912"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_categories.gif",202,26);
			this.ImageMap["1915"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_products.gif",150,26);
			this.ImageMap["1918"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_brands.gif",138,26);
			this.ImageMap["1921"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_news.gif",128,26);
			this.ImageMap["1924"] = new NavImage(HttpRelativeFragmentsRoot + "ccom_top_nav/_images_food/en/nav_contacts.gif",123,26);
		}

		this.m_EndLevel = this.m_StartLevel + this.m_NumLevels - 1 ;
		this.m_HomeLevel = this.m_StartLevel - 1;
	}

	function Display (node)
	{
		if(g_ssSourceSiteId == "ss_project_ccom")
		{
			document.write("<ul id=\"topnav\">");
		}
		else
		{
			document.write("<ul id=\"topnav_grey\">");
		}
		
		//document.write("<ul>");
		this.DisplayNode(node);
		document.write("</ul>");
		document.write(this.childMenus);

		document.write("<script type=\"text/javascript\">");
		document.write("window.onload=function(){");

			for(var i=1; i<=this.navIndex; i++){
				var position;
				
				position = "right-bottom";
				
				if(g_ssSourceSiteId != "ss_project_ccom")
				{
					this.useAltHoverImg = true;
				}
				
				document.write("var navitem" + i + " = new navElement(\"menuItem" + i + "\", \"" + position + "\", 250, " + this.imgHandling.toString() + "," + this.useAltHoverImg.toString() + ");");
			}	

		document.write("}");
		document.write("</script>");
	}

	function DisplayNode (node)
	{
		var bSelected = false;
		var activeTopElement = false;
		var  nodeColor = "";
		var  nodeClass = "";
		var nodeLevel = node.m_level;
		var nodeHref = node.m_href;
		var nodeLabel = node.m_label;
		var xchildren = node.m_subNodes;
		var numChildNodes = node.m_subNodes.length;
		
		var columnNum = this.m_DefaultNumColumns;		
		excSubSections = false;
		excSection = false;
		
		
		/*Perform a count of sub nodes to include. We have to check for excludes*/
		if (node.m_subNodes.length > 0 && (nodeLevel == this.m_StartLevel))
		{
			if(customSectionPropertyExists(node.cp_ExcludeTopNavSubSections) && (getCustomSectionProperty(node.cp_ExcludeTopNavSubSections).toLowerCase() == "true"))
			{
				numChildNodes = 0;
			}
			else
			{
				childCount = 0;
				for(i = 0; i < node.m_subNodes.length; i++)
				{
					curNode = curNode = xchildren[i];;

					if(!(customSectionPropertyExists(curNode.cp_ExcludeInTopNav) && (getCustomSectionProperty(curNode.cp_ExcludeInTopNav).toLowerCase() == "true")))
					{
						childCount++;
					}
				}

				numChildNodes = childCount;
			}
		}
		
		
		if(customSectionPropertyExists(node.cp_AltLabel))
		{		
			var altLabel = getCustomSectionProperty(node.cp_AltLabel);
			if(altLabel.length > 0)
			{
				nodeLabel = altLabel;
			}
		}
		if(customSectionPropertyExists(node.cp_ExcludeTopNavSubSections))
		{		
			getCustomSectionProperty(node.cp_ExcludeTopNavSubSections).toLowerCase() == "true" ? excSubSections = true : excSubSections = false;
		}
		if(customSectionPropertyExists(node.cp_ExcludeInTopNav))
		{		
			getCustomSectionProperty(node.cp_ExcludeInTopNav).toLowerCase() == "true" ? excSection = true : excSection = false;
		}
		if(customSectionPropertyExists(node.cp_TopNavPanelColumns))
		{		
			var colNum = parseInt(getCustomSectionProperty(node.cp_TopNavPanelColumns));
			if(!isNaN(colNum))
			{
				columnNum = colNum;
			}
		}
		if(customSectionPropertyExists(node.cp_LinkToExtURL))
		{		
			var extURL = getCustomSectionProperty(node.cp_LinkToExtURL);
			if(extURL.length > 0)
			{
				nodeHref = extURL;
			}
		}
		
	
		if(!excSection)
		{
			//if (nodeLevel > 6)
			//	nodeLevel = 6;

			/*The code below is never executed on a static site*/
			if (this.m_NavPath.length > 0 && node.m_level < this.m_NavPath.length)
			{
				if (this.m_NavPath[node.m_level] == (node.m_id))
				{
					//top nav classes
					if (node.m_level <= this.m_StartLevel)
						{
						//if Home node
						if (node.m_level == this.m_HomeLevel)
						{
							//only the home node is selected
							if((this.m_NavPath.length - this.m_HomeLevel) == 1)
							{
								bSelected = true;
								nodeClass += "current";
								activeTopElement = true;
							}
							else
							{
								bSelected = true;
							}
						}
						//start level node as active when active or lower child node is selected
						else if (node.m_level == this.m_StartLevel)
						{
							bSelected = true;
							//nodeClass += "currentSection";
							activeTopElement = true;
						}
						else
						{
							bSelected = true;
						}
					}
					//panel nav classes
					else if (node.m_level > this.m_StartLevel)
					{
						//last node selected mark as active
						if (node.m_level == (this.m_NavPath.length-1))
						{
							bSelected = true;
							nodeClass += "current";
						}
						//else mark current node as selected so child nodes are included
						else
						{
							bSelected = true;
						}
					}
				}
			}


			/*mark everything under start level as selected so all the nav is built out or mark all if home node is website root*/
			if((this.m_HomeLevel == 0 || nodeLevel >= this.m_StartLevel) && nodeLevel <= this.m_EndLevel)
			{
				bSelected = true;
			}


			//add top level arrows to non-selected nodes
			if(!bSelected && (nodeLevel == this.m_HomeLevel || nodeLevel == this.m_StartLevel))
			{
				nodeClass += "notcurrent";
			}

			//nodeClass += "-" + var.valueOf(nodeLevel);

			if ((nodeLevel > this.m_StartLevel && nodeLevel <= this.m_EndLevel))
			{				
				this.childMenus += "<li>";

				var navLink = "";

				//lowest selected node
				/*
				if (nodeLevel == (this.m_NavPath.length-1) && this.m_NavPath[node.m_level] == (node.m_id))
				{
					navLink += "<a";
				}
				else
				{
					navLink += "<a href=\"" + nodeHref + "\"";
				}
				*/

				navLink += "<a href=\"" + nodeHref + "\"";

				if(nodeClass.length>0){
					navLink += " class=\"" + nodeClass + "\"";
				}
				
				if(customSectionPropertyExists(node.cp_OpenInNewWindow) && (getCustomSectionProperty(node.cp_OpenInNewWindow).toLowerCase() == "true"))
				{
					navLink += " target =\"_blank\" ";
				}

				navLink += ">" + nodeLabel + "</a>";

				this.childMenus += navLink;
			}
			else if ((nodeLevel == this.m_HomeLevel && this.m_ShowHome && bSelected)  || nodeLevel == this.m_StartLevel) 
			{
				if (numChildNodes > 0 && nodeLevel != this.m_HomeLevel && !excSubSections)
				{
					this.navIndex++;
				}

				document.write("<li>");

				var navLink = "";

				//lowest selected node
				/*
				if (nodeLevel == (this.m_NavPath.length-1) && this.m_NavPath[node.m_level] == (node.m_id))
				{
					navLink += "<a";
				}
				else
				{
					navLink += "<a href=\"" + nodeHref + "\"";
				}
				*/

				if (numChildNodes > 0 && nodeLevel != this.m_HomeLevel && !excSubSections)
				{
					navLink += "<a class=\"off\" id=\"menuItem" + this.navIndex + "\" rel=\"menuPanel" + this.navIndex + "\" href=\"" + nodeHref + "\"";
				}
				else
				{
					navLink += "<a href=\"" + nodeHref + "\"";
				}
				
				if(customSectionPropertyExists(node.cp_OpenInNewWindow) && (getCustomSectionProperty(node.cp_OpenInNewWindow).toLowerCase() == "true"))
				{
					navLink += " target =\"_blank\" ";
				}

				//navLink += " class=\"" + nodeClass + "\"";
				navLink += ">";

				navImg = null;
				navImgWidth = 0;
				navImgHeight = 0;
				navImgSource = "";
									
				if (typeof(this.ImageMap[node.m_id]) != 'undefined'){
					navImg = this.ImageMap[node.m_id];
				}
											
				if(navImg != null){
					navImgWidth = navImg.getWidth();
					navImgHeight = navImg.getHeight();
					navImgSource = navImg.getSource();
										
					if (activeTopElement)
					{
						navImgSource = navImgSource.replace(/\.gif$/,"-d.gif");
					}
					
					navLink += "<img ";
					
					/*if no child nodes then no tab will show use global js to handle rollovers*/
					if(numChildNodes == 0 || nodeLevel == this.m_HomeLevel)
					{
						navLink += " class=\"roll\" ";
					}
						
					navLink += " src=\"" + navImgSource + "\" alt=\"" + nodeLabel + "\" height=\"" + navImgHeight + "\" width=\"" + navImgWidth + "\" />";				
				}
				
				//navLink += nodeLabel + "</a>";
				
				//Add in text for printing only
				if (activeTopElement)
				{
					navLink += "<span class=\"printNavLabelActive\">" + nodeLabel + "</span>";
				}
				else
				{
					navLink += "<span class=\"printNavLabel\">" + nodeLabel + "</span>";
				}
				
				
				navLink += "</a>";

				document.write(navLink);

			}

			//If home node close li
			if (nodeLevel == this.m_HomeLevel && (this.m_ShowHome || this.m_ShowSectionHeading) && bSelected)
			{
				document.write("</li>");
			}

			if (bSelected)
			{	// expand sub-levels (if any)
				
				if(numChildNodes > 0 && nodeLevel < this.m_EndLevel && !excSubSections){
					// if this is the top level, build out divs for child nodes
					if ((nodeLevel) == this.m_StartLevel)
					{
						/*If there is not enough top level panel nodes for number of columns, decrease it to number availible*/
						if(columnNum > numChildNodes)
						{
							columnNum = numChildNodes;
						}
						
						var numLinksPerCol = Math.floor(numChildNodes/columnNum);
						var actualNumLinksPerCol = numLinksPerCol;
						var remainingLinks = numChildNodes % columnNum;
						var columnNodeCount = 0;
						var columnWidth = 150;
						var columnWidthDivider = 3;
						var totalNodeCount = 0;

						var totalWidth = columnNum * (columnWidth + ((columnNum - 1) * columnWidthDivider));

						//set width on container and append to front
						this.childMenus += "<div id=\"menuPanel" + this.navIndex + "\" style='width:" + totalWidth + "px; background-color:#FFFFFF; margin: 0px; padding:0px;'><div class='shadow-container'><div class='shadow1'><div class='shadow2'><div class='shadow3'><div class='container'><table style='width:" + totalWidth + "px; margin: 0px; padding:0px;' border='0' cellspacing='0' cellpadding='0'>\n";
						this.childMenus += "<tr><td style='height:10px;'></td></tr>";
						this.childMenus += "<tr>";

						//this.childMenus += "<div id=\"menuPanel" + this.navIndex + "\" style='border:solid #999 1px; background-color:#FFFFFF; margin: 0px; padding:0px;'><table style='margin: 0px; padding:0px;' border='0' cellspacing='0' cellpadding='0'><tr>\n";
						/*We need to use the whole array size, even though some nodes may not be included*/
						for (var i = 0; i < node.m_subNodes.length; i++)
						{
							curNode = xchildren[i];

							if(!(customSectionPropertyExists(curNode.cp_ExcludeInTopNav) && (getCustomSectionProperty(curNode.cp_ExcludeInTopNav).toLowerCase() == "true")))
							{
								columnNodeCount++;
								totalNodeCount++;
								if (columnNodeCount==1)
								{
									this.childMenus += "<td valign='top' style='width:"+ columnWidth + "px;'>\n";
									this.childMenus += "<ul class='dropDownList'>\n";
								}

								this.DisplayNode(curNode);

								if(remainingLinks > 0)
								{
									actualNumLinksPerCol = numLinksPerCol + 1;
								}
								else
								{
									actualNumLinksPerCol = numLinksPerCol;
								}

								//if new column or end of child nodes close column
								if (columnNodeCount >= actualNumLinksPerCol || totalNodeCount == numChildNodes)
								{
									this.childMenus += "</ul>\n";
									this.childMenus += "</td>\n";
									//If not the last column add line
									if (totalNodeCount != numChildNodes)
									{
										this.childMenus += "<td valign='top' class='panelDivider' style='width:"+ columnWidthDivider + "px;'></td>\n";
									}
									columnNodeCount = 0;
									remainingLinks--;
								}
							}
						}

						this.childMenus += "<tr><td style='height:10px;'></td></tr>";
						this.childMenus += "</tr>";
						this.childMenus += "</table></div></div></div></div></div>";

						/*Add in iframe to fix select layer issues in ie6 and below*/
						this.childMenus += "<!--[if lte IE 6.5]><iframe id='menuPanel" + this.navIndex + "Layer' class='layerMenuPanel' src='" + HttpRelativeFragmentsRoot + "ccom_top_nav/iframe_layer.html' scrolling='no' frameborder='0'></iframe><![endif]-->";

						this.childMenus += "</div>\n";

					}
					//if this is the above start level or below, just build out child nodes as normal nested lists
					else
					{
						if (nodeLevel >= this.m_StartLevel){
							this.childMenus += "<ul>";
						}

						for (var i = 0; i < numChildNodes; i++)
						{
							this.DisplayNode(xchildren[i]);	
						}

						if (nodeLevel >= this.m_StartLevel){
							this.childMenus += "</ul>";
						}
					}
				}
			}

			//If greater than home node close after children
			if (nodeLevel == this.m_StartLevel)
			{
				document.write("</li>");
			}
			else if (nodeLevel > this.m_StartLevel && nodeLevel <= this.m_EndLevel)
			{
				this.childMenus += "</li>";
			}
		}
	}


	ccom_top_nav_static_inc.prototype.Display=Display;
	ccom_top_nav_static_inc.prototype.DisplayNode=DisplayNode;
	
	top_nav = new ccom_top_nav_static_inc();
	top_nav.Display(g_navNode_Root);
