
/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("Navegacion").getElementsByTagName("li"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}


function SwitchCatalogo(){
	var	obj = getSubcatalogo();
	var el = document.getElementById(obj);
	if(document.getElementById){
		var ar = document.getElementById("Navegacion").getElementsByTagName("li"); 
		for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu")
				ar[i].style.display = "none";
		}
		if (el!=null) {
		el.style.display = "block";	
		}
	}
	
}


function onloadfunction(){
SwitchCatalogo();
}

function getSubcatalogo() {
  var idx = document.URL.indexOf('?');
  var params = new Array();
  var subcatalogo = "";
 
  if (idx != -1) {
    var pairs = document.URL.substring(idx+1,
document.URL.length).split('&');
    for (var i=0; i<pairs.length; i++) {
      nameVal = pairs[i].split('=');
      params[nameVal[0]] = nameVal[1];
    }
  }
  subcatalogo = "sub"+params["subcatalogo"]
  //subcatalogo = "sub" + "<?php echo $subcatalogo; ?>"
  //alert (subcatalogo);
  return subcatalogo;
}


if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

