function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}

window.addEvent('domready', function(){
	
		$('Boton1').addEvent('click', function(evento){   
      var nuevoRequest = new Request({
         method: 'get', 
         url: 'descargas.php',
         onRequest: function(){document.getElementById("main").innerHTML="<p align=\"center\"><img src=\"images/loaderA64.gif\" alt=\"Loading\" width=\"64\" height=\"64\" /><p align=\"center\" class=\"mensaje\">Cargando Contenido...</p></p><div id=\"logo_der\"></div>";},
         onSuccess: function(texto, xmlrespuesta){ $('main').set('html',texto);},
         onFailure: function(){alert('Error Al Cargar El Contenido!');}
      }).send();
      
   });	
		
	  $('Boton2').addEvent('click', function(evento){   
      var nuevoRequest = new Request({
         method: 'get', 
         url: 'comments.php',
         onRequest: function(){document.getElementById("main").innerHTML="<p align=\"center\"><img src=\"images/loaderA64.gif\" alt=\"Loading\" width=\"64\" height=\"64\" /><p align=\"center\" class=\"mensaje\">Cargando Contenido...</p></p><div id=\"logo_der\"></div>";},
         onSuccess: function(texto, xmlrespuesta){ $('main').set('html',texto);},
         onFailure: function(){alert('Error Al Cargar El Contenido!');}
      }).send();
      
   });	
		
		
		$('Boton4').addEvent('click', function(evento){   
      var nuevoRequest = new Request({
         method: 'get', 
         url: 'rss.php',
         onRequest: function(){document.getElementById("main").innerHTML="<p align=\"center\"><img src=\"images/loaderA64.gif\" alt=\"Loading\" width=\"64\" height=\"64\" /><p align=\"center\" class=\"mensaje\">Cargando Contenido...</p></p><div id=\"logo_der\"></div>";},
         onSuccess: function(texto, xmlrespuesta){ $('main').set('html',texto);},
         onFailure: function(){alert('Error Al Cargar El Contenido!');}
      }).send();
      
   });	
		
		
		$('Boton5').addEvent('click', function(evento){   
      var nuevoRequest = new Request({
         method: 'get', 
         url: 'contacto.php',
         onRequest: function(){document.getElementById("main").innerHTML="<p align=\"center\"><img src=\"images/loaderA64.gif\" alt=\"Loading\" width=\"64\" height=\"64\" /><p align=\"center\" class=\"mensaje\">Cargando Contenido...</p></p><div id=\"logo_der\"></div>";},
         onSuccess: function(texto, xmlrespuesta){ $('main').set('html',texto);},
         onFailure: function(){alert('Error Al Cargar El Contenido!');}
      }).send();
      
   });	
		
});

function comment(form1)
{
	var divMensaje = document.getElementById("carga_comentarios");
	var DivError = document.getElementById("error_c");
	
	if(form1.nick.value.length < 1)
	{
		document.getElementById("error_c").innerHTML="Wey, se te olvida decir quien eres!";
		form1.nick.focus();
		return false;
	}
	if(form1.comen.value.length < 10)
	{
		DivError.innerHTML="Wey la idea es poner algo interesante!";
		form1.comen.focus();
		return false;
	}

		var ajax=nuevoAjax();
		ajax.open("POST", "c_comments.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("Nick="+document.getElementById("nick").value+"&Comentario="+document.getElementById("comen").value+"&Email="+document.getElementById("email").value);

		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==4)
			{
				// Muestro el mensaje enviado desde el servidor
				divMensaje.innerHTML=ajax.responseText;
			}
		}
		document.getElementById("comen").value = "";
		form1.comen.focus();
	
}

function mail(email)
{
	if(document.getElementById("nick_e").value.length < 1)
	{
		document.getElementById("error_m-n").innerHTML="Wey, se te olvida decir quien eres!";
		email.nick.focus();
		return false;
	}
	if(document.getElementById("texto").value.length < 10)
	{
		document.getElementById("error_m-m").innerHTML="Wey la idea es poner algo interesante!";
		email.texto.focus();
		return false;
	}

		var ajax=nuevoAjax();
		ajax.open("POST", "mail_p.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("Nick="+document.getElementById("nick_e").value+"&Ciudad="+document.getElementById("ciudad").value+"&Email="+document.getElementById("email").value+"&Texto="+document.getElementById("texto").value);

		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==4)
			{
				// Muestro el mensaje enviado desde el servidor
				document.getElementById("email_dic").innerHTML=ajax.responseText;
			}
		}	
}