	var xmlhttp;
    var id;

    function CriaObjetoAjax(){
    try
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (e)
        {    
        xmlhttp = false;
        }
    }
    
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined' )
    {
        try
        {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e)
        {
            xmlhttp = false;
        }
    }
    }

    function change()
    {
        if (xmlhttp.readyState==4)
        {
			texto=unescape(xmlhttp.responseText.replace(/\+/g," "));
		    document.getElementById('loading').style.display = 'none';
			document.getElementById(id_mesmo).innerHTML=texto;
			extraiScript(texto);
			if (url_mesmo != 'home.asp'){
			document.location.hash = '#conteudo_geral';
			}
        }
    }


    function abrirPag(url,id){ 
		CriaObjetoAjax();
		if (xmlhttp) {
			id_mesmo = id
			url_mesmo = url			
			xmlhttp.open("GET",url,true);
			xmlhttp.onreadystatechange=change;
			document.getElementById(id_mesmo).innerHTML = '&nbsp;';
		    document.getElementById('loading').style.display = 'block';
			xmlhttp.send(null);	
		}
    }
	
	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);
				/**********************
				
				* Alterado por Micox - micoxjcg@yahoo.com.br
				* Alterei pois com o eval não executava funções.
				
				* Alterado por Everton D. Silva - everton.silva@streamingshop.com.br
				* não estava retornando o valor
				***********************/
				var novo = document.createElement('script');
				novo.type         = 'text/javascript';
				novo.language    = 'javascript';
				novo.text = codigo;
				document.body.appendChild(novo);
			}
		}
	}
	

	function setarSenhaContratantes() {
		campos = "&email="+encodeURI(document.getElementById('email').value);
	}		
	
    function EnviaFormSenhaContratante(url,campos){    
		CriaObjetoAjax();
		id = "conteudo";
		if (xmlhttp) {
			xmlhttp.open("GET",url+campos,true);
			xmlhttp.onreadystatechange=change;
			xmlhttp.send(null);	
		}
    }	


	function setarContratantes() {
		campos = "&usuario="+encodeURI(document.getElementById('nome').value);
		campos += "&senha="+encodeURI(document.getElementById('senha').value);
	}		
	
    function EnviaFormContratante(url,campos){    
		CriaObjetoAjax();
		id = "conteudo";
		if (xmlhttp) {
			xmlhttp.open("GET",url+campos,true);
			xmlhttp.onreadystatechange=change;
			xmlhttp.send(null);	
		}
    }	

	function setarMural() {
		campos = "&nome="+encodeURI(document.getElementById('nome').value);
		campos += "&email="+encodeURI(document.getElementById('email').value);
		campos += "&cidade="+encodeURI(document.getElementById('cidade').value);
		campos += "&uf="+encodeURI(document.getElementById('uf').value);		
		campos += "&mensagem="+encodeURI(document.getElementById('mensagem').value);					
	}		
	
    function EnviaFormMural(url,campos){    
		CriaObjetoAjax();
		id = "Formulario";
		if (xmlhttp) {
			xmlhttp.open("GET",url+campos,true);
			xmlhttp.onreadystatechange=change;
			xmlhttp.send(null);	
		}
    }		
	
	function setarContato() {
		campos = "&nome="+encodeURI(document.getElementById('nome').value);
		campos += "&email="+encodeURI(document.getElementById('email').value);
		campos += "&cidade="+encodeURI(document.getElementById('cidade').value);
		campos += "&uf="+encodeURI(document.getElementById('uf').value);		
		campos += "&ddd="+encodeURI(document.getElementById('ddd').value);	
		campos += "&fone="+encodeURI(document.getElementById('fone').value);	
		campos += "&assunto="+encodeURI(document.getElementById('assunto').value);			
		campos += "&mensagem="+encodeURI(document.getElementById('mensagem').value);					
	}		
	
    function EnviaFormContato(url,campos){    
		CriaObjetoAjax();
		id = "conteudo";
		if (xmlhttp) {
			xmlhttp.open("GET",url+campos,true);
			xmlhttp.onreadystatechange=change;
			xmlhttp.send(null);	
		}
    }			
	
	function setarFa() {
		campos = "&nome="+encodeURI(document.getElementById('nome').value);
		campos += "&email="+encodeURI(document.getElementById('email').value);
		campos += "&endereco="+encodeURI(document.getElementById('endereco').value);		
		campos += "&bairro="+encodeURI(document.getElementById('bairro').value);		
		campos += "&cidade="+encodeURI(document.getElementById('cidade').value);
		campos += "&uf="+encodeURI(document.getElementById('uf').value);		
		campos += "&ddd="+encodeURI(document.getElementById('ddd').value);		
		campos += "&telefone="+encodeURI(document.getElementById('telefone').value);
		campos += "&c="+encodeURI(document.getElementById('c').value);		
		campos += "&nasc="+encodeURI(document.getElementById('nasc').value);		
		campos += "&resp="+encodeURI(document.getElementById('resp').value);
	}		
	
    function EnviaFormFaclube(url,campos){    
		CriaObjetoAjax();
		id = "Formulario";
		if (xmlhttp) {
			xmlhttp.open("GET",url+campos,true);
			xmlhttp.onreadystatechange=change;
			xmlhttp.send(null);	
		}
    }			
