//Event.observe(window, 'load', init, false);
//$(window).load(init());

dojo.require("dojo.NodeList-fx");
dojo.require("dojo.fx");

function init(){
	
 call_rss('nigrizia', 'nigrizia_box');
 call_rss('afriradio', 'afriradio_box');
 call_rss('bandapm', 'bandapm_box');
 call_rss('giovani_missioni', 'giovani_missioni_box');
 call_rss('museo_africano', 'museo_africano_box');
 call_rss('mondo_aperto', 'mondo_aperto_box');
}

/*
function call_rss(env, elem)
{

new Ajax.Request('rss_parser.php?env='+ env,
  {
    method:'get',
    onSuccess: function(transport){
      var response = transport.responseText || "no response text";
      //alert("Success! \n\n" + response);
      document.getElementById(elem).innerHTML = response;
    },
    onFailure: function(){ alert('Something went wrong...') },
    onLoading: function(){ document.getElementById(elem).innerHTML = "<div id='rssbox' style='text-align:center;'><img src='images/indicators/spinner.gif'><br><br>Loading RSS content</div>"}
  });

}
*/
function call_rss(env, elem){

dojo.xhrGet({
    url : 'rss_parser.php?env='+ env,
    handleAs : "text",
    handle: function(data,args){
			if(typeof data == "error"){
				alert(args);
			}else{
				// show our response 
				document.getElementById(elem).innerHTML = data;
			}
		}});
}

