// JavaScript Document

function loadData(URL,funcion)
{
// Create the XML request 
    xmlReq = null;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		xmlReq = new XMLHttpRequest();
		if (xmlReq.overrideMimeType) {
			xmlReq.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			xmlReq = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!xmlReq) {
		alert('Cannot create XMLHTTP instance');
		return false;
	}

// Anonymous function to handle changed request states
    xmlReq.onreadystatechange = function()
    {
        switch(xmlReq.readyState)
        {
        case 0: // Uninitialized
            break;
        case 1: // Loading
            break;
        case 2: // Loaded
            break;
        case 3: // Interactive
            break;
        case 4: // Done!
        // Retrieve the data between the <quote> tags
			//alert(xmlReq.status);
	        if (xmlReq.status == 200) {
				if (funcion!=null)
					funcion(xmlReq.responseXML.getElementsByTagName('root')[0].firstChild.data);
			} else {
				alert('There was a problem with the request.');
			}
            break;
        default:
            break;
        }
    }

// Make the request
//	alert(URL);
    xmlReq.open ('GET', URL, true);
    xmlReq.send (null);
}


