
// Crumb code  --------------------------------------------------------------
/*
*  If the page is in the menu code use the following format:
*  <script>dropCrumbs("Company,Analysis");</script>
*  
*  If the page is outside of the menu code use:
*  <script>dropCrumbs("Site Map:/Help/site.asp");</script>
*
*  where "Site Map" is the link text and "/Help/site.asp" is the url.
*  A second crumb can be added by appending (comma separated) another
*  text/url pair.
*
*/

// separater used
var cSep = " > ";

function dropCrumbs(crumbs){
	
	var crumb = crumbs.split(",");
	
	// write first crumb -----------------
		document.write("<a href='/FORMSolutions/index.htm'>Inicio</a>");
	
	// write second crumb ----------------
		if (crumb[0].indexOf(":") == -1){
			// find link in menu code
			for (var mloop = 0; mloop < mMenu.length; mloop++){
				if (mMenu[mloop] == crumb[0]){
					document.write(cSep + "<a href='" + mMenu[mloop+1] + "'>" + crumb[0] + "</a>");
					
					// set appropriate subMenu
					if(!isNav4){
						showSubMenu(document.getElementById('sMenu' + [mloop/2+1]));	//alert(mloop/2+1);
					}
					break;
				}
			}
		} else {
			// insert passed link
			var mPassed = crumb[0].split(":");
			document.write(cSep + "<a href='" + mPassed[1] + "'>" + mPassed[0] + "</a>");	
		}	
	
	// write third crumb ----------------
		if (crumb[1]){
			if (crumb[1].indexOf(":") == -1){
				// find link in menu code
				if (mloop >= 0){
					//alert(mloop/2);
					var cSub = eval("sMenu" + (mloop/2+1));	//alert(cSub);
		
					for (var sloop = 0; sloop < cSub.length; sloop++){
						//alert(cSub[sloop]);
						if (cSub[sloop] == crumb[1]){
							document.write(cSep + "<a href='" + cSub[sloop+1] + "'>" + crumb[1] + "</a>");
							
							// make subMenu item hilighted
							if(!isNav4){
								var sI = document.getElementById('s' + sloop);
								sI.style.color = subHiliteColor;
								sI.onmouseout = function () {sI.style.color = subHiliteColor;}
							}
						}
					}	
					
				}  
			} else {
				// insert passed link
				var sPassed = crumb[1].split(":");
				document.write(cSep + "<a href='" + sPassed[1] + "'>" + sPassed[0] + "</a>");	
			}
		}
	
	// write fourth crumb ----------------
		if (crumb[2]){
				// insert passed link
				var sPassed = crumb[2].split(":");
				document.write(cSep + "<a href='" + sPassed[1] + "'>" + sPassed[0] + "</a>");	
		}		
}

// end Crumb code  ----------------------------------------------------------



// identify offsite host ----------------------------------------------------

var cDomain		= "";
var domain		= document.domain;
//alert(domain);

if (domain == "cardiff.custhelp.com")
	cDomain = "http://www.informese.com.co";
else
	cDomain = "http://www.informese.com.co";

// end identify offsite host -----------------------------------------------



// globals for menu --------------------------------------------------------

var spaces = "";
for (var j = 0; j < itemSpacing; j++)
	spaces += "&nbsp;";

	
var lead = "";
if (leading == true){
   lead = separator;
   separator = "";
}
// end globals for menu ----------------------------------------------------


function buildMenu(){

	//build mini-menu
	if (mmVisible == true){
		document.write("<div id='miniSpace' align='" + miniMenuAlign + "' style='position:" + posType + "; top:" + eval(topPos - 2) + "; font-weight:" + miniItemWeight + "; font-size:" + miniItemSize + "; cursor:pointer; cursor:hand; font-family:" + itemFont + "; z-index:0;'>&nbsp;&nbsp;test</div>");
		var miniMenuID	= 1;
		var miniMenu	= "&nbsp;&nbsp;";
		for (var h = 0; h < mini.length; h+=2){
			miniMenu += "<span id=\"mini" + miniMenuID + "\" style=\"color:" + miniItemColor + "; line-height:" + miniMenuHeight + "\" onClick=\"location.href='" + mini[h+1] + "'\"	onMouseOver=\"this.style.color='" + miniHiliteColor + "'; window.status='" + mini[h+1] + "';\" onMouseOut=\"this.style.color='" + miniItemColor + "';\">" + lead + mini[h] + "</span>\n\n";
			if (h != mini.length - 2) {
			   	miniMenu +=  spaces + "<span style='font-weight:normal;'>" + miniSeparator + "</span>" + spaces + "\n\n";
			}
			miniMenuID++;		
		}
		if (debug == true)alert("miniMenu:\n\n" + miniMenu);
		document.getElementById('miniSpace').innerHTML = miniMenu;
	}


	//build main menu
	
	var mainMenu = "";
		
	menuSpace = "<div id=\"menuSpace\" align='center' style=\"position:" + posType + "; top:" + topPos + "; left:" + leftPos + "; width:" + menuWidth + "; text-align:" + menuAlign + "; border:" + totalBorder + ";\">\n\n";
	
	mainMenu += "<div id=\"mainMenu\" style=\" color:" + itemColor + ";  background-color:" + menuBGcolor + "; border:" + menuBorder + "; font-weight:" + itemWeight + "; font-size:" + itemSize + "; cursor:pointer; cursor:hand; font-family:" + itemFont + ";\">&nbsp;\n" + spaces + "\n\n";
	

	   
	var subMenuID = 1;
	
	for (var i = 0; i < mMenu.length; i+=2){	
		mainMenu += "<span id=\"sMenu" + subMenuID + "\" style=\"line-height:" + menuHeight + "px\" onClick=\"location.href='" + cDomain + mMenu[i+1] + "';\" onMouseOver=\"showSubMenu(this); this.style.color='" + hiliteColor + "'; window.status='" + mMenu[i+1] + "';\" onMouseOut=\"this.style.color='" + selectedColor + "';\">" + lead + mMenu[i] + "</span>\n\n";
		if (i != mMenu.length - 2) {

		   	mainMenu +=  spaces + separator + spaces + "\n\n";
		}
		subMenuID++;
	}
	
	mainMenu += spaces + "</div>";
	
	
	//build submenu
	subMenu = "<div id=\"subMenu\" style=\"color:" + subItemColor + ";  background-color:" + subMenuBGcolor + "; border:" + subMenuBorder + "; font-weight:" + subItemWeight + "; font-size:" + itemSize + "; text-align:" + subMenuAlign + "; cursor:pointer; cursor:hand; font-family:" + itemFont + ";\">&nbsp;</div>";
	
	document.write(menuSpace);	   if (debug == true) alert("menuSpace div:\n\n" + menuSpace);
	document.write(mainMenu); 	   if (debug == true) alert("mainMenu div:\n\n" + mainMenu);
	document.write(subMenu);  	   if (debug == true) alert("empty subMenu div:\n\n" + subMenu);
	document.write("</div>");
	

}


function showSubMenu(choice){
	
	var sM = document.getElementById('subMenu');
	with (sM.style){
		color			= subItemColor;
		backgroundColor	= subMenuBGcolor;
		border			= subMenuBorder;
		fontWeight		= subItemWeight;
		fontSize		= subItemSize;
		lineHeight		= subMenuHeight;
	}
	
	var cM = document.getElementById(choice.id);
	cM.style.color = hiliteColor ;

	var current = choice.id.substr(choice.id.length - 1,1);
	var menuItems = mMenu.length / 2;
	
	for (var i = 1; i < menuItems + 1; i++){
		if (i != current)
			eval("document.getElementById('sMenu" + i + "').style.color = '" + itemColor + "'");
	}
	
	var subMenu	 = spaces + "\n\n";
	
	if (eval(choice.id + ".length") > 0){
		if (debug == true) alert("submenu id:" + choice.id);
		if (debug == true) alert("items: " + eval(choice.id + ".length")/2);
				
		for (var i = 0; i < eval(choice.id + ".length"); i+=2){
			subMenu	+= "<span id=\"s" + i + "\" href=" + eval(choice.id)[i+1] + " style=\"" +
					   "padding:" + subMenuItemPadding + "px; " +
					   "line-height:" + menuHeight + "px; " +
					   "background-color:" + subMenuItemBGcolor + "; " +
					   "border:" + subMenuItemBorder + "; " +
					   "font-size:" + subItemSize + "\" ";
					   
					   if (eval(choice.id)[i+1].indexOf("http://") == -1)
							subMenu +=	"onClick=\"location.href='" + cDomain + eval(choice.id)[i+1] + "'\" ";
					   else
							subMenu +=	"onClick=\"var popup = window.open('" + eval(choice.id)[i+1] + "','','');\" ";
					   
					   subMenu +=
					   "onMouseOver=\"this.style.color=subHiliteColor; " +
					   		"window.status='" + eval(choice.id)[i+1] + "';\" " +
					   "onMouseOut=\"this.style.color=subItemColor;\">" + 
					   lead + eval(choice.id)[i] + "</span>" + 
					   subMenuOrientation;

			if (i != eval(choice.id + ".length - 2"))
			   	subMenu +=  spaces + separator + spaces + "\n\n";

		}
		sM.style.backgroundColor = subMenuBGcolor;
	} else {
	  	sM.style.backgroundColor = "";
	}
	
	sM.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;" + subMenu;
	
	if (debug == true) alert("loaded subMenu div:\n\n" + subMenu); 
		   
}




// NN4x -------------------------------------------------------------------

if(isNav4)
	onWindowResize = buildMenuNN();

function buildMenuNN(){

	//backdrop color for homepage...
	var spaceWidth = "";
	for (var s = 0; s < 176; s++)
		spaceWidth += "&nbsp;";
	//alert(spaceWidth);
	
	var NNdiv = document.ids.NNdiv;
	with (NNdiv){	
		position		= "absolute";
		top				= 96;
		left			= leftPos;
		backgroundColor = menuBGcolor;
	}
	document.write("<div id='NNdiv'>" + spaceWidth + "</div>");
	// end backdrop color



	mM = document.ids.mainMenu;
	with (mM){
		position 		= "absolute";
		top				= 96;
		left			= leftPos;
		fontFamily		= itemFont;
		fontSize		= 12;			 
		color			= "";itemColor;
		backgroundColor	= menuBGcolor;
		fontWeight		= itemWeight;
	}
	
	var subMenuID = 1;
	var mString   = "<div id='mainMenu' class='mMenu'>&nbsp;";
	
	
	for (var i = 0; i < mMenu.length; i+=2){	
		mString += "<a onMouseOver=\"showSubMenuNN(subMenu,'sMenu" + subMenuID + "')\" href='" + cDomain + mMenu[i+1] + "'><font color='" + itemColor + "'>" + mMenu[i] + "</font></a>";
		if (i != mMenu.length - 2) 
		   	mString += "&nbsp;<font color='" + itemColor + "'>" + separator + "</font>&nbsp;" 
		subMenuID++;
	}	
	mString += "</div><layer id='subMenu' class='sMenu'></layer>";
	
	document.write(mString);
	
}



function showSubMenuNN(subM,theArray) {
    if (document.layers) {
		
		var subMenu = eval(theArray);
		//alert(subMenu);
    
		var text = "&nbsp;";
		
		for (var i = 0; i < subMenu.length; i+=2){
			text += "<a href='" + cDomain + subMenu[i+1] + "'><font size='2' color='" + subItemColor + "'>" + subMenu[i] + "</font></a>";
			
			if (i != subMenu.length - 2){
			   	text +=  spaces + "&nbsp;<font color='" + subItemColor + "'>" + separator + "</font>&nbsp;" + spaces;
			}
		}
    
    	sM = subM;
		with (sM){
			position 		= "absolute";
			top				= 116;
			left			= leftPos;
			width			= menuWidth + 400;
			color			= subItemColor;
			backgroundColor	= subMenuBGcolor;
			border			= subMenuBorder;
			fontWeight		= subItemWeight;
			
		}

        subM.document.open();
        subM.document.write(text);
        subM.document.close();
    }
}


// end NS4x  ----------------------------------------------------------------


// go to menu code ----------------------------------------------------------
//alert(isNav4);
if (isNav4)
	buildMenuNN();
else 
	buildMenu();
//---------------------------------------------------------------------------



// custom popup window and link ---------------------------------------------

function popLink(url){
	var linkCode = '<a onClick="var popup = window.open(\'' + url + '\',\'\',\'scrollbars=yes,toolbar=yes,resizable=yes\');" onMouseOver="this.style.color=linkHover" onMouseOut="this.style.color=link" style="cursor:pointer; cursor:hand;">'
	//alert(linkCode);
	document.write(linkCode);
}

// end identify offsite host -----------------------------------------------



