// Luis Torrefranca 02/2006

function xhrRequest(type) {
	var xhrSend;
	if (!type) {
		type = 'text';
	}
	if (window.ActiveXObject) {
		try {
			xhrSend = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xhrSend = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	} else if (window.XMLHttpRequest) {
		xhrSend = new XMLHttpRequest();
		if (xhrSend.overrideMimeType) {
			xhrSend.overrideMimeType('text/' + type);
		}
	}
	return (xhrSend);
}

// Luis Torrefranca 02/2006

function loadMulti() {

	addExt('files/file-with-html.htm', 'html');
	addExt2('files/file-with-image.htm', 'html');
	addExt3('files/file-with-image2.htm', 'html');
}

function addExt1(url,tagName,reqType,ldst,tagLoad) {
	if (!reqType) {
		reqType = "text";
	}
	var xhrRec = xhrRequest(reqType);

        //alert(tagName);

	xhrRec.open('GET', url, true);
	xhrRec.onreadystatechange = function() {

           if(xhrRec.readyState == 1) {
                   document.getElementById(tagName).innerHTML = "<img src=images/loading.gif>";
           }


           if (xhrRec.readyState == 4 && xhrRec.status == 200) {
		document.getElementById(tagName).innerHTML = xhrRec.responseText;
		xhrRec = null;



           } else if (xhrRec.readyState == 4 && xhrRec.status == 404) {
		document.getElementById(tagName).innerHTML = xhrRec.statusText;
		xhrRec = null;
	   }
	};
	xhrRec.send(null);

}

function addExt2(url,tagName,reqType,ldst,tagLoad) {
	if (!reqType) {
		reqType = "text";
	}
	var xhrRec = xhrRequest(reqType);

	xhrRec.open('GET', url, true);
	xhrRec.onreadystatechange = function() {

           if(xhrRec.readyState == 1) {
                   document.getElementById(tagName).innerHTML = "<img src=images/loading.gif>";
           }


           if (xhrRec.readyState == 4 && xhrRec.status == 200) {
		document.getElementById(tagName).innerHTML = xhrRec.responseText;
		xhrRec = null;



           } else if (xhrRec.readyState == 4 && xhrRec.status == 404) {
		document.getElementById(tagName).innerHTML = xhrRec.statusText;
		xhrRec = null;
	   }
	};
	xhrRec.send(null);

}

function addExt3(url,tagName,reqType,ldst,tagLoad) {
	if (!reqType) {
		reqType = "text";
	}
	var xhrRec = xhrRequest(reqType);

	xhrRec.open('GET', url, true);
	xhrRec.onreadystatechange = function() {

           if(xhrRec.readyState == 1) {
                   document.getElementById(tagName).innerHTML = "<img src=images/loading.gif>";
           }


           if (xhrRec.readyState == 4 && xhrRec.status == 200) {
		document.getElementById(tagName).innerHTML = xhrRec.responseText;
		xhrRec = null;



           } else if (xhrRec.readyState == 4 && xhrRec.status == 404) {
		document.getElementById(tagName).innerHTML = xhrRec.statusText;
		xhrRec = null;
	   }
	};
	xhrRec.send(null);

}

