function displaymenu(id) {
	if(document.getElementById("m"+id).style.display=='block') {
		document.getElementById("m"+id).style.display='none';

	} else {
		document.getElementById("m"+id).style.display= 'block';
}
	for (var i=1; i<7; i++) {
		if(id!=i) {
			document.getElementById("m"+i).style.display = 'none';
		}
	}
	
}

function menin(event) {
	this.style.backgroundColor='#D8F2FC';
	this.style.cursor='pointer';
}

function menout(event) {
	this.style.backgroundColor='#F5F5F5';
	this.style.cursor='auto';
}

function menredir(event) {
	document.location.href = this.firstChild.href;
}

function menu() {
	var z = document.getElementById("admenu").getElementsByTagName("p").length;
	for (var i=1; i<=z; i++ ) {
		document.getElementById('p'+i).onmouseover = menin;
		document.getElementById('p'+i).onmouseout  = menout;
	}
}


function CreateControlFlash(divid, objectid, width, height, url, mode) {
	var d = document.getElementById(divid);
	var strHTML = '<object id="' + objectid + '" type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">';
	strHTML = strHTML + '<param name="movie" value="' + url + '" />';
	if(mode=='1') { strHTML = strHTML + '<param name="wmode" value="transparent" />'; }
	strHTML = strHTML + '<a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;Lang=Spanish&amp;P5_Language=Spanish"><img src="flash/noflash.gif" border="0" alt="no tiene flash" /></a>';
	strHTML = strHTML + '</object>';
	d.innerHTML = strHTML;
}

function CreateControlFlash1(divid, objectid, width, height, url, mode) {
	var d = document.getElementById(divid);
	var strHTML = '<object align="right" id="' + objectid + '" type="application/x-shockwave-flash" data="' + url + '" width="' + width + '" height="' + height + '">';
	strHTML = strHTML + '<param name="movie" value="' + url + '" />';
	if(mode=='1') { strHTML = strHTML + '<param name="wmode" value="transparent" />'; }
	strHTML = strHTML + '<a href="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&amp;Lang=Spanish&amp;P5_Language=Spanish"><img src="flash/noflash.gif" border="0" alt="no tiene flash" /></a>';
	strHTML = strHTML + '</object>';
	d.innerHTML = strHTML;
}


function MailLink (usuario, dominio, tld) {
	 //codifica los caracteres mas significativos
	 var arroba = '@'
	 var punto = '.'
	
	 //utiliza variables para ocultar las palabras clave
	 var etiqueta = 'ma' + '' + 'il'
	 var dospuntos = 'to:'
	 var localizador = usuario
	 localizador = localizador + arroba + dominio;
	 localizador = localizador + punto + tld;
	
	 //escribe en enlace
	 document.write('<a href="' + etiqueta + dospuntos + localizador + '">' + localizador + '</a>');
}

function navigate(dato) {
	document.Negocios.pag.value=dato;
	document.Negocios.submit();
}

function wopen(page,id,wname,wancho,walto) {
	var ancho = wancho;
	var alto = walto;
	var derecha=(screen.width-ancho)/2;
	var parameters="toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top=60";
	var url = page+'?id='+id;
	newwindow = window.open(url,wname,parameters);
	newwindow.focus();
}

function imgopen(page,id,order,wname,wancho,walto) {
	var ancho = wancho;
	var alto = walto;
	var derecha=(screen.width-ancho)/2;
	var parameters="toolbar=0,scrollbars=1,location=0,status=1,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top=60";
	var url = page+'?id='+id+'&order='+order;
	newwindow = window.open(url,wname,parameters);
	newwindow.focus();
}

function MailLink (usuario, dominio, tld) {
	 //codifica los caracteres mas significativos
	 var arroba = '@'
	 var punto = '.'
	
	 //utiliza variables para ocultar las palabras clave
	 var etiqueta = 'ma' + '' + 'il'
	 var dospuntos = 'to:'
	 var localizador = usuario
	 localizador = localizador + arroba + dominio;
	 localizador = localizador + punto + tld;
	
	 //escribe en enlace
	 document.write('<a class="resaltado" href="' + etiqueta + dospuntos + localizador + '">' + localizador + '</a>');
}

function checkforblanks() {
	for (var i = 0; i < arguments.length; i += 2) {
		if (!arguments[i]) {
			alert("El campo " + arguments[i+1] + " es obligatorio.");
			return false;
		}
	}
	return true;
}

function validate() {
	var isFull = checkforblanks(document.getElementById("nombre").value, "[Persona de contacto]",
		document.getElementById("email").value, "[Email]",
		document.getElementById("consulta").value, "[Consulta]");
	if (!isFull) {
		return false;
	}
	var dirmail = document.getElementById("email").value;
	var filter = /^.+@.+\..{2,3}$/;
	if (!filter.test(dirmail)) {
		alert("La dirección de correo electrónico no es correcta.");
		return false;
	}
	if ((document.getElementById("nombre").value!="" && document.getElementById("nombre").value=="") || document.getElementById("nombre").value=="nombre") {
		alert("Debe indicar una persona de contacto.");
		return false;
	}
	if ((document.getElementById("consulta").value!="" && document.getElementById("consulta").value=="") || document.getElementById("consulta").value=="consulta") {
		alert("Debe indicar una consulta.");
		return false;
	}
	if (document.getElementById("email").value!="" && document.getElementById("email").value=="") {
		alert("Debe indicar un correo electrónico de contacto.");
		return false;
	}
}

window.onload = menu;

