function openAjax() {
	
	var ajax;
	
	try{
		ajax = new XMLHttpRequest(); //XMLHttpRequest para browsers decentes, como: Firefox, Safari, dentre outros.
	}catch(ee){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP"); // Para o IE da MS
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHTTP"); // Para o IE da MS
			}catch(E){
				ajax = false;
			}
		}
	}
	return ajax;
}

function destaques2(){
        $.ajax({
            type: "GET",
            url: "destaque.php",
            dataType: "html",
            beforeSend: function() {
                $('#apresenta').hide();
                $('#loading').fadeIn();
            },
            success: function(html){
                $('#loading').hide();
                $('#apresenta').html(html).fadeIn();
            },
            error: function(){
                alert('Ocorreu um erro durante o processamento.');
            }
        });
}

function destaques() {
	url = "destaque.php";
	var exibeResultado = document.getElementById('apresenta');
		var ajax = openAjax(); // Inicia o Ajax.
		ajax.open("GET", url, true);
		ajax.onreadystatechange = function(){
			if(ajax.readyState == 1) {
				exibeResultado.innerHTML = "";//"&nbsp;Carregando...";
			}
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					exibeResultado.innerHTML = ajax.responseText;
				} else {
					exibeResultado.innerHTML = "";
					alert("Erro:\n" + ajax.statusText);
				}
			}
		}
		ajax.send(null); //submete
}
