var xmlHttp = false; // XMLHttpRequest Object

try {
    xmlHttp= new XMLHttpRequest();
} catch(ee) {
    try {
        xmlHttp= new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlHttp= new ActiveXObject("Microsoft.XMLHTTP");
        } catch(E) {
            xmlHttp= false;
        }
    }
}

function loadRss(url,idDiv){
	document.getElementById("status").innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Aguarde atualizando RSS...";
	document.getElementById("status").style.backgroundImage  = "url(../images/indicator.white.gif)";
	document.getElementById("status").style.backgroundRepeat = "no-repeat";
	xmlHttp.open("GET", "loadRss.php?url="+url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4){
		     document.getElementById("status").innerHTML  = "";
		     document.getElementById("status").style.backgroundImage = "";
		     document.getElementById(idDiv).innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.send(url);
}

function loadRssCollection(){ // carrega os feeds na pagina
  window.setInterval("updateFeed01()",11000); 
  window.setInterval("updateFeed02()",12000); 
  window.setInterval("updateFeed03()",13000); 
}

function showFeed(url,div){
var Url = url;
var Div = div;
    loadRss(Url,Div);
}

function hideRss(div){
var Div = div;
document.getElementById(Div).innerHTML = "";
}

function updateFeed01(){
  showFeed('http://rss.terra.com.br/0,,EI4795,00.xml','news01');
}

function updateFeed02(){
  showFeed('http://info.abril.com.br/aberto/infonews/rssnews.xml','news02');
}

function updateFeed03(){
  showFeed('http://webinsider.uol.com.br/index.php/feed/rss2','news03');
}

window.setInterval("updateFeed01()",1200000); // update the data every 20 mins
window.setInterval("updateFeed02()",1300000); // update the data every 20 mins
window.setInterval("updateFeed03()",1400000); // update the data every 20 mins




