//Load external file into div (See related posts)
// javascript to go into head of document or external .js file

function ahah(url, target) {
  document.getElementById(target).innerHTML = ' Leyendo...';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
   
  }
  if (req != undefined) {
    req.open("GET", url, true);
	req.send("");
    req.onreadystatechange = function() {ahahDone(url, target);};

  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function carga_nuevo(name, div) {
	ahah(name,div);
	return false;
}

function load(name, div) {
	//ahah(name,div);
	carga_menu(name,div);
	return false;
}

/*function fMenu(nombre){
    document.getElementById('menu').innerHTML = eval("menuL" + nombre);
	return false;
}*/

var gGlobal = this;
function fMenu(nombre){
	temp = "menuL" + nombre;
	if(document.getElementById('menu')){
    document.getElementById('menu').innerHTML = gGlobal[temp];
	}
	return false;
}

// call code with the name of the external file and the id of the div you want to put the content into
//<a href="file1.html" onclick="load('file1.html','content');return false;">File 1</a>
