 //controla a fila de carregamento das solicitações
//Tenta criar o objeto xmlHTTP
try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

//Fila de conexões
fila=[]
ifila=0

//Carrega via XMLHTTP a url recebida e coloca seu valor
//no objeto com o id recebido

function ajaxHTMLOff(id,url){//sem o carregando
    //Carregando...
    //document.getElementById(id).innerHTML="<table width='90%' border='0' align='center' cellpadding='0' cellspacing='0'> <tr> <td><img src='images/time.gif' width='13' height='22' /></td></tr></table>"
    //Adiciona à fila
    fila[fila.length]=[id,url]
    //Se não há conexões pendentes, executa
    if((ifila+1)==fila.length)ajaxRun()
}
function ajaxHTMLtxt(id,url){//sem o carregando
    //Carregando...
   document.getElementById(id).innerHTML="carregando..."
    //Adiciona à fila
    fila[fila.length]=[id,url]
    //Se não há conexões pendentes, executa
    if((ifila+1)==fila.length)ajaxRun()
}



function ajaxHTML(id,url){//sem o carregando
    //Carregando...
    document.getElementById(id).innerHTML="<div style='height:300px' align=center><br><br><img src='images/load.gif'  /></div>"
    //Adiciona à fila
    fila[fila.length]=[id,url]
    //Se não há conexões pendentes, executa
    if((ifila+1)==fila.length)ajaxRun()
}

//Executa a próxima conexão da fila
function ajaxRun(){
    //Abre a conexão
    xmlhttp.open("GET",fila[ifila][1],true);
    //Função para tratamento do retorno
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            //Mostra o HTML recebido
            retorno=unescape(xmlhttp.responseText.replace(/\+/g," "))
            document.getElementById(fila[ifila][0]).innerHTML=retorno
            //Roda o próximo
            ifila++
            if(ifila<fila.length)setTimeout("ajaxRun()",20)
        }
    }
    //Executa
    xmlhttp.send(null)
}


function carregaImagem(id,imagem){
	var imagem,id;
			
			ajaxHTMLtxt(id,'pop.php?secao=imagem&imagem='+imagem);		
	
		
}

// Browser safe opacity handling function

function setOpacity( value ) {
 document.getElementById("styled_popup").style.opacity = value / 10;
 document.getElementById("styled_popup").style.filter = 'alpha(opacity=' + value * 10 + ')';
}

function fadeInMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ )
   setTimeout( 'setOpacity(' + (i / 10) + ')' , 8 * i );
}

function fadeOutMyPopup() {
 for( var i = 0 ; i <= 100 ; i++ ) {
   setTimeout( 'setOpacity(' + (10 - i / 10) + ')' , 8 * i );
 }

 setTimeout('closeMyPopup()', 800 );
}

function closeMyPopup() {
 document.getElementById("styled_popup").style.display = "none";
}

function fireMyPopup() {
 setOpacity( 0 );
 document.getElementById("styled_popup").style.display = "block";
 fadeInMyPopup();
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function NovaSenha(){
	MM_openBrWindow('extra.php?secao=novasenha','','status=yes,width=500,height=400');
	
	}
	
function fadeOut(id, time) {
	target = document.getElementById(id);
	alpha = 80;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha <= 0){
					clearInterval(i);
					target.style.visibility = 'hidden';
				}
				setAlpha(target, alpha);
				alpha -= 2;
			}, timer);
}

function fadeIn(id, time) {
	target = document.getElementById(id);
	alpha = 0;
	timer = (time*1000)/50;
	var i = setInterval(
			function() {
				if (alpha >= 100)
					clearInterval(i);
				setAlpha(target, alpha);
				alpha += 2;
			}, timer);
}

function setAlpha(target, alpha) {
	target.style.filter = "alpha(opacity="+ alpha +")";
	target.style.opacity = alpha/100;
}
function linkBanner(url,target){
	document.getElementById("url_banner").value = url;
	document.getElementById("target_banner").value = target;
		
	
}
function abreJanela(){
	 if(document.getElementById("target_banner").value=='_blank'){
	 MM_openBrWindow(document.getElementById("url_banner").value,'','');
	 }else{
		window.location=document.getElementById("url_banner").value;
		 }
	
	
	}

