﻿
//Crio objeto "xmlhttp"
try {
    xmlhttp = new XMLHttpRequest();
}
catch(ex) {
    try{
	    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(ex2) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(ex3){
			xmlhttp = false;
		}
	}
}

//Retorna linhas a partir da categoria
function getLinhaProduto(categoria){		
		
	//Div onde será exibido o resultado
	var linhas = $("#arquivosDownload");
	linhas.html("<ul><li>Carregando...</li></ul>");

    //Executo ASP que retorna lista com categorias
	xmlhttp.open("GET", "/downloadcenter/01sql07/br/downloadcenterfamiliasajax.asp?categoria=" + escape(categoria), true) + "&rdw=" + Math.random();
    
    xmlhttp.onreadystatechange = function() {
        if(xmlhttp.readyState == 4) {
            var resposta = xmlhttp.responseText;            
            linhas.html(resposta);
		}
	}		
	try {
		xmlhttp.send(null);
	}
	catch(e) { 
	    return false; 
    }
}

//Retorno lista de arquivos
function getLista(familiaID){
	
	//Guardo div e exibo carregando
	var resultado = $(".resultado");			
	resultado.html("Carregando...")

    //Executo arquivo asp
	xmlhttp.open("GET", "/downloadcenter/01sql07/br/downloadcenterlistaajax.asp?familiaID=" + escape(familiaID), true) + "&rdw=" + Math.random();
	
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState == 4) {
			var resposta = xmlhttp.responseText;			
			resultado.html(resposta);
		}
	}		
	try {
		xmlhttp.send(null);
	}
	catch(e) {
	    return false; 
    }
}