///Funcion de conexion asincrona
var responseAjax = '';
/////////// FUNCIONES DE CONEXION ASINCRONA  ///////////////////////
function miajax(){
    try{
        objetus = new ActiveXObject("Msxml2.XMLHTTP");
	}catch (e){
        try{
            objetus= new ActiveXObject ("Microsoft.XMLHTTP");
        }catch (E){
            objetus = false;
        }
    }
    if (!objetus && typeof XMLHttpRequest!= 'undefined'){
        objetus = new XMLHttpRequest();
    }
    return objetus;
}

///////////////////////////////////////////////////////////////////////
///////   IMPORTANTE: Nunca te olvides de poner el ? despues   ////////
///////   de la direccion del archivo al cual vas a enviar los ////////
///////   datos, esto es muy IMPORTANTE ///////////////////////////////

/////////////////////  CONEXION AJAX CON JSON 2.0 ////////////////////////////
/////////////////////*  Conexion Ajax v1.2 JSON */////////////////////////////
function conexionAjax2(filedestino, valoresEnvio, next, div){	
	nuevoAjax = miajax();

    nuevoAjax.open("GET",filedestino+"&"+valoresEnvio,true);
    nuevoAjax.onreadystatechange = function(){
		if(nuevoAjax.readyState == 4){
           	if(nuevoAjax.status == 200){
				if( div != null ){
					document.getElementById( div ).innerHTML = nuevoAjax.responseText
				}else{
					responseAjax = nuevoAjax.responseText;
				}
				if (next != null){
					eval(next);
				}
			}else{
				responseAjax = false;
			}
		}
	}
    nuevoAjax.send(null); //envo nulo de variables*/
}
