
function loaderXMLXSL() {
	/* public properties */
	this.nameXML 		= '';
	this.nameXSL 		= '';

	/* private properties */
	this._eCont			= null;
	this._eXML 			= null;
	this._eXSL 			= null;
	this._eData			= null;	
	this._XMLCargado	= false;
	this._XSLCargado	= false;
	this._XMLDOM		= null;
	this._XSLDOM		= null;
	}
	
loaderXMLXSL.prototype.create = function(eContent) {
	this._eCont = eContent;
	this._eXML 	= document.createElement('div');
	this._eXSL 	= document.createElement('div');
	this._eData	= document.createElement('div');
	
	this._eXML.style.display = 'block';
	this._eXSL.style.display = 'block';
	this._eData.style.display = 'none';

	this._eXML.innerHTML = "loading ...";
	this._eXSL.innerHTML = "loading . .";
	
	var eImg  = document.createElement('img');
	eImg.src = "js/loading.gif";
	this._eXML.appendChild(eImg);

	var eImg  = document.createElement('img');
	eImg.src = "js/loading.gif";
	this._eXSL.appendChild(eImg);
	
	this._eCont.appendChild(this._eXML);
	this._eCont.appendChild(this._eXSL);
	this._eCont.appendChild(this._eData);	

	return 0;
	}	

loaderXMLXSL.prototype.loadXML = function() {
	var othis = this;
	this._XMLCargado	= false;
	this._XMLDOM = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
	this._XMLDOM.onreadystatechange = function () {
		if (othis._XMLDOM.readyState == 4) {
			othis._XMLCargado = true;
			othis.CheckXML_XSL() ;
			}
		}
		
	this._XMLDOM.async = true;
	this._XMLDOM.load( this.nameXML );
	return 0;
	}

loaderXMLXSL.prototype.loadXSL = function() {
	var othis = this;
	this._XSLCargado = false;
	this._XSLDOM = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");
	this._XSLDOM.onreadystatechange = function () {
		if (othis._XSLDOM.readyState == 4) {
			othis._XSLCargado = true;
			othis.CheckXML_XSL() ;
			}
		}
	this._XSLDOM.async = true;
	this._XSLDOM.load( this.nameXSL );
	return 0;
	}

loaderXMLXSL.prototype.CheckXML_XSL = function() {
	if (this._XSLCargado == true) {	
			this._eXSL.innerHTML = "loaded ...";
			this._eXSL.style.display = 'none';
		}
	if (this._XMLCargado == true) {	
			this._eXML.innerHTML = "loaded . .";
			this._eXML.style.display = 'none';
		}	
	if ((this._XSLCargado == true) && (this._XMLCargado == true)) {
			this.transforms();
		}
	}

loaderXMLXSL.prototype.transforms = function() {
	var strHtml;
	var strResult;
	var XSLStylesheet;
	
	XSLStylesheet = new ActiveXObject("Msxml2.XSLTemplate");
	XSLStylesheet.stylesheet = this._XSLDOM;
	XSLTProcessor = XSLStylesheet.createProcessor();
	XSLTProcessor.input = this._XMLDOM;
	XSLTProcessor.transform();
	strHtml = XSLTProcessor.output;
	strResult = this.replaceAll( strHtml, '&amp;', '&');

	this._eData.innerHTML = strResult;
	this._eXML.style.display = 'none';
	this._eXSL.style.display = 'none';
	this._eData.style.display = 'block';	
	}

loaderXMLXSL.prototype.replaceAll = function replaceAll(str, from, to) {
	var idx = str.indexOf(from);
	while(idx>-1) {
		str = str.replace(from, to);
		idx = str.indexOf(from);
	}
	return str;
	}
