var _xmlDoc;
function loadText(URL, page_lang, tag)
{

// Create the XML request  
	xmlReq = null;
	if(window.XMLHttpRequest) 		xmlReq = new XMLHttpRequest();
	else if(window.ActiveXObject) 	xmlReq = new ActiveXObject("Microsoft.XMLHTTP");
	if(xmlReq==null) return; // Failed to create the request
// 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
		
		  var tlabel0 = new Array();
			var tlabel1 = new Array();
			var xmlTagSet = xmlReq.responseXML.getElementsByTagName(page_lang);
			_xmlDoc=xmlReq.responseXML;
			
			//alert(page_lang);
// need to find a smarter way to go through these  (collection!)
            for( i = 0; i < xmlTagSet.length; i++ ) {
                for( j = 0; j < tag.length; j++ ) {
                    var crtag = tag[j];
                    try {
                        if( xmlTagSet[i].attributes.getNamedItem("phr").value == crtag ) {
                            tlabel1.push(xmlTagSet[i].firstChild.data);
                            tlabel0.push(crtag);
                            // we are done  then write the text into the page.
                            //if( tlabel0.length == tag.length ) writeInText(tlabel0, tlabel1);
                        }
                    } catch( e ) {
                        // Do Nothing
                    }
                }
                //writeInText(tlabel0, tlabel1);
            }
			writeInText(tlabel0,tlabel1);	
            onTextComplete(xmlReq, page_lang);
			/* XLATE();*/
			break;
		default:
			break;
		}
	}
// Make the request
	xmlReq.open ('GET', URL, true);
	xmlReq.send (null);
}

function onTextComplete()
{
}