// JavaScript Document
/*
   +----------------------------------------------------------------------+
   | XMLHttpRequest javascript file
   +----------------------------------------------------------------------+
*/

/**** Objeto XMLHttpRequest *****/
var xmlHttp=null;
try {
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e) {
	try {
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	 }
	catch(e) {}
}

/**** Forma nativa ****/
if (xmlHttp==null)
	xmlHttp=new XMLHttpRequest();

var ajax_result; // async/sync calls

/********* Realiza la peticion y entrega el resultado como texto *************/
function ajaxPerform(async, xmlMessage, responser, method){
	var message;

	xmlHttp.open(method, responser, async);
    xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
    xmlHttp.send(xmlMessage);

    return xmlHttp.responseText;
}

//-- llama a un procedimiento remoto del servidor --//
function ajaxResponseCheck(vValor,vAccion,vIdResponse){
	var response = "";
	if(vValor!=""){
		response = ajaxPerform(false, '', 'comun/ajaxResponse.php?action='+vAccion+'&valor='+vValor, 'POST');
		document.getElementById(vIdResponse).innerHTML=response;
	}
}
function ajaxResponseGetUserClave(vValor,vAccion){
	var response = "";
	if(vValor!=""){
		response = ajaxPerform(false, '', 'comun/ajaxResponse.php?action='+vAccion+'&valor='+parseInt(vValor), 'POST');
	}
	return response;
}

function ajaxResponseGetCodUrl(vValor,vAccion){
	var response = "";
	if(vValor!=""){
		response = ajaxPerform(false, '', 'comun/ajaxResponse.php?action='+vAccion+'&valor='+vValor, 'POST');
	}
	return response;
}