All pastes #468064 Raw Edit

corrideat

public javascript v1 · immutable
·published 2007-05-02 21:29 UTC
rendered paste body
var ENABLED_sys=false;var AJAX_ALERT_C=false;function startload()  {setTimeout("setdisp('loadingp',1);",50);setTimeout("ENABLED_sys=true;loadphp(\"index\");",500);//setTimeout("ENABLED_sys=true;loadphp(\"tonto\");",500);}var CURR_PAGE=null;var CURR_bURL=null;var CURR_REQ=null;function ajax() {        if (!ENABLED_sys) return; /* Si no est&#65533;activado an el sistema(carga inicial) */                var http_request = false;        if (window.XMLHttpRequest) { /* Mozilla, Safari,... */            http_request = new XMLHttpRequest();            if (http_request.overrideMimeType)                 http_request.overrideMimeType('application/xhtml+xml');        } else if (window.ActiveXObject) { /* IE */            try {                http_request = new ActiveXObject("Msxml2.XMLHTTP");            } catch (e) {                try {                    http_request = new ActiveXObject("Microsoft.XMLHTTP");                } catch (e) { return false; }            }        }        if (!http_request) {            alert('Giving up :( JS Object error');            return false;        }                return http_request;}///////////////////////////////Funciones varias/////////////////function setdisp(cap,set) {        if (set==true) {                try {                    document.getElementById(cap).style.display = "block";                } catch(e) {                    return false;                };        } else {                try {                    document.getElementById(cap).style.display = "none";                } catch(e) {                    return false;                };        }}function capatexto(msg,cap){        if (!msg) msg="&nbsp;";        if (!cap) cap='visual';        try {            document.getElementById(cap).innerHTML=msg;        } catch(e) {            return false;        };}function setvis (cap,set) {        if (set==1) {                try {                    document.getElementById(cap).style.visibility = "visible";                } catch(e) {                    return false;                };        } else {                try {                    document.getElementById(cap).style.visibility = "hidden";                } catch(e) {                    return false;                };        }}////////////////////////////////////////////////////////////////var PHP__="";function loadphp(php,values,cap,bURL,notab){    if (!bURL) bURL="/loadphp.php/";    if (!cap) cap="visual";    if (!values) values="";    if (!php) php="index";        if (!document.getElementById(cap))                 {alert("Capa inexistente ("+cap+")."); return;}            _ajaxO=ajax();                if (!_ajaxO) return;            _values_send=values;        _URL_=bURL+php;    _ajaxO.open("POST",_URL_,true);        _ajaxO.onreadystatechange=        function() {            if (_ajaxO.readyState==1)                        setdisp("loadingp",1);            else if(_ajaxO.readyState==4) {                if(_ajaxO.status==200) {                    if (AJAX_ALERT_C) alert(_ajaxO.responseText);<?php if (acXHTML()) { ?>        while(document.getElementById(cap).firstChild)              document.getElementById(cap).removeChild(document.getElementById(cap).firstChild);        document.getElementById(cap).innerHTML=_ajaxO.responseText;<?php }  else { ?>        document.getElementById(cap).innerHTML=_ajaxO.responseText;<?php } ?>                    setdisp("loadingp",0);                } else                    capatexto("Resultado inesperado.");            }        };        _ajaxO.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");                  if (_values_send=="")                _values_send="ini=ini";                        _ajaxO.send(_values_send);            if (cap=="visual") {        CURR_bURL=bURL;        CURR_PAGE=php;        CURR_REQ=values;/*      if (!notab) {            PHP__=php;            setTimeout('loadphp(PHP__,"js=yes","asubmenu","loadmenut.phpsec=",true);',100);        }*/    }    return;}function popup(url,retur,width,height,scroll) {    if (!url) url="about:blank";    if (!width) width="510";    if (!height) height="510";    if (!scroll) scroll="no";        var w=window.open(url,'gpl_popup','status=no,resizable=no,toolbar=no,directories=no,menubar=no,scrollbars='+scroll+',width='+width+',height='+height);    if (retur) return w;}function AJAXForm(formID,target,layer,extravals) {        /* Si no existe el elemento, o se llamó sin parámetros, salir */        if (!formID && !document.getElementById(formID)) return;        if (!target) target=formID;        if (!extravals) extravals="ini=ini";        /* Consigue el elemento */        var form=document.getElementById(formID);        /* Bloquea el formulario */        lockForm(formID,true);          /* Inicializar variables */        var args=encodeURIComponent(extravals);                var g=function(form,el) {                var i=0,j=0,ff='';                j=form.getElementsByTagName(el);                for (i=0;;i++) {                        if (j[i]) {                                if ((j[i].type=="radio" || j[i].type=="checkbox") && j[i].checked==false) {continue;}                                if (j[i].type=="submit" || j[i].type=="reset" || j[i].type=="button") {continue;}                                ff+="&"+j[i].name+"="+encodeURIComponent(j[i].value);                        } else break;                }                return ff;        };                        args+=g(form,"input");                args+=g(form,"select");                args+=g(form,"textarea");                loadphp(target,args,layer);        return;}