function AgregarFavoritos(Titulo,URL) {
	if (navigator.appName=="Netscape") {
		window.sidebar.addPanel(Titulo,URL,""); 
	}
	if (navigator.appName=="Microsoft Internet Explorer"){
		window.external.AddFavorite(URL,Titulo);
	}
}
function recarga(){
	window.location.href='index.php';
}
function nuevoAjax(){
	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 votarJuego(id){
	ajax=nuevoAjax();
	ajax.open("GET",'/votar.php?id=' + id,true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		document.getElementById('votos_'+id).innerHTML = ajax.responseText;
		document.getElementById('botonvotar_'+id).src = 'images/boton-chachi.gif';
		}
	}
	ajax.send(null)
}
function agregarFavorito(id,session,cambia){
	if(session != ''){
		ajax=nuevoAjax();
		ajax.open("GET",'/agregarfavorito.php?id=' + id,true);
		ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			if(ajax.responseText=='no'){alert('Ya lo tiene en Favoritos');}
			else{
				if(ajax.responseText=='nos'){alert('No esta logueado en la Pagina');}
				else { 
					if(cambia===true) {document.getElementById('favoritos').innerHTML = ajax.responseText; }
				}
			}
		}
		}
		ajax.send(null);
	}else{
		alert('No esta logueado en la Pagina');
	}
}
function quitarFavorito(id){
	ajax=nuevoAjax();
	ajax.open("GET",'/quitarfavorito.php?id=' + id,true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		document.getElementById('favoritos').innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
function suscribirse(boton){
	ajax=nuevoAjax();
	mail = document.getElementById('suscripcion').value;
	ajax.open("GET",'/suscribirse.php?mail=' + mail,true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		boton.style.display='none';
		document.getElementById('suscribite-content').innerHTML = ajax.responseText;
		}
	}
	ajax.send(null)
}
