﻿// JavaScript Document
// FUNÇÃO RESPONSÁVEL DE CONECTAR A UMA PAGINA EXTERNA NO NOSSO CASO A BUSCA_NOME.PHP 
// E RETORNAR OS RESULTADOS 

function ajax(url){ 

//alert(nick); 
//alert(dest); 
//alert(msg); 

req = null; 
// Procura por um objeto nativo (Mozilla/Safari) 
if (window.XMLHttpRequest) { 
	req = new XMLHttpRequest(); 
	req.onreadystatechange = processReqChange; 
	req.open("GET",url,true); 
	req.send(null); 
	// Procura por uma versão ActiveX (IE) 
} else if (window.ActiveXObject) { 
	req = new ActiveXObject("Microsoft.XMLHTTP"); 
	if (req) { 
		
		req.onreadystatechange = processReqChange; 
		req.open("GET",url,true); 
		
		req.send(); 
	} 
} 
}

function processReqChange(){ 

// apenas quando o estado for "completado" 
if (req.readyState == 4) { 

// apenas se o servidor retornar "OK" 
if (req.status == 200) {

// procura pela div id="pagina" e insere o conteudo 
// retornado nela, como texto HTML 

document.getElementById('pagina').innerHTML = req.responseText; 

} else { 
alert("Houve um problema ao obter os dados:n" + req.statusText); 
} 
} 
}

<!-- 
	var Player;
	var PlayStates = {
	   0: "No definido", // Windows Media Player is in an undefined state.
	   1: "Parado", // Playback of the current media item is stopped.
	   2: "Pausado", // Playback of the current media item is paused. When a media item is paused, resuming playback begins from the same location.
	   3: "Ao vivo", // The current media item is playing.
	   4: "ScanForward", // The current media item is fast forwarding.
	   5: "ScanReverse", // The current media item is fast rewinding.
	   6: "Aguarde... carregando...", // The current media item is getting additional data from the server.
	   7: "Aguarde um instante", // Connection is established, but the server is not sending data. Waiting for session to begin.
	   8: "MediaEnded", // Media item has completed playback.
	   9: "Conectando ao Servidor...", // Preparing new media item.
	  10: "Pronto para comear", // Ready to begin playing.
	  11: "Reconnecting" // Reconnecting to stream.
	};
	
	function handler(type) {
		var a = arguments; 
		var title = PlayStates[a[1]];
		document.getElementById("aviso").innerHTML = title; 
	};
	function VolumeUp (){ 
		X = Player.settings.volume; 
		Player.settings.volume = X + 20;      
	}
	function VolumeDown (){ 
		X = Player.settings.volume; 
		Player.settings.volume = X - 20; 
	} 
	function Stop (){ 
		X = Player.settings.volume; 
		Player.settings.volume = X - 100; 
	} 
	function Play (){ 
		X = Player.settings.volume; 
		Player.settings.volume = X + 100; 
	} 
		 
-->
