// flexible ajax library // author: clemens krack - ckrack@gmail.com - http://tripdown.de var flxajax_request_type = "GET"; function flxajax_init_object() { var A; try { A=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { A=new ActiveXObject("Microsoft.XMLHTTP"); } catch (oc) { A=null; } } if(!A && typeof XMLHttpRequest != "undefined") A = new XMLHttpRequest(); return A; } function flxajax_do_call(func_name, args) { var i, x, n; var uri; var post_data; uri = "/usuarios/scripts/ajax.php"; if (flxajax_request_type == "GET") { if (uri.indexOf("?") == -1) uri = uri + "?rs=" + escape(func_name); else uri = uri + "&rs=" + escape(func_name); for (i = 0; i < args.length-1; i++) uri = uri + "&rsargs[]=" + escape(args[i]); uri = uri + "&rsrnd=" + new Date().getTime(); post_data = null; } else { post_data = "rs=" + escape(func_name); for (i = 0; i < args.length-1; i++) post_data = post_data + "&rsargs[]=" + escape(args[i]); } x = flxajax_init_object(); x.open(flxajax_request_type, uri, true); if (flxajax_request_type == "POST") { x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); x.setRequestHeader("Content-length",post_data.length); x.setRequestHeader("Connection","close"); } x.onreadystatechange = function() { if (x.readyState != 4) return; var status; var data; status = x.responseText.charAt(0); data = x.responseText.substring(2); if (status == "-") alert("Error: " + data); else args[args.length-1](data); } x.send(post_data); delete x; } // wrapper for EnviarContacto function x_EnviarContacto() { flxajax_do_call("EnviarContacto", x_EnviarContacto.arguments); } // wrapper for ComprobarEmail function x_ComprobarEmail() { flxajax_do_call("ComprobarEmail", x_ComprobarEmail.arguments); } // wrapper for ComprobarUsuario function x_ComprobarUsuario() { flxajax_do_call("ComprobarUsuario", x_ComprobarUsuario.arguments); } // wrapper for GuardarUsuario function x_GuardarUsuario() { flxajax_do_call("GuardarUsuario", x_GuardarUsuario.arguments); } // wrapper for ValidarUsuario function x_ValidarUsuario() { flxajax_do_call("ValidarUsuario", x_ValidarUsuario.arguments); } // wrapper for MostrarCliente function x_MostrarCliente() { flxajax_do_call("MostrarCliente", x_MostrarCliente.arguments); } // wrapper for ActualizarPerfil function x_ActualizarPerfil() { flxajax_do_call("ActualizarPerfil", x_ActualizarPerfil.arguments); } // wrapper for RecuperarClave function x_RecuperarClave() { flxajax_do_call("RecuperarClave", x_RecuperarClave.arguments); }