/** * @author jchernandez */ var sendReq = getXmlHttpRequestObject(); var receiveReq = getXmlHttpRequestObject(); var mTimer; var vtEvntGrdd; var vsPathRemote; var vsRemoteFile; var vsGadgetPartidos = '
'; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += ''; vsGadgetPartidos += '
- - -
'; vsGadgetPartidos += '
'; vsGadgetPartidos += '
'; vsGadgetPartidos += '
'; vsGadgetPartidos += '
'; vsGadgetPartidos += ''; vsGadgetPartidos += '
'; vsGadgetPartidos += '
'; vsGadgetPartidos += ' '; //*** Rutina para ejecutar la consulta del archivo XML que tiene el nombre del componente y si se despliega o no function getRemoteControl() { if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", 'http://www.femexfut.org.mx/PortalV2/webservices/ws_RemoteControl.aspx', true); //*** Cuando conteste el archivo XML pasamos el control a la rutina que se encarga de verificar las instrucciones remotas receiveReq.onreadystatechange = function() { handleRemoteControl(receiveReq) } receiveReq.send(null); } } function getRemoteControl2(psPathRemote, psRemoteFile) { if(vsPathRemote==null) { vsPathRemote = psPathRemote; } if(vsRemoteFile==null) { vsRemoteFile = psRemoteFile; } if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { receiveReq.open("GET", 'http://www.femexfut.org.mx' + vsPathRemote + '/ws_RemoteControl.aspx?psRemoteControl=' + vsRemoteFile, true); //*** Cuando conteste el archivo XML pasamos el control a la rutina que se encarga de verificar las instrucciones remotas receiveReq.onreadystatechange = function() { handleRemoteControl(receiveReq) } receiveReq.send(null); } } //*** Rutina que interpreta el contenido del XML y enciendo o apaga el(los) componente(s) especificado(s) function handleRemoteControl(poRespuestaXML) { if (poRespuestaXML.readyState == 4) { switch(poRespuestaXML.status) { case 200: //*** Extraemos un arreglo de los componentes especificados en el XML var vaoElementos = poRespuestaXML.responseXML.getElementsByTagName('Elemento'); for(var vnTmp=0; vnTmp 400) { mTimer = setTimeout('getRemoteControl();', 2000); } } } } //*** Rutina para generar el div dinamico function f_MakeComponent(psNombreComponente, psDestino, psParametros) { var vsNombrePartidos = psNombreComponente.substring(0,10); if (vsNombrePartidos=='MxMPartido'){ //alert('Si es partido: ' + vsNombrePartidos); var voComponent = f_CreaObjetoHTML(psNombreComponente + '_' + psDestino, 'div', psDestino); }else{ if(xGetElementById(psDestino)!=null) { var voComponent = f_CreaObjetoHTML(psNombreComponente + '_' + psDestino, 'div', psDestino); var vsNmbrPrmtr = psNombreComponente + '_GADGET_Parametros'; vsNmbrPrmtr = vsNmbrPrmtr.toUpperCase(); var voComponentParams = f_CreaObjetoHTML(vsNmbrPrmtr, 'div', psDestino); xDisplay(voComponentParams, 'none'); voComponentParams.innerHTML = psParametros; xShow(voComponent); procesaXML('http://www.femexfut.org.mx/portalv2/webservices/ws_universal.aspx', f_MakeDIVFromXML, '_Query=Gadgets/Gdgt_' + psNombreComponente + '.txt' + '&_Objeto=' + psNombreComponente + '_Gadget', psNombreComponente + '_Gadget', psNombreComponente + '_' + psDestino); } } } function f_MakeDIVFromXML(poRespuestaXML, poObjetoDiv, psDestino) { //alert(poObjetoDiv); var vaoElementosGrupo = poRespuestaXML.responseXML.getElementsByTagName('Elementos'); var vaoElementos = poRespuestaXML.responseXML.getElementsByTagName('Elemento'); for(var vnTmp=0; vnTmp0){ var MyJS = document.createElement('script'); MyJS.setAttribute('type','text/javascript'); MyJS.setAttribute('id', jsName); MyJS.setAttribute('src','http://www.femexfut.org.mx/TXT/Gadgets/js/' + jsName); MyJS.onload = function() { try { setTimeout(eval('f_' + psNombreGadget + '_OnStart').apply(), 1000); } catch(err) { } } document.getElementsByTagName('head')[0].appendChild(MyJS); } } function f_LoadJS(jsName, psNombreGadget) { if(jsName.length>0){ var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.setAttribute('id', jsName); //*** En IE aplica de esta manera la ejecución de una funcion cargada dinamicamente script.onreadystatechange = function() { if(script.readyState == 'loaded' || script.readyState == 'complete') { try { var args = [xGetElementById(psNombreGadget + '_PARAMETROS').innerHTML]; eval('f_' + psNombreGadget + '_OnStart').apply(window, args); } catch(err) { } } } //*** Esto es en el modo de Firefox, etc. script.onload = function() { try { var args = [xGetElementById(psNombreGadget + '_PARAMETROS').innerHTML]; eval('f_' + psNombreGadget + '_OnStart').apply(window, args); } catch(err) { } } //script.src= 'http://www.femexfut.org.mx/webservices/ws_includefile.aspx?psPath=/TXT/Gadgets/js/' + jsName; script.setAttribute('src','http://www.femexfut.org.mx/TXT/Gadgets/js/' + jsName); head.appendChild(script); } } function f_UnloadJS(jsName) { if(document.getElementById(jsName)!=null) { var s = document.getElementById(jsName); document.getElementsByTagName('head')[0].removeChild(s); } } //*** Rutina para desaparecer el div dinamico function f_KillComponent(psNombreComponente, psDestino) { if((xGetElementById(psDestino)!=null) && (xGetElementById(psNombreComponente + '_' + psDestino)!=null)) { try { f_BorraObjetoHTML(psNombreComponente + '_' + psDestino, psDestino); f_UnloadJS('Gdgt_' + psNombreComponente + '.js') } catch(err) { } } } function getXmlHttpRequestObject() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if(window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else { //*** document.getElementById("MXM").innerHTML = 'Status: Cound not create XmlHttpRequest Object.' + 'Consider upgrading your browser.'; } } function f_Nada() { return true; }