addEvent(window,'load',startEvents,false);
//register the event clic for the three links
function startEvents()
{
//  var ob;
//  for(f=1;f<=5;f++)
//  {
//    ob=document.getElementById('enlace'+f);
//    addEvent(ob,'click',pressLink,false);
//  }
 

//  charge( document.getElementById('enlace1').link );

}
//First detects the browser and deactivates the event by default for the link,
// then calls the function charge giving as reference the url that contains the link
function pressLink(e)
{
  if (window.event)
  {
    window.event.returnValue=false;
    var url=window.event.srcElement.parentNode.getAttribute('link');
    charge(url);
  }
  else
    if (e)
    {
      e.preventDefault();
      var url=e.target.parentNode.getAttribute('link');
      charge(url);
    }
}

function pressLink2(obj)
{
    var url = obj.getAttribute('link');
    charge(url);

}

//Defines the global variable named connection1. the function gets as parameter the url.
//Verifies that the parameter isn’t empty otherwise it leaves with the command return
//The next step is to call the function createXMLHttpRequest which creates and returns an object
//of the class XMLHttpRequest
var connection1;
function charge(url)
{
  if(url=='')
  {
    return;
  }
  connection1=createXMLHttpRequest();
  connection1.onreadystatechange = processEvents;
  connection1.open("GET", url, true);
  connection1.send(null);
}

function processEvents()
{
  var details = document.getElementById("details");
  if(connection1.readyState == 4)
  {
    details.innerHTML = connection1.responseText;
      }
  else
  {
    details.innerHTML = '....';
  }
}


//function addEvent(element,nomevent,func,catching)
//{
//  if (element.attachEvent)
//  {
//    element.attachEvent('on'+nomevent,func);
//    return true;
//  }
//  else
//    if (element.addEventListener)
//    {
//      element.addEventListener(nomevent,func,catching);
//      return true;
//    }
//    else
//      return false;
//}
//


function createXMLHttpRequest()
{
  var xmlHttp=null;
  if (window.ActiveXObject)
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else
    if (window.XMLHttpRequest)
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}

function openWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
