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 calcHeight() {
	//find the height of the internal page
	var the_height = document.getElementById('the_iframe').contentWindow.document.body.scrollHeight;
	//change the height of the iframe
	document.getElementById('the_iframe').height = the_height;
}

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

function verifica_tecla(e, f) { //comprobamos la tecla que se presiona en el campo de texto password. Si techa=enter -> form.submit
  var keycode;
  if (window.event)
    keycode = window.event.keyCode;
  else if (e.which)
    keycode = e.which;
  else
    return true;
  if (keycode == 13) {
    document.f.submit();
  }
}

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();
	
}

