var req;
var req2;
var req5;
var req3;
var con_fun = 0;


function Atualiza_div01(valor) 
{
    loadXMLDoc_01("nin_div01.php",valor);
}

function loadXMLDoc_01(url,valor)
{
    req3 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req3 = new XMLHttpRequest();
        req3.onreadystatechange = processReqChange_01;
        req3.open("GET", url+'?id_div01='+valor, true);
        req3.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req3 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req3) {
            req3.onreadystatechange = processReqChange_01;
            req3.open("GET", url+'?id_div01='+valor, true);
            req3.send();
        }
    }
}

function processReqChange_01()
{
    if (req3.readyState == 4) {
        if (req3.status == 200) {
            document.getElementById('div_div01').innerHTML = req3.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req3.statusText);
        }
    }
}

function Atualiza_div_clientes(valor) 
{
    loadXMLDoc_div_clientes("nin_clientes.php",valor);
}

function loadXMLDoc_div_clientes(url,valor)
{
    req = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange_div_clientes;
        req.open("GET", url+'?id_setor='+valor, true);
        req.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            req.onreadystatechange = processReqChange_div_clientes;
            req.open("GET", url+'?id_setor='+valor, true);
            req.send();
        }
    }
}

function processReqChange_div_clientes()
{
    if (req.readyState == 4) {
        if (req.status == 200) {
            document.getElementById('lista_clientes').innerHTML = req.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req.statusText);
        }
    }
}



function Atualiza_div_info_cliente(valor) 
{
    loadXMLDoc_div_clientes("nin_infocliente.php",valor);
}

function loadXMLDoc_div_info_cliente(url,valor)
{
    req2 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
    if (window.XMLHttpRequest) {
        req2 = new XMLHttpRequest();
        req2.onreadystatechange = processReqChange_div_info_cliente;
        req2.open("GET", url+'?id_cli='+valor, true);
        req2.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req2 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req2) {
            req2.onreadystatechange = processReqChange_div_info_cliente;
            req2.open("GET", url+'?id_cli='+valor, true);
            req2.send();
        }
    }
}

function processReqChange_div_info_cliente()
{
    if (req2.readyState == 4) {
        if (req2.status == 200) {
            document.getElementById('info_cliente').innerHTML = req2.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req2.statusText);
        }
    }
}




function Form_req_ftfispq(valor) 
{
    loadXMLDoc_div_clientes("pag_internas/form_req_ftfispq.php",valor);
}

function loadXMLDoc_Form_req_ftfispq(url,valor)
{
    req5 = null;
    // Procura por um objeto nativo (Mozilla/Safari)
	alert("passa aqui");
    if (window.XMLHttpRequest) {
        req5 = new XMLHttpRequest();
        req5.onreadystatechange = processReqChange_Form_req_ftfispq;
        req5.open("GET", url+valor, true);
        req5.send(null);
    // Procura por uma versao ActiveX (IE)
    } else if (window.ActiveXObject) {
        req5 = new ActiveXObject("Microsoft.XMLHTTP");
        if (req5) {
            req5.onreadystatechange = processReqChange_Form_req_ftfispq;
            req5.open("GET", url+valor, true);
            req5.send();
        }
    }
}

function processReqChange_Form_req_ftfispq()
{
    if (req5.readyState == 4) {
        if (req5.status == 200) {
            document.getElementById('div_form_req_ftfispq').innerHTML = req5.responseText;
        } else {
            alert("Houve um problema ao obter os dados:\n" + req5.statusText);
        }
    }
}








var winhandle = null;
function popUp(aURL, aWidth, aHeight) 
{  
	if ((winhandle != null) && (! winhandle.closed))
	{    
		winhandle.resizeTo(aWidth, aHeight);    
		winhandle.location.replace(aURL);  
	}  
	else  
	{
    	winhandle=window.open(aURL, "imagewin", 'width=' + eval(aWidth) + ',height=' + eval(aHeight) + ',scrolling="no"');
	}
	winhandle.focus();
}



var winhandle2 = null;
function popUp2(aURL, aWidth, aHeight) 
{  
	if ((winhandle2 != null) && (! winhandle2.closed))
	{    
		winhandle2.resizeTo(aWidth, aHeight);    
		winhandle2.location.replace(aURL);  
	}  
	else  
	{
    	winhandle2=window.open(aURL, "imagewin", 'width=' + eval(aWidth) + ',height=' + eval(aHeight) + ',scrolling="auto"');
	}
	winhandle2.focus();
}
