﻿// JScript File

    function isSupported() {
        try { 
            var objhttp=new ActiveXObject("Msxml2.XMLHTTP");
            return true;
            } catch(e) {
                try { 
                        var objhttp=new ActiveXObject("Microsoft.XMLHTTP");
                        return true;
                    }  catch(e) {
                        try { 
                                var objhttp=new XMLHttpRequest;
                                return true;
                            } catch(e) {
                                return false;        
                            }
                    }
            }    
    }

    function myHttpRequest(url,parametros) {
        var R, MSGE;
        var datos;
        R="0";
        MSGE="null";
        try { 
            var objhttp=new ActiveXObject("Msxml2.XMLHTTP");
            } catch(e) {
                try { 
                        var objhttp=new ActiveXObject("Microsoft.XMLHTTP");
                    }  catch(e) {
                        try { 
                                var objhttp=new XMLHttpRequest;
                            } catch(e) {
                                R="-997";
                                MSGE = e.message;
                            }
                    }
            }
        try {
                datos=filterParams(parametros);
                //alert(datos);
                objhttp.open('POST', url, false);  
                objhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
                objhttp.setRequestHeader("Content-length",datos.length);
                objhttp.send(datos);
                if (objhttp.responseText.indexOf("|")>0) {
                    R=objhttp.responseText.split("|")[0];
                    MSGE=objhttp.responseText.split("|")[1];
                } else {
                    R="-998";
                    MSGE=objhttp.responseText;
                }
            } catch(e) {
                R="-999";
                MSGE = e.message;
            }
        return R+"|"+MSGE;
    }

	function filterParams(params){
		var i, r = [];
		for(i in params) r[r.length] = i + "=" + (this.encodeURIComponent ? this.encodeURIComponent(params[i]) : params[i]);
		return r.join("&");
	}
