
    function loadExternal(bufferID, url, idDivToUse, index, showTitle) {
      if ( window.frames[bufferID] ) {
        window.frames[bufferID].location = url;
      } else {
      	document.getElementById(bufferID).src = url;
      }
      
      var divToPopulate = document.getElementById? document.getElementById(idDivToUse): document.all? document.all[idDivToUse]: null;
      if ( divToPopulate && typeof divToPopulate.innerHTML != "undefined" ) {
        unloadDiv(divToUnload, index, 0, '', showTitle);
        divToPopulate.innerHTML = '<div style="color: #990000;">Caricando...</div>';
      }
      return false;
    }
    
    // Callback function
    function displayExternal(idDiv) {
      var loadedDiv = document.getElementById ? 
      					document.getElementById(idDiv) : 
      				document.all ? document.all[idDiv]: null;
      if (window.frames["buffer"]) {
	      if ( loadedDiv && typeof loadedDiv.innerHTML != "undefined" ) {
	        loadedDiv.innerHTML = window.frames["buffer"].document.body.innerHTML;
	      }
      } else {
      	  loadedDiv.innerHTML = document.getElementById("buffer").contentDocument.body.innerHTML;
      }
    }
    
    function unloadDiv(divToUnload, index, n, titlePrefix, showTitle) {
        var loadedDiv = document.getElementById ? 
        					document.getElementById("id"+divToUnload+index) : 
        				document.all ? 
        					document.all["id"+divToUnload+index] : null;
        if ( loadedDiv && typeof loadedDiv.innerHTML != "undefined" ) {
            var bodyhtml = "   " + (showTitle == 'true' ? "<div>"+divToUnload+(titlePrefix != null?" 1":"")+"</div>" : "") + "<select name=\""+(divToUnload+index)+"\" disabled style=\"width: 150px;\"></select>";
            if (n > 1) {
                for (var i=1; i<n; i++) {
                    if (titlePrefix != null) {
                        bodyhtml += "<div>"+titlePrefix+" "+(i+1)+"</div>";
                    }
	                bodyhtml += "<div><select name=\""+(divToUnload+index)+""+i+"\" disabled style=\"width: 150px;\"></select></div>";
                }
            }
            loadedDiv.innerHTML = bodyhtml;
        }
    }
