var a=String.fromCharCode(225); 
var e=String.fromCharCode(233); 
var i=String.fromCharCode(237); 
var o=String.fromCharCode(243); 
var u=String.fromCharCode(250);
var n=String.fromCharCode(241);
var N=String.fromCharCode(209);
var intro=String.fromCharCode(10);

function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function Anadir(uid, pass){

	pagina = location.href.replace("&", "_AMP_");
	datos = "/virtual/anadirafavoritos.php?userid=" + uid + "&url=" + pagina + "&nombre=" + document.title + "&pass=" + pass;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) 
		{
			if (ajax.responseText == 'ok')
				alert("P" + a + "gina a" + n + "adida con " + e + "xito");
			else
				alert(ajax.responseText);
		}
	}
	
	ajax.send(null)
}

function AnadirContacto(uid, pass, uidcontacto){

	datos = "/virtual/anadiracontactos.php?userid=" + uid + "&uidcontacto=" + uidcontacto + "&pass=" + pass;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) 
		{
			if (ajax.responseText == 'ok')
				alert("Contacto a" + n + "adido con " + e + "xito");
			else
				alert(ajax.responseText);
		}
	}
	
	ajax.send(null)
}

function PreguntaPresencial(sesion){

	texto = document.getElementById('texto').value;

	datos = "/virtual/preguntapresencial.php?sesion=" + sesion + "&texto=" + texto;
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) 
		{
			if (ajax.responseText == 'ok')
				alert("Pregunta formulada con " + e + "xito");
			else
				alert(ajax.responseText);
		}
	}
	
	ajax.send(null)
}

