function ajax() {
	getNews();
	getCentralNews();
	getGraph();	
}
function getNews(){
	showHideDiv();
		dojo.xhrGet ({
		url: '/loadNews.cedro',
		load: function(data){
			dojo.byId('newsDireito').innerHTML = data;
		},
		error: function(data){
			console.error('Erro: ',data);
		}
	});
	showHideDiv();
}
function getCentralNews(){
		dojo.xhrGet ({
		url: '/opCentralNews.jsp',
		load: function(centralNews){
			dojo.byId('newsCentral').innerHTML = centralNews;
		},
		error: function(centralNews){
			console.error('Erro: ',centralNews);
		}
	});
}
function getGraph(){
	showHideGraph();
		dojo.xhrGet ({
		url: '/loadGraph.cedro',
		load: function(dados){
			dojo.byId('upperGraph').innerHTML = dados;
			dojo.byId('detalhargrafico').innerHTML = '<a href="cedro/../geraGrafico.cedro?quote=IBOV&period=1d">' + 'Gráfico Detalhado IBOV </a>' ;
		},
		error: function(data){
			console.error('Erro: ',dados);
		}
	});
	showHideGraph();
}
function updateGraph(param){
	showHideGraph()   
	dojo.xhrGet ({
	      url: '/loadGraph.cedro'+'?q='+param,
	      load: function(dados){
			dojo.byId('upperGraph').innerHTML = dados;
			dojo.byId('detalhargrafico').innerHTML = '<a href="cedro/../geraGrafico.cedro?quote='+param +'&period=1d">' + 'Gráfico Detalhado ' + param + '</a>' ;
		   },
		   error: function(data){
			console.error('Erro: ',dados);
		   }
	   });
	showHideGraph()
}
function showHideDiv(){
	var div = new String();
	div = document.getElementById("carregando").style.visibility;
	if ((div.toLowerCase() == "hidden")||(div.toLowerCase() == "")) {
		document.getElementById("carregando").style.visibility = "visible";
	}else {
		document.getElementById("carregando").style.visibility = "hidden";
	}
}
function showHideGraph(){
	var divGraph = new String();
	if((document.getElementById("loadGraph") == null)){
		dojo.byId('upperGraph').innerHTML = '<div align="center" id="loadGraph" style="display: block;"><img src="images/ajaxloader.gif" />Carregando...</div>';
		dojo.byId('detalhargrafico').innerHTML = '<div align="center" id="loadLink" style="display: block;"><img src="images/ajaxloader.gif" />Carregando...</div>';
	}
	divGraph = document.getElementById("loadGraph").style.display;
	if ((divGraph.toLowerCase() == "block")) {
		document.getElementById("loadGraph").style.display = "none";
		
	}else if(divGraph.toLowerCase() == "none"){
		document.getElementById("loadGraph").style.display = "block";

	}	
}
