//Global Variables
var htmlPath = '';
var inSubMenu = false;
var startSubMenus = 7;

// ********  creating dropdown nav  *****************

// Global Vars for nav

// initialize and give default values for dropdown menu color variables
var background = "#FFcc66";
var bgcolor = "#FFcc66";
var border_color = "#FF9933";
var menu_border = "#ffffff";
var hovercolor = "#FFcc66";
var dividercolor = "#FF9933";

// Simple Browser Check
var ie = "Microsoft Internet Explorer";
var netscape = "Netscape";
var mac = "MacPPC"
var browser = navigator.appName;
var os = navigator.platform;

var No3 = (parseInt(navigator.appVersion) > 3) ? 1:0;

if (navigator.userAgent == 'Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)') { 
	No3 = 0; 
}
var layer = (document.getElementById && No3) ? "document.getElementById('L'+menu).style" : (document.all) ? "document.all['L'+menu].style" : (document.layers && No3) ? "document.layers['L'+menu]": 0;
var hideMe = (document.all || document.getElementById) ? "hidden" : "hide";
var showMe = (document.all || document.getElementById) ? "visible" : "show";
var timer;
if (document.layers && No3) {
	document.write('<style>.navdown {color:#000000; font-size:11px; font-family:Arial,sans-serif; font-weight:normal; text-decoration:none; padding-bottom : 3;	padding-top : 3;}</style>');
}
//////////////////////////////////////////////

/*	Create Your layers below by typing:
	 Layer[incrementing number] = new LayerSpecs(Left Position, Top Position, Width, cell background color, cell hover color, cell divider color, List of Links Seperated by Commas)
*/

Layer = new Array();
// Nosotros
Layer[1] = new LayerSpecs(7,111,124,'#018BFF','#9FBFFF','#FF9933',
	'<a href="'+ htmlPath +'custom/somos.asp" class="navdown">&nbsp;&nbsp;Quienes somos</a>',
	'<a href="'+ htmlPath +'custom/mision.asp" class="navdown">&nbsp;&nbsp;Nuestra Misión</a>',
	'<a href="'+ htmlPath +'custom/contacto.asp" class="navdown">&nbsp;&nbsp;Contactos</a>');
// Gestion
Layer[2] = new LayerSpecs(131,111,124,'#018BFF','#9FBFFF','#FF9933',
	'<a href="'+ htmlPath +'custom/gestion.asp" class="navdown">&nbsp;&nbsp;Gestión por Proceso</a>',
	'<a href="'+ htmlPath +'custom/preguntas.asp" class="navdown">&nbsp;&nbsp;Preguntas Frecuentes</a>');
// Servicios
Layer[3] = new LayerSpecs(257,111,124,'#018BFF','#9FBFFF','#FF9933',
	'<a href="'+ htmlPath +'custom/metodologia.asp" class="navdown">&nbsp;&nbsp;Metodología MGP&reg;</a>',
	'<a href="'+ htmlPath +'custom/como.asp" class="navdown">&nbsp;&nbsp;Como aplicamos<br>&nbsp;&nbsp;la Consultoría</a>');

// Extranet
Layer[4] = new LayerSpecs(382,111,124,'#018BFF','#9FBFFF','#FF9933',
	'<a href="'+ htmlPath +'grupomexico" class="navdown">&nbsp;&nbsp;Grupo México</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;TBS Consultores S.C.</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;Infor</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;Secretaría Relaciones<br>&nbsp;&nbsp;Exteriores</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;NCS Pearson</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;F.F. Consultores</a>',
	'<a href="'+ htmlPath +'otros" class="navdown">&nbsp;&nbsp;POPKIN Sample</a>');

// Disponible
Layer[5] = new LayerSpecs(507,111,124,'#018BFF','#9FBFFF','#D9D900',
	'<a href="'+ htmlPath +'../grupomexico" class="navdown">&nbsp;&nbsp;Grupo México</a>',
	'<a href="'+ htmlPath +'../dbnettime" class="navdown">&nbsp;&nbsp;TBS Consultores</a>',
	'<a href="'+ htmlPath +'../popkin" class="navdown">&nbsp;&nbsp;POPKIN Sample</a>');

// Disponible
Layer[6] = new LayerSpecs(526,111,124,'#ffffff','#dddddd','#dddddd',
	'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp</a>');

// Catalogos - CHIPS Transfer		*** NO SE USA ***
Layer[7] = new LayerSpecsSub(500,144,124,'#FFcc66','#ffe4ac','#FF9933',
	'<a href="'+ htmlPath +'consultachips.asp" class="navdown">&nbsp;&nbsp;Universal ID</a>',
	'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Pagina Web CHIPS</a>');

	// Mantenimiento - Datos de Proveedor
	Layer[8] = new LayerSpecsSub(375,112,124,'#00EA3A','#91FFAC','#D9D900',
		'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Datos Generales</a>',
		'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Datos de Fax</a>',
		'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Datos Bancarios (MXN)</a>',
		'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Datos Bancarios (USD)</a>',
		'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Nuevos Proveedores</a>');

		Layer[9] = new LayerSpecsSub(375,184,124,'#FFcc66','#ffe4ac','#FF9933',
			'<a href="'+ htmlPath +'auditproveedorMXN.asp" class="navdown">&nbsp;&nbsp;Datos Bancarios (MXN)</a>',
			'<a href="'+ htmlPath +'auditproveedorUSDmxp.asp" class="navdown">&nbsp;&nbsp;Datos Bancarios (USD)</a>');
Layer[10] = new LayerSpecsSub(500,106,124,'#FFcc66','#ffe4ac','#FF9933',
	'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Preparar Codigorio</a>',
	'<a href="'+ htmlPath +'#" class="navdown">&nbsp;&nbsp;Consulta Codigorio</a>');

/////////////////////////////////////////////////////////

// Loop to create master nav table(ie/nn6) or layer(nn4.x)
for(i=1; i<Layer.length; i++) {
	// imgHilite returns the image name to the mouseover/mouseoff function in rollover.js 
	var imgHilite = rollArray[(i-1)].name;
	if (document.getElementById && No3) { 
		document.write('<div onMouseOver="showOver(\''+imgHilite+'\');clearTimeout(timer)" onMouseOut="showOff(\''+imgHilite+'\');Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; z-index:1000; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" cellpadding="0" cellspacing="0">'+Layer[i].info+'</TABLE></div>'); 
	} else if (document.all && No3) {
		document.write('<SPAN onMouseOver="clearTimeout(timer);" onMouseOut="Hide('+i+')" ID="L'+i+'" STYLE="position:absolute; visibility:hidden; background:'+background+'; top:'+Layer[i].top+'; left:'+Layer[i].left+';"><table border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" onmouseover="showOver(\''+imgHilite+'\');" onmouseout="showOff(\''+imgHilite+'\');">'+Layer[i].info+'</TABLE></SPAN>'); 
	} else if (document.layers && No3) {
		document.write('<LAYER onMouseOver="clearTimeout(timer);showOver(\''+imgHilite+'\');" onMouseOut="Hide('+i+');showOff(\''+imgHilite+'\');" ID="L'+i+'" VISIBILITY="hide" position="absolute" BGCOLOR="#ffffff" TOP="'+Layer[i].top+'" LEFT="'+Layer[i].left+'">'+Layer[i].info+'</LAYER>'); 
	}

}

function Show(menuNumber) {
	if(timer) { 
		clearTimeout(timer); 
	}
	for(menu=0; menu < Layer.length; menu++) {
		if(Layer[menu]) {
			eval(layer).visibility = hideMe; 
		} 
	}
	if (menuNumber > 0){
		var menu = menuNumber;
		eval(layer).visibility = showMe;
	}
}

function ShowSub(menuNumber) {
	if(timer) { 
		clearTimeout(timer); 
	}
	for(menu=startSubMenus; menu < Layer.length; menu++) {
		if(Layer[menu]) {
			eval(layer).visibility = hideMe; 
		} 
	}
	if (menuNumber > 0){
		var menu = menuNumber;
		eval(layer).visibility = showMe;
	}
}

function Hide(menuNumber) { timer = setTimeout("Show(0)", 200); }

function LayerSpecs(Left,Top,Width,bgcolor,hovercolor,dividercolor) { 
	if(No3) {
		this.left = Left;
		this.top = Top;
		this.info  = "";
		
		// initialize layer position for NN4.x
		var T = 0;
				
		// Loop to populate master nav table/layer with content
		for(i=6; i<arguments.length; i++) {
			
			// check for 2 lines of content within layer and offset accordingly
			if( arguments[i].indexOf('<br>&nbsp;') != -1 ){
				var addOffset = 13;
			} else {
				var addOffset = 0;
			}
			
			// calculates table cell height for NN6 & IE
			var cellheight = 17 + addOffset;

			subMenuStart = arguments[i].indexOf('xxxsubmenu');
			subMenuEnd = arguments[i].indexOf('yyy');
			if(subMenuStart == -1) {
				subMenuLayer=0;
			} else {
				subMenuLayer=arguments[i].substring(subMenuStart+10,subMenuEnd);	
			}
			if (document.all){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';ShowSub('+subMenuLayer+');return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'"><span style="line-height:103%;">'+arguments[i]+'</span></TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="'+htmlPath+'/sourcing/image/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.getElementById){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';ShowSub('+subMenuLayer+');return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'">'+arguments[i]+'</TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="'+htmlPath+'/sourcing/image/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.layers){ 
				this.info += '<LAYER position="absolute" bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';ShowSub('+subMenuLayer+');return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;" WIDTH="'+Width+'" TOP="'+T+'"><img src="'+htmlPath+'/corp/image/spacer_orange.gif" width="'+Width+'" height="1" border="0" alt=""><br>'+arguments[i]+'</LAYER><br>'; 
			}
			
		// increment layer position for NN4.x
		T += 17 + addOffset;
		}
	} 
}

function LayerSpecsSub(Left,Top,Width,bgcolor,hovercolor,dividercolor) { 
	if(No3) {
		this.left = Left;
		this.top = Top;
		this.info  = "";
		
		// initialize layer position for NN4.x
		var T = 0;
				
		// Loop to populate master nav table/layer with content
		for(i=6; i<arguments.length; i++) {
			
			// check for 2 lines of content within layer and offset accordingly
			if( arguments[i].indexOf('<br>&nbsp;') != -1 ){
				var addOffset = 13;
			} else {
				var addOffset = 0;
			}
			
			// calculates table cell height for NN6 & IE
			var cellheight = 17 + addOffset;

			if (document.all){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'"><span style="line-height:103%;">'+arguments[i]+'</span></TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="'+htmlPath+'/sourcing/image/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.getElementById){ 
				this.info += '<tr bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;"><TD WIDTH="'+Width+'" height="'+cellheight+'">'+arguments[i]+'</TD></TR><tr><td bgcolor="'+dividercolor+'"><img src="'+htmlPath+'/sourcing/image/spacer.gif" width="'+Width+'" height="1" border="0" alt=""></td></tr>'; 
			} else if (document.layers){ 
				this.info += '<LAYER position="absolute" bgcolor="'+bgcolor+'" onMouseOver="this.bgColor=\''+hovercolor+'\';return true;" onMouseOut="this.bgColor=\''+bgcolor+'\';return true;" WIDTH="'+Width+'" TOP="'+T+'"><img src="'+htmlPath+'/corp/image/spacer_orange.gif" width="'+Width+'" height="1" border="0" alt=""><br>'+arguments[i]+'</LAYER><br>'; 
			}
			
		// increment layer position for NN4.x
		T += 17 + addOffset;
		}
	} 
}

