// JavaScript Document
/// Faz o envio da página solicitada na função Geral()
var xmlHttp
function divulgar(page)
{ 
xmlHttp=GetXmlHttpObject();
var url=page;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
//document.getElementById("txtHint").innerHTML="<center><img src='../ajax-loader(5).gif'>";
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
//document.getElementById("txtHint").innerHTML="";
document.getElementById("center1").innerHTML=xmlHttp.responseText;
// até aki, normal, sem mistérios, mas, a função abaixo é o que vai fazer a "mágica"
// Na linha abaixo chamamos a função newTag(), que é a responsável por isso
newTag();
}
}

// A função MAGICA, heheheh

function newTag() 
{    
    // Pegando a div que recebrá o JavaScript
    var conteudo = document.getElementById("teste");
    
    // Declarando a criação de uma nova tag <script>
    var newElement = document.createElement("script");
    
    // Pegando os valores das Tags <script> que estão na página carregada pelo AJAX
    var scripts = document.getElementById("center1").getElementsByTagName("script");
        
    // Aki, vamos inserir o conteúdo da tag <script> que pegamos na linha acima    
        for(i = 0; i < scripts.length; i++)
       {
            newElement.text = scripts[i].innerHTML;
			
			conteudo.appendChild(newElement);
       }
       
       // Agora, inserimos a nova tag <script> dentro da div na página inicial
       
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
function timeCount(image,id) {

var t = setTimeout('changeBgImage("../images/Bg4.gif","cu")',5000);

	

}

function changeBgImage(image , id) {


 document.getElementById(id).style.backgroundImage = 'url('+image+')';
}



function openModal(pUrl, pWidth, pHeight) {
	if (window.showModalDialog) {
		return window.showModalDialog(pUrl, window,
		  "dialogWidth:" + pWidth + "px;dialogHeight:" + pHeight + "px");
	} else {
		try {
			netscape.security.PrivilegeManager.enablePrivilege(
			  "UniversalBrowserWrite");
			window.open(pUrl, "wndModal", "width=" + pWidth
			  + ",height=" + pHeight + ",resizable=no,modal=yes");
			return true;
		}
		catch (e) {
			alert("Script não confiável, não é possível abrir janela modal.");
			return false;
		}
	}
}
