//Require LoadVars.js

function LinkToDIV(targetDIV, url, onloaded, loadingDIV) {
  var mioLV = new LoadVars();
  mioLV.onLoad = function(s)
  {
   if(s)
   {
	if (loadingDIV && (loadingDIV!=targetDIV)) document.getElementById(loadingDIV).innerHTML ='&nbsp;';
	if (targetDIV) document.getElementById(targetDIV).innerHTML =this.getText();
    if (onloaded) { 
      if(typeof(onloaded) === "function")
    	     onloaded();
      else eval(onloaded); 
    }
   }
   else
   {
    alert('Problemi durante il caricamento di '+url);
   }
  }
  if (loadingDIV) document.getElementById(loadingDIV).innerHTML ='<img src="immagini/loading.gif">';
  mioLV.decodeData =false;
  mioLV.load(url);   
}

function CallLink(url) {
  var mioLV = new LoadVars();
  mioLV.onLoad = function(s)
  {
   if(s)
   {
    dummyvar =this.getText();
   }
   else // problemi durante il caricamento dati
   {
   }
  }
  mioLV.decodeData =false;
  mioLV.load(url);   
}


function LinkToDIV_POST(targetDIV, url, parameters, onloaded, loadingDIV) {
  var mioLV = new LoadVars();
  mioLV.onLoad = function(s)
  {
   if(s)
   {
	if (loadingDIV && (loadingDIV!=targetDIV)) document.getElementById(loadingDIV).innerHTML ='&nbsp;';
    if (targetDIV) document.getElementById(targetDIV).innerHTML =this.getText();
    if (onloaded) { 
      if(typeof(onloaded) === "function")
    	     onloaded();
      else eval(onloaded); 
    }
   }
   else
   {
    alert('Problemi durante il caricamento di '+url);
   }
  }
  if (loadingDIV) document.getElementById(loadingDIV).innerHTML ='<img src="immagini/loading.gif">';
  mioLV.decodeData =false;
  mioLV.loadPOST(url, parameters);   
}