function hytAjax () {

	// propiedades
	this.get			= hytAjaxGet;
	this.response		= hytAjaxHandleResponse;
	this.write			= hytAjaxWrite;

	// conector
	hAjax				= new hytAjaxCreate();
	hAjaxVars			= new Array();
}

function hytAjaxCreate() {
	var xmlhttp = false;
	
 	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}

	return xmlhttp;
}

function hytAjaxGet(sUrl, sMethod, sVars, bTextMode, bMode) {
	if(sMethod==null) { sMethod = "GET"; }
	if(sVars==null) { sVars = ''; }
	if(bTextMode==null) { bTextMode = true; }
	if(bMode==null) { bMode = true; }
	hAjax.onreadystatechange = hytAjaxHandleResponse;
	
	hAjaxVars['bTextMode']	= bTextMode;
	hAjaxVars['sText']		= null;
	hAjaxVars['sXml']		= null;
	
	if(sMethod.toUpperCase() == "GET") {
		hAjax.open(sMethod, sUrl, bMode);
		hAjax.send(null);
	} else if(sMethod.toUpperCase() == "POST") {
		hAjax.open(sMethod, sUrl, bMode);
		hAjax.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		hAjax.send(sVars);
	}
}

function hytAjaxHandleResponse() {
	if(hAjax.readyState==4) {
		if(hAjaxVars['bTextMode']) {
			hAjaxVars['sText'] = hAjax.responseText;
			loadedDoc(hAjaxVars['sText']);
		} else {
			hAjaxVars['sXml'] = hAjax.responseXML;
			loadedDoc(hAjaxVars['sXml']);
		}
	}
}

function hytAjaxWrite(bAsText) {
	if(bAsText==null || bAsText==true) {
		return hAjaxVars['sText'];
	} else {
		return hAjaxVars['sXml'];
	}
}