// http://tutorials.alsacreations.com/modelesmenus/vd1.htm

function montre(id) {
	if (!document.getElementById || !document.createTextNode) {return;} // Check for DOM support
	var d = document.getElementById(id);
		for (var i = 1; i<=10; i++) {
			if (document.getElementById('sub'+i)) {document.getElementById('sub'+i).style.display='none';}
		}
	if (d) {d.style.display='block';}
}

window.onload = function () {
	montre();
	try {
		document.getElementById('sub-productos').onclick = function () { montre('sub1'); return false; }
	}
	catch(err) {}
	document.getElementById('sub-trabajos').onclick = function () { montre('sub2'); return false; }
	if (document.getElementById('sub-cmarse')!=null) {
		document.getElementById('sub-cmarse').onclick = function () { montre('sub3'); return false; }
	}

	try {
		document.getElementById('sub-productos').onfocus = function () { montre('sub1'); return false; }	
	}
	catch(err) {}
	document.getElementById('sub-trabajos').onfocus = function () { montre('sub2'); return false; }
	if (document.getElementById('sub-cmarse')!=null) {
		document.getElementById('sub-cmarse').onfocus = function () { montre('sub3'); return false; }
	}

	var dir=document.URL;
	if(dir.indexOf("productos.php")>0) { montre('sub1'); }
	if(dir.indexOf("trabajos-realizados.php")>0) { montre('sub2'); }
	if((dir.indexOf("calidad.php")>0)
		||(dir.indexOf("medio-ambiente.php")>0)
		||(dir.indexOf("responsabilidad-social-empresarial.php")>0)) {
		montre('sub3');
	}
}