


///atualiza/////////

function loadXMLDoc(url,dado,valor,id)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange;
        req.open("GET", url+"?"+dado+"="+valor+id, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange;
            req.open("GET",url+"?"+dado+"="+valor+id, 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="atualiza" e insere o conteudo
            // retornado nela, como texto HTML
            document.getElementById(_div).innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }

}

function atualiza(valor,dado,div,url,id)
{
    _div = div;

    loadXMLDoc(url,dado,valor,id);
}


function loadXMLDoc2(url,dado,valor,id)
{
    req2 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req2 = new XMLHttpRequest();
        req2.onreadystatechange = processReqChange2;
        req2.open("GET", url+"?"+dado+"="+valor+id, true);
        req2.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req2) {
            req2.onreadystatechange = processReqChange2;
            req2.open("GET",url+"?"+dado+"="+valor+id, true);
            req2.send();
        }
    }
}








/////fim atualiza/////////

//portal 

function ativaAbaPortal(aba) {

	for(x=1;x<5;x++) {
		obj = document.getElementById('aba'+x+'on');

		if(aba == x) {
			obj.style.display = "block";
			exibeConteudo(aba);
		} else {
			obj.style.display = "none";		
		}
	}
	for(x=1;x<5;x++) {
		obj = document.getElementById('aba'+x+'off');
		if(aba == x) {
			obj.style.display = "none";	
		} else {
			obj.style.display = "block";
			exibeConteudo(aba);
		}
	}
	
} 

function exibeConteudo(aba) {

	switch(aba) {
		case 1 :
			//interfel
					atualiza('interfel','conteudo','divInterfel','ajaxPortal.php');
					document.getElementById("divInterfel").style.background = "#f4f1ec";
			break;
		case 2 :
			//noticia
					//atualiza('noticias','conteudo','divNoticias','ajaxPortal.php');
			break;
		case 3 :
			//diversao
					atualiza('diversao','conteudo','divDiversao','ajaxPortal.php');
			break;
		case 4 :
			//esportes
					atualiza('esportes','conteudo','divEsportes','ajaxPortal.php');
			break;

	}
	
}

function exibeTodosCanais() {
		obj = document.getElementById('todosOsCanais');
		obj.style.display = 'block';
	}
function ocultaTodosCanais() {
		obj = document.getElementById('todosOsCanais');
		obj.style.display = 'none';
	}
function abreSimulador(valor) {
		//alert(valor);
		//abrePopup('simulador.php','Simulador de Piis','width=500;')
		// window.open('simulador.php?horas='+valor,'Simulador de Piis','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=325,height=300, left=50, top=50');
		
		MM_openBrWindow('simulador.php?horas='+valor,'Simulador','width=325,height=300');
	}
	
	function MM_openBrWindow(theURL,winName,features) { //v2.0
 		 window.open(theURL,winName,features);
	}
function abre_pesquisa(){
	window.open('pesquisa_satisfacao/index.php','page','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=750,height=800');  	
}

function buscar(){
	document.form1.submit();
}
