// mostrar subopciones en el menu lateral
function SwitchMenu(contenedor,obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById(contenedor).getElementsByTagName("span"); // change
		if(el.style.display != "block"){ // change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") // change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}
if (document.getElementById){ // change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
// *****************************
// variables y funciones para abrir las imagenes en popup
var titulopordefecto = "Gr&aacute;fico";
var ventana;
var cont=0;
function afoto(cual,titulo){
if(titulo==null){titulo=titulopordefecto}
ventana=window.open('','ventana','resizable=yes,scrollbars=yes')
ventana.document.write('<html><head><title>' + titulo + '</title></head><body style="overflow:auto; margin:0; padding:0"><img src="' + cual + '" onLoad="opener.redimensionar(this.width, this.height)">');
ventana.document.close();
}
function redimensionar(ancho, alto){
ventana.resizeTo(ancho+30,alto+54);
}
// *********************
function MM_validateForm() { //v4.0
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
			if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
				if (p<1 || p==(val.length-1)) errors+='- '+nm+' debe contener una direccion de e-mail.\n';
			} else if (test!='R') { num = parseFloat(val);
				if (isNaN(val)) errors+='- '+nm+' debe contener un numero.\n';
				if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
					min=test.substring(8,p); max=test.substring(p+1);
					if (num<min || max<num) errors+='- '+nm+' debe contener un numero entre '+min+' y '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' es obligatorio.\n'; }
	} if (errors) alert('Se han encontrado los siguientes errores en el formulario:\n'+errors);
	document.MM_returnValue = (errors == '');
}
