// JavaScript Document
function encode(txt){
	txt = txt.replace(/&/g,"%26");
	return txt;
}
var globalurl;
var globalelem;
var the_timeout;
function loadXMLDoc(url,elem) {
	globalurl=url;
	globalelem=elem;
	clearTimeout(the_timeout);
	the_timeout=setTimeout("loadXMLDocx(globalurl,globalelem)",1000);
}
function loadXMLDocx(url,elem) {
	elementid = elem;

	getObject(elementid).innerHTML = '<font color="Red">Se incarca..</font>'
	// Internet Explorer
	try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(oc) { req = null; }
	}

	// Mozilla/Safari
	if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }

	// Call the processChange() function when the page has loaded
	if (req != null) {
		req.onreadystatechange = processChange;
		req.open("GET", url, true);
		req.send(null);
	}
}
function loadXMLDocy(urly,elemy) {
	elementidy = elemy;
	// Internet Explorer
	try { reqy = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { reqy = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(oc) { reqy = null; }
	}

	// Mozilla/Safari
	if (!reqy && typeof XMLHttpRequest != "undefined") { reqy = new XMLHttpRequest(); }

	// Call the processChange() function when the page has loaded
	if (reqy != null) {
		reqy.onreadystatechange = processChangey;
		reqy.open("GET", urly, true);
		reqy.send(null);
	}
}
function loadXMLDocz(urlz,elemz) {
	elementidz = elemz;
	// Internet Explorer
	try { reqz = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { reqz = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(oc) { reqz = null; }
	}

	// Mozilla/Safari
	if (!reqz && typeof XMLHttpRequest != "undefined") { reqz = new XMLHttpRequest(); }

	// Call the processChange() function when the page has loaded
	if (reqz != null) {
		reqz.onreadystatechange = processChangez;
		reqz.open("GET", urlz, true);
		reqz.send(null);
	}
}
function loadXMLDocm(urlm,elemm) {
	elementidm = elemm;
	// Internet Explorer
	try { reqm = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch(e) {
		try { reqm = new ActiveXObject("Microsoft.XMLHTTP"); }
		catch(oc) { reqm = null; }
	}

	// Mozilla/Safari
	if (!reqm && typeof XMLHttpRequest != "undefined") { reqm = new XMLHttpRequest(); }

	// Call the processChange() function when the page has loaded
	if (reqm != null) {
		reqm.onreadystatechange = processChangem;
		reqm.open("GET", urlm, true);
		reqm.send(null);
	}
}

function processChange() {
	// The page has loaded and the HTTP status code is 200 OK
	if (req.readyState == 4 && req.status == 200) {

		// Write the contents of this URL to the searchResult layer
		getObject(elementid).innerHTML = req.responseText;
	}
}
function processChangey() {
	// The page has loaded and the HTTP status code is 200 OK
	if (reqy.readyState == 4 && reqy.status == 200) {

		// Write the contents of this URL to the searchResult layer
		getObject(elementidy).innerHTML = reqy.responseText;
	}
}
function processChangez() {
	// The page has loaded and the HTTP status code is 200 OK
	if (reqz.readyState == 4 && reqz.status == 200) {

		// Write the contents of this URL to the searchResult layer
		getObject(elementidz).innerHTML = reqz.responseText;
	}
}
function processChangem() {
	// The page has loaded and the HTTP status code is 200 OK
	if (reqm.readyState == 4 && reqm.status == 200) {

		// Write the contents of this URL to the searchResult layer
		getObject(elementidm).innerHTML = reqm.responseText;
	}
}

function getObject(name) {
	var ns4 = (document.layers) ? true : false;
	var w3c = (document.getElementById) ? true : false;
	var ie4 = (document.all) ? true : false;

	if (ns4) return eval('document.' + name);
	if (w3c) return document.getElementById(name);
	if (ie4) return eval('document.all.' + name);
	return false;
}

/*
window.onload = function() {
getObject("searchdesc").focus();
}
*/
