
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	declare global variables
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
//	variable declaration
//	
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// declare global variables
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	
	var iAmTesting = false;
	
	var theBaseUrl;
	var theDomPath;
	var theDomPathContent;
	
	var currentUrl;
	var currentUrlFragments;
	var currentFile;
	var currentFileName;
	var currentDirectory;
	
	var theBrowser;
	var theBrowserType = window.navigator.appName;
	var theBrowserIsOpera = (navigator.userAgent.indexOf("Opera")!= -1)?1:0;

	var xDivisionValue;
	var xDepartmentValue;
	var xProductValue;
	var xCategoryValue;
	var xSubCategoryValue;
	var xSubCategory01Value;
	var xSubCategory06Value;
	var pageTitleValue;

	var breadcrumbText01 = '<span class="textSmall">You are here: </span> ';

//  un-comment for go-live and replace link with actual link
//
//	var breadcrumbText05 = '<span class="textSmall">> </span><a href="http://www.cargill.com/products/crop/ps_livestock.htm" class="linkSmall" title="Livestock">Livestock</a> ';

	var breadcrumbValue01 = "";
	var breadcrumbValue02 = "";
	var breadcrumbValue03 = "";
	var breadcrumbValue04 = "";
	var breadcrumbValue05 = "";
	var breadcrumbValue06 = "";
	var breadcrumbValue07 = "";
	var breadcrumbValue08 = "";



	
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
//	functions
//	
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// function: parse url
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
		theBaseUrl = "http://www.cargilltexturizing.es/"	
		currentUrl = self.location.href;
		currentUrlFragments = currentUrl.split("/");
		currentFile = currentUrlFragments[currentUrlFragments.length-1];
		currentFileName = currentFile.split(".")[0];
		currentDirectory = currentUrlFragments[currentUrlFragments.length-2];
		
		//=-=-=-=-=-= alerts for testing =-=-=-=-=-=		
		if (iAmTesting) alert ('currentUrl = ' + currentUrl);
		if (iAmTesting) alert ('currentFile = ' + currentFile);
		if (iAmTesting) alert ('currentFileName = ' + currentFileName);
		if (iAmTesting) alert ('currentDirectory = ' + currentDirectory);

		
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// function: get dcl values from meta tags
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	

	function getDclValue (dclValue)
		{	
		switch (theBrowser)
			{	

			//=-=-=-=-=-= netscape 4 =-=-=-=-=-=
			
			case "ns4":
				// the netscape 4.x DOM provides no easy way to reference <meta> tags
				// no breadcrumbs will be displayed as a result
				if (iAmTesting) alert("Netscape 4.x = no breadcrumbs");
			break;
			
			//=-=-=-=-=-= netscape 6 and up =-=-=-=-=-=
			
			case "ns6":
				if (document.getElementById(dclValue))
					{
					switch (dclValue)
						{
						case "xDepartment":
							xDepartmentValue = document.getElementById(dclValue).content;
							return true;
						break;
						
						case "xProduct":
							xProductValue = document.getElementById(dclValue).content;
							return true;
						break;
						
						case "xCategory":
							xCategoryValue = document.getElementById(dclValue).content;
							return true;
						break;
						
						case "xSubCategory":
							xSubCategoryValue = document.getElementById(dclValue).content;
							return true;
						break;
						
						case "xSubCategory01":
							xSubCategory01Value = document.getElementById(dclValue).content;
							return true;
						break;
						
						case "xSubCategory06":
							xSubCategory06Value = document.getElementById(dclValue).content;
							return xSubCategory06Value;
						break;
						
						case "xTier6":
							xTier6Value = document.getElementById(dclValue).content;
							return xTier6Value;
						break;
						
						case "title":
							titleValue = document.getElementById(dclValue).content;
							return titleValue;
						break;
						
						case "pageTitle":
							pageTitleValue = document.getElementById(dclValue).content;
							return pageTitleValue;
						break;
						
						default:
							// do nothing for now
						break;
						} 
					}
				else
					{
					//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
					if (iAmTesting) alert(dclValue + " >>> DOES NOT Exist");
					}
			break;
			
			//=-=-=-=-=-= ie =-=-=-=-=-=
			
			case "ie":
				theDomPath = "document.all.";
				theDomPath += dclValue;
				
				//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
				if (iAmTesting) alert("theDomPath = " + theDomPath);
				
				theDomPathContent = "document.all.";
				theDomPathContent += dclValue;
				theDomPathContent += ".content";
				
				//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
				if (iAmTesting == "yes") alert("theDomPathContent = " + theDomPathContent);
				
				if (eval(theDomPath))
					{
					switch (dclValue)
						{
						case "xDepartment":
							xDepartmentValue = eval(theDomPathContent);
							return true;
						break;
						
						case "xProduct":
							xProductValue = eval(theDomPathContent);
							return true;
						break;
						
						case "xCategory":
							xCategoryValue = eval(theDomPathContent);
							return true;
						break;
						
						case "xSubCategory":
							xSubCategoryValue = eval(theDomPathContent);
							return true;
						break;
						
						case "xSubCategory01":
							xSubCategory01Value = eval(theDomPathContent);
							return true;
						break;
						
						case "xSubCategory06":
							xSubCategory06Value = eval(theDomPathContent);
							return xSubCategory06Value;
						break;
						
						case "xTier6":
							xTier6Value = eval(theDomPathContent);
							return xTier6Value;
						break;	
						
						case "title":
							titleValue = eval(theDomPathContent);
							return titleValue;
						break;
						
						case "pageTitle":
							pageTitleValue = eval(theDomPathContent);
							return pageTitleValue;
						break;			
						
						default:
							// do nothing for now
						break;
						} 
					}
				else
					{
					//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
					if (iAmTesting) alert(dclValue + " >>> DOES NOT Exist");
					}
			break;
			
			//=-=-=-=-=-= unknown =-=-=-=-=-=
			
			default:
				// no breadcrumbs
			break;
			}
		}

	
		
			
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
//
//	begin code
//	
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=




//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// opera browser sniff
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
			

	if (theBrowserIsOpera)
		{
		var theBrowserType = "Opera";

		//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
		if (iAmTesting) alert("The browser is Opera");
		}
			
				
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// ie and netscape browser sniff
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	

	switch (theBrowserType)
		{
		//=-=-=-=-=-= ie =-=-=-=-=-=
				
		case "Microsoft Internet Explorer": 
		case "Opera": 
			theBrowser = "ie";
			
			//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
			if (iAmTesting) alert("The browser is Microsoft Internet Explorer");
		break;

		case "Netscape":
						
			//=-=-=-=-=-= netscape 4 =-=-=-=-=-=
			
			if (document.layers)
				{
				var theBrowser = "ns4";
				
				//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
				if (iAmTesting) alert("The browser is Netscape 4.x");
				}

			//=-=-=-=-=-= netscape 6 and up =-=-=-=-=-=
							
			else
				{
				var theBrowser = "ns6";
				
				//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
				if (iAmTesting) alert("The browser is Netscape 6.x+ or Mozilla");
				}
				
		break;

		//=-=-=-=-=-= other =-=-=-=-=-=
						
		default:
			var theBrowser = "other";
			
			//=-=-=-=-=-= alerts for testing =-=-=-=-=-=
			if (iAmTesting) alert("The browser is unknown");
		break;
		}
	
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
	set navigation links
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/

	var navContent00;
	var navContent01;
	var navContent02;
	var navContent03;
	var navContent04;
	var navContent05;
	var navContent06;
	var navContent07;

	
	navContent00 = '<div id="navcontainer"><ul><li id="emptyLeft">&nbsp;</li>';
	navContent01 = '<li><a href="'+theBaseUrl+'cts_index_es.shtml">Inicio</a></li>';
	navContent02 = '<li><a href="'+theBaseUrl+'our_business/cts_bus_es.shtml">Nuestra empresa</a></li>';
	navContent03 = '<li><a href="'+theBaseUrl+'news/cts_news_es.shtml">Noticias y eventos</a></li>';
	navContent04 = '<li><a href="'+theBaseUrl+'products/cts_prod_es.shtml">Productos</a></li>';
	navContent05 = '<li><a href="'+theBaseUrl+'markets/cts_markets_es.shtml">Mercados</a></li>';
	navContent06 = '<li><a href="'+theBaseUrl+'locations/cts_loc_es.shtml">Localizaci&oacute;n</a></li>';
	navContent07 = '<li><a href="https://www.ctscontacts-es.cargill.com/texturizing/emailtrackeres.nsf/ctsemailformExt?OpenForm">Cont&aacute;ctenos</a></li></ul></div>';


		if (getDclValue("xProduct"))
			{
			switch (xProductValue)
				{				
				case "Our Business":						
					navContent02 = '<li><a href="'+theBaseUrl+'our_business/cts_bus_es.shtml" class="active">Nuestra empresa</a></li>';
					break;
					
				case "News and Events":						
					navContent03 = '<li><a href="'+theBaseUrl+'news/cts_news_es.shtml" class="active">Noticias y eventos</a></li>';
					break;
					
				case "Products":						
					navContent04 = '<li><a href="'+theBaseUrl+'products/cts_prod_es.shtml" class="active">Productos</a></li>';
					break;
					
				case "Markets Served":						
					navContent05 = '<li><a href="'+theBaseUrl+'markets/cts_markets_es.shtml" class="active">Mercados</a></li>';
					break;
					
				case "Locations":						
					navContent06 = '<li><a href="'+theBaseUrl+'locations/cts_loc_es.shtml" class="active">Localizaci&oacute;n</a></li>';
					break;
					
				case "Contact":
					navContent07 = '<li><a href="https://www.ctscontacts-es.cargill.com/texturizing/emailtrackeres.nsf/ctsemailformExt?OpenForm" class="active">Cont&aacute;ctenos</a></li></ul></div>';
				}
			}

if (currentFileName == "cts_index_es")
	{
	navContent01 = '<li><a href="'+theBaseUrl+'cts_index_es.shtml" class="active">Inicio</a></li>';

	}
document.write(navContent00 + navContent01 + navContent02 + navContent03 + navContent04 + navContent05 + navContent06 + navContent07);