// JavaScript Document

function mostrar_elemento (id) {
	if (document.getElementById || document.all || document.layers) {
		var elem_to_hide = eval('document.getElementById("' + id + '").style');
	}
	
	if (elem_to_hide.display == "none")
		elem_to_hide.display="block";
	else
		elem_to_hide.display="none";
}

function cambiar_imagen (img_id) {
	if (document.getElementById || document.all || document.layers) {
		var img_to_change = eval('document.getElementById("' + img_id + '")');
	}
	if ( (img_to_change.src).indexOf("icon_mas_info.gif")!="-1" ) {
		img_to_change.src="/imagenes/icon_menos_info.gif";
	} else {
		img_to_change.src="/imagenes/icon_mas_info.gif";
	}
}

function bookmarksite(title,url) {
 if (window.sidebar) { // firefox
  window.sidebar.addPanel(title, url, "");
 } else if(window.opera && window.print) { // opera
  var elem = document.createElement('a');
  elem.setAttribute('href',url);
  elem.setAttribute('title',title);
  elem.setAttribute('rel','sidebar');
  elem.click();
  } else if(document.all) { // ie
   window.external.AddFavorite(url, title);
 }
}


function enviar_frm_contacta() {
	error_message = "";
	
	if (document.frm_contacta.Email.value.length==0){
		error_message = "- Email\n" + error_message;
		document.frm_contacta.Email.focus();
		document.frm_contacta.Email.select();
	}

	if (document.frm_contacta.Nombre.value.length==0) {
   	error_message = "- Nombre\n" + error_message;
   	document.frm_contacta.Nombre.focus();
		document.frm_contacta.Nombre.select();
  }

	if (error_message != "") {
		error_message = "Los siguientes campos son obligatorios:\n\n" + error_message;
		window.alert(error_message);
		return;
	}
	
	length_mail = document.frm_contacta.Email.value.length;
	length_mail = length_mail - 1;
	if ( (document.frm_contacta.Email.value.indexOf ('@', 0) < 1) || (document.frm_contacta.Email.value.length < 5) 
		|| (document.frm_contacta.Email.value.lastIndexOf(".") < 2) || (document.frm_contacta.Email.value.charAt(length_mail) == "." ) )
	{ 
   	alert("Escriba una dirección de correo válida en el campo \"E-mail\".");
		document.frm_contacta.Email.focus();
		document.frm_contacta.Email.select();
   	return;
  }
    
	document.frm_contacta.submit();
}