try{
    xmlhttp = new XMLHttpRequest();// Mozilla, Safari, Firefox, etc...
    try {
        if (xmlhttp.overrideMimeType) {
            //Se possível, ignora cabecalho usado pelo servidor e forca o padrao "text/xml". Alguns navegadores exigem esse padrao e pode dar erro se o servidor nao utilizar ele
            xmlhttp.overrideMimeType('text/xml');
        }
    } catch (e1) { }
}catch(e2){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");// Internet Explorer
    }catch(e3){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");// Internet Explorer
        }catch(e4){
            //tratamento para alguma outra forma de implementar XMLHTTP
            xmlhttp = false;
        }
    }
}
if (!xmlhttp){
    //Nao conseguiu instanciar o objeto xmlhttp para fazer as solicitacoes
    alert("Erro no AJAX. Seu navegador não dá suporte ao AJAX. Recomendamos usar o Internet Explorer para Windows");
}

/////////////////////////////////////////////////////////////
//	Função Automatiza AJAX
////////////////////////////////////////////////////////////
function getxmlhttp(){
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 processajax (obj, serverPage){
	
	xmlhttp = getxmlhttp();
	xmlhttp.open("GET", serverPage);
	xmlhttp.setRequestHeader("If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT");
	xmlhttp.setRequestHeader("Cache-Control", "no-cache");
	xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			   // coloca o valor no objeto requisitado
            texto=unescape(xmlhttp.responseText.replace(/\+/g," "));
            document.getElementById(obj).innerHTML=texto;
            // executa scripts
            extraiScript(texto);

			document.getElementById(obj).innerHTML = xmlhttp.responseText;
			
		}
	}
	xmlhttp.send(null);
}

function pega_musica(){
	document.getElementById("song_01_01").innerHTML = document.getElementById("song_01").value;
}

///////////////////////////////////
function extraiScript(texto){
//Maravilhosa função feita pelo SkyWalker.TO do imasters/forum
//http://forum.imasters.com.br/index.php?showtopic=165277
    // inicializa o inicio ><
    var ini = 0;
    // loop enquanto achar um script
    while (ini!=-1){
        // procura uma tag de script
        ini = texto.indexOf('<script', ini);
        // se encontrar
        if (ini >=0){
            // define o inicio para depois do fechamento dessa tag
            ini = texto.indexOf('>', ini) + 1;
            // procura o final do script
            var fim = texto.indexOf('</script>', ini);
            // extrai apenas o script
            codigo = texto.substring(ini,fim);
            // executa o script
            //eval(codigo);
            /**********************
            * Alterado por Micox - micoxjcg@yahoo.com.br
            * Alterei pois com o eval não executava funções.
            ***********************/
            novo = document.createElement("script")
            novo.text = codigo;
            document.body.appendChild(novo);
        }
    }
}
///////////////////////////////////////////////
