
// AJAX
function getContent(page, params, elementid, waitmsg, waitico) {
var xmlhttp=false;

if(waitico=="") {waitico="wait.gif"};


try {
    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); 
    } catch (e) {
    try {
         xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); 
    } catch (E) {
         xmlhttp = false;
    }
 }
 if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
     xmlhttp = new XMLHttpRequest();
 }


var file = page+params;


xmlhttp.open('GET', file, true);    

xmlhttp.onreadystatechange=function() {
if(xmlhttp.readyState == 1){
 
// waiting image and message while content loads.
document.getElementById(elementid).innerHTML = "<p align='center'><img src='images/"+waitico+"'><br />"+waitmsg+ "</p>" ;

   //Check if it is ready to recieve data 
   }else if(xmlhttp.readyState==4) { 
   //Make sure there is something in the content variable
   var content = xmlhttp.responseText;

      //The content data which has been retrieved
      if( content ){   
      //Change the inner content of your div to the newly retrieved content
      document.getElementById(elementid).innerHTML = content;   
      }
   }
}

xmlhttp.send(null)
return;
}


function readNews(idNews) {
	
	var params = "?id="+idNews;
	getContent('newsread.asp', params, 'NewsContent', 'Loading news...','wait_blue.gif');

	}

function news(s) {
	
	var params = "?s="+s;
	getContent('ajaxNews.asp', params, 'news', 'Caricamento news...','');

	}

