/*  * To change this template, choose Tools | Templates * and open the template in the editor. */function jsHttpConexion(URL,GetVars,PostVars,onRequest){	this.httpC=httpRequest();    this.PostVars=(PostVars!=undefined)?PostVars:"";    this.GetVars=(GetVars!=undefined)?GetVars:"";    this.URL=URL;    this.getHttpCon=function(){        return this.httpC;    }    this.getUrl=function(){            return this.URL+(            (this.URL.indexOf("?")==-1)?"?":""            )+this.jSon2UrlEncode(this.GetVars);               }    this.getVarsPost = function(){        return this.jSon2UrlEncode(this.PostVars);    }    this.jSon2UrlEncode=function(jSon,prefijo){        var url="";        for(i in jSon){            if((typeof jSon[i])=='object'){                if(isArray(jSon[i]))                    url+= ((prefijo)?prefijo:"") + this.jSon2UrlEncode(jSon[i],i+"[]")+"&";                else                    ;//pediente soporte para JSON hijos y Arreglos Bidimencionales            }else                url+=((prefijo)?prefijo:escape(i))+'='+escape(jSon[i])+"&";        }                return url.substr(0,url.length-1);    }    this.onRequest=onRequest;    this.onError=function(){        //jsHC.status        alert("Error:"+this.httpC.status);    }    this.send=function(){        var evitaCache=Math.floor(Math.random() * (100000000000000));        var url = this.getUrl()+((this.getUrl().indexOf('?')==-1)?"?rand=":"&rand=")+evitaCache;				//alert(url);        if(this.getVarsPost()){            this.httpC.open("POST",url,true);            this.httpC.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); //cabeceras del post            this.httpC.send(this.getVarsPost());        }else{                        this.httpC.open("GET",url,true);            this.httpC.send();        }        //xml.send(variables_aEnviar); //enviar variables        var jsHttpConexion=this;        var httpC=this.httpC;        this.httpC.onreadystatechange=function(){          //  var onError=this.onError;                    if (httpC.readyState==4){                                if(httpC.status==200){                                            jsHttpConexion.onRequest(jsHttpConexion);                }else{                                        jsHttpConexion.onError();                }            }    }    this.getRT = function(){        return this.httpC.responseText;    }   	//xml.send(variables_aEnviar); //enviar variables	//xml.onreadystatechange=function() {	//	//	}	}	//return;}/*******************************************************/function httpRequest(){    try {	    objXML = new ActiveXObject("Msxml2.XMLHTTP");    } catch (e) {	    try {		    objXML = new ActiveXObject("Microsoft.XMLHTTP");	    } catch (E) {		    objXML = false;	    }    }    if (!objXML && typeof XMLHttpRequest!='undefined') {	    objXML = new XMLHttpRequest();    }    return objXML;}/*****************************************************/function isArray(testObject) {    return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number';}/*function respuesta(jsHC){ //   alert(jsHC.getRT());    eval(jsHC.getRT());    alert(ar.nombre);}new jsHttpConexion(    "proceso.php",    {'action':"contacto",'do':"send"},    {nombre:'pako',email:'wario&diaz@gmail.com','id':new Array(1,6)},    respuesta).send();*///alert(httpc.getUrl());//alert(httpc.getVarsPost();//alert(httpc.getHttpCon());