function TestMe(){new JsDatePick({useMode:2,target:"mexpire",dateFormat:"%d-%M-%Y",yearsRange: new Array(1900,2100)});}function TestMe2(){new JsDatePick({useMode:2,target:"dob",dateFormat:"%d-%M-%Y",yearsRange: new Array(1900,2100)});}function createXMLHttpRequest(){var objTemp=false; var objXMLHttpRequest=false; if(window.XMLHttpRequest) {try {objTemp=new XMLHttpRequest(); } catch(e) {objTemp=false; } } if(objTemp===false&&window.ActiveXObject) {try {objTemp=new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) {try {objTemp=new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) {objTemp=false; } } } if (objTemp===false&&window.createRequest) {try {objTemp=window.createRequest(); } catch(e) {objTemp=false; } } if (objTemp!==false) {objXMLHttpRequest=new Object; objXMLHttpRequest.aWidgetRefreshList=new Array(); objXMLHttpRequest.widgetRefreshListIter=0; objXMLHttpRequest.bWidgetRefreshRequestPending=false; objXMLHttpRequest.request=objTemp; objXMLHttpRequest.open=function(strMethod,strUrl) {this.request.open(strMethod,strUrl,true); }; objXMLHttpRequest.onReadyStateChange=function(callback) {this.request.onreadystatechange=callback; }; objXMLHttpRequest.send=function() {this.request.send(''); }; objXMLHttpRequest.abort=function() {this.request.abort(); }; objXMLHttpRequest.readyState=function() {var f1529589039; try {f1529589039=this.request.readyState; } catch(e) {f1529589039=0; } return f1529589039; }; objXMLHttpRequest.status=function() {var f1529589039; try {f1529589039=this.request.status; } catch(e) {f1529589039=999; } return f1529589039; }; objXMLHttpRequest.responseXML=function() {var f1529589039; try {if (this.request.responseXML.documentElement) {f1529589039=this.request.responseXML.documentElement; } else {f1529589039=this.request.responseXML; } var temp=f1529589039.getElementsByTagName; } catch(e) {f1529589039=document.createElement('body'); try {f1529589039.innerHTML=this.request.responseText; f1529589039.normalize(); } catch(e) {alert('HELP!'); } } return f1529589039; }; objXMLHttpRequest.responseText=function() {var f1529589039; try {f1529589039=this.request.responseText; } catch(e) {f1529589039='invalid'; } return f1529589039; }; } else {throw new Exception('cannot find an XMLHttpRequest object'); } return objXMLHttpRequest; } var glob_objXMLHttpRequest1=false;var glob_objXMLHttpRequest2=false;var glob_bWidgetRefreshRequest1Pending=false;var glob_bWidgetRefreshRequest2Pending=false;var glob_widgetsRefreshManagerTimeoutId=null;var glob_bWidgetsRefreshManagerStopPending=false;function jjManageWidgets(url,start,interval_ms,widgetId,prepareFunc,callbackFunc,widgetContainerTag){try {if(!glob_objXMLHttpRequest1) {glob_objXMLHttpRequest1=createXMLHttpRequest(); } } catch(e) {if(glob_bWidgetsRefreshManagerStopPending===false) {catchException('Exception in jjManageWidgets() with params - creating glob_objXMLHttpRequest1 - ',e); } } try {if(!glob_objXMLHttpRequest2) {glob_objXMLHttpRequest2=createXMLHttpRequest(); if(glob_objXMLHttpRequest2) {glob_objXMLHttpRequest2.aWidgetRefreshList=new Array(); glob_objXMLHttpRequest2.widgetRefreshListIter=0; glob_objXMLHttpRequest2.bWidgetRefreshRequestPending=false; } } } catch(e) {if(glob_bWidgetsRefreshManagerStopPending===false) {catchException('Exception in jjManageWidgets() with params - creating glob_objXMLHttpRequest2 - ',e); } } if(typeof(url)=='string') {var entry=new Array(); entry['url']=url; entry['next']=start; entry['id']=widgetId; entry['prepare']=prepareFunc; entry['callback']=callbackFunc; entry['tag']=widgetContainerTag; if (interval_ms>0) {entry['interval']=interval_ms; glob_objXMLHttpRequest1.aWidgetRefreshList.push(entry); } else {glob_objXMLHttpRequest2.aWidgetRefreshList.push(entry); } } else {try {if(glob_objXMLHttpRequest1) {if(glob_objXMLHttpRequest1.aWidgetRefreshList.length>0) {for (iter in glob_objXMLHttpRequest1.aWidgetRefreshList) {var dateNow=new Date(); var curTime_ms=dateNow.getTime(); if(!glob_bWidgetRefreshRequest1Pending&&glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['next']<=curTime_ms ) {glob_bWidgetRefreshRequest1Pending=true; glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['next']=curTime_ms + glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['interval']; glob_objXMLHttpRequest1.open('POST',glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['url'],true); glob_objXMLHttpRequest1.onReadyStateChange(widgetsRefresh1Callback); glob_objXMLHttpRequest1.send(''); glob_objXMLHttpRequest1.widgetRefreshListIter=iter; if (glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['prepare']) {glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['prepare'](glob_objXMLHttpRequest1.aWidgetRefreshList[iter]['id']); } break; } } } } if(glob_objXMLHttpRequest2) {if(glob_objXMLHttpRequest2.aWidgetRefreshList.length>0) {for (iter in glob_objXMLHttpRequest2.aWidgetRefreshList) {var dateNow=new Date(); var curTime_ms=dateNow.getTime(); if(!glob_bWidgetRefreshRequest2Pending&&glob_objXMLHttpRequest2.aWidgetRefreshList[iter]['next']<=curTime_ms ) {glob_bWidgetRefreshRequest2Pending=true; glob_objXMLHttpRequest2.open('POST',glob_objXMLHttpRequest2.aWidgetRefreshList[iter]['url'],true); glob_objXMLHttpRequest2.onReadyStateChange(widgetsRefresh2Callback); glob_objXMLHttpRequest2.send(''); glob_objXMLHttpRequest2.widgetRefreshListIter=iter; if (glob_objXMLHttpRequest2.aWidgetRefreshList[iter]['prepare']) {glob_objXMLHttpRequest2.aWidgetRefreshList[iter]['prepare'](glob_objXMLHttpRequest2.aWidgetRefreshList[iter]['id']); } jjDbgOut(GLOB_DEBUG_TRACE, 'jjManageWidgets()', 'glob_objXMLHttpRequest2.aWidgetRefreshList.length=' + glob_objXMLHttpRequest2.aWidgetRefreshList.length); break; } } } } } catch(e) {if(glob_bWidgetsRefreshManagerStopPending===false) {catchException('Exception in jjManageWidgets() - ',e); } } glob_widgetsRefreshManagerTimeoutId=window.setTimeout('jjManageWidgets()',30); }}function widgetsRefresh1Callback(){if(glob_bWidgetsRefreshManagerStopPending===false) {try {if (glob_objXMLHttpRequest1.readyState()==4) {if (glob_objXMLHttpRequest1.status()==200) {if(glob_objXMLHttpRequest1.aWidgetRefreshList[glob_objXMLHttpRequest1.widgetRefreshListIter]) {var widgetId=glob_objXMLHttpRequest1.aWidgetRefreshList[glob_objXMLHttpRequest1.widgetRefreshListIter]['id']; var tag=glob_objXMLHttpRequest1.aWidgetRefreshList[glob_objXMLHttpRequest1.widgetRefreshListIter]['tag']; glob_objXMLHttpRequest1.aWidgetRefreshList[glob_objXMLHttpRequest1.widgetRefreshListIter]['callback'](glob_objXMLHttpRequest1,widgetId,tag); } } glob_bWidgetRefreshRequest1Pending=false; } } catch(e) {if(glob_bWidgetsRefreshManagerStopPending===false) {catchException('Exception in widgetsRefresh1Callback() - ',e); } } }}function widgetsRefresh2Callback(){if(glob_bWidgetsRefreshManagerStopPending===false) {try {if (glob_objXMLHttpRequest2.readyState()==4) {if (glob_objXMLHttpRequest2.status()==200) {if(glob_objXMLHttpRequest2.aWidgetRefreshList[glob_objXMLHttpRequest2.widgetRefreshListIter]) {var widgetId=glob_objXMLHttpRequest2.aWidgetRefreshList[glob_objXMLHttpRequest2.widgetRefreshListIter]['id']; jjDbgOut(GLOB_DEBUG_TRACE, 'widgetsRefresh2Callback()', 'widgetId=' + widgetId + "\n" + 'callback func=' + glob_objXMLHttpRequest2.aWidgetRefreshList[glob_objXMLHttpRequest2.widgetRefreshListIter]['callback']); var tag=glob_objXMLHttpRequest2.aWidgetRefreshList[glob_objXMLHttpRequest2.widgetRefreshListIter]['tag']; glob_objXMLHttpRequest2.aWidgetRefreshList[glob_objXMLHttpRequest2.widgetRefreshListIter]['callback'](glob_objXMLHttpRequest2,widgetId,tag); glob_objXMLHttpRequest2.aWidgetRefreshList.splice(glob_objXMLHttpRequest2.widgetRefreshListIter,1); } } glob_bWidgetRefreshRequest2Pending=false; } } catch(e) {if(glob_bWidgetsRefreshManagerStopPending===false) {catchException('Exception in widgetsRefresh2Callback() - ',e); } } }}function processWidgetRefresh(objXMLHttpRequest,widgetId,widgetContainerTag){try {if (objXMLHttpRequest.responseXML() ) {var xmlResponse=objXMLHttpRequest.responseXML(); if (xmlResponse.getElementsByTagName ) {var nodeList=xmlResponse.getElementsByTagName(widgetContainerTag); for (var i in nodeList) {if (nodeList[i]&&nodeList[i].getAttribute) {var objDom=document.getElementById(nodeList[i].getAttribute('id')); if (objDom) {jjWidgetReplaceContent(nodeList[i],objDom); } else {jjDbgOut(GLOB_DEBUG_TRACE, 'processWidgetRefresh()', 'Unknown widget Id=' + nodeList[i].getAttribute('id')); } } } } } else if (objXMLHttpRequest.responseText() ) {alert(objXMLHttpRequest.responseText()); } } catch (e) {catchException('Exception in processWidgetRefresh() - ',e); }}function processWidgetEvent(objXMLHttpRequest,widgetId,widgetContainerTag){try {if (objXMLHttpRequest.responseXML() ) {var xmlResponse=objXMLHttpRequest.responseXML(); if (xmlResponse.getElementsByTagName ) {xmlResponse.normalize(); var nodeList=xmlResponse.getElementsByTagName(widgetContainerTag); if (nodeList&&nodeList.length>0) {for (var i=0; i0 ) {try {var objDom=document.getElementById(nodeList[i].id); } catch(e) {catchException('Exception in processWidgetEvent() - ','whilst extracting obDom'); } if(objDom) {try {var objFirstFieldElement=jjWidgetReplaceContent(nodeList[i],objDom); if (objFirstFieldElement&&objFirstFieldElement.select) {objFirstFieldElement.select(); } } catch(e) {catchException('Exception in processWidgetEvent() - ','whilst extracting objFirstFieldElement'); } } else {jjDbgOut(GLOB_DEBUG_ERROR, 'processWidgetEvent()', 'Unknown widget Id=' + nodeList[i].id); } } } } } } else {jjDbgOut(GLOB_DEBUG_WARN, 'processWidgetEvent()','xmlResponse has no nodes ' + xmlResponse); } } else {jjDbgOut(GLOB_DEBUG_WARN, 'processWidgetEvent()','xmlResponse not an Element object ' + xmlResponse); } } else if (objXMLHttpRequest.responseText() ) {jjDbgOut(GLOB_DEBUG_TRACE, 'processWidgetEvent()', objXMLHttpRequest.responseText()); } } catch(e) {catchException('Exception in processWidgetEvent() - ',e); }}function jjWidgetReplaceContent(objSrc,objTgt){var objFirstFieldElement=null; try {if (objSrc.innerHTML&&objTgt.innerHTML) {objTgt.innerHTML=objSrc.innerHTML; } else {if (objTgt.hasChildNodes()) {while (objTgt.lastChild) {objTgt.removeChild(objTgt.lastChild) } } var objFrag=document.createDocumentFragment(); while (objSrc.lastChild) {var objChild=objSrc.removeChild(objSrc.firstChild); objFrag.appendChild(objChild); if (objChild.tagName&&(objChild.tagName.toLowerCase()=='input'||objChild.tagName.toLowerCase()=='textarea'||objChild.tagName.toLowerCase()=='button'||objChild.tagName.toLowerCase()=='select') ) {objFirstFieldElement=objChild; } } objTgt.appendChild(objFrag); } if (objSrc.hasAttributes() ) {if (objTgt.hasAttributes() ) {var nnmTgtAttr=objTgt.attributes; if (nnmTgtAttr.getNamedItem) {for (var i in nnmAttr) {objTgt.removeAttributeNode(nnmTgtAttr[i]); } } else {} } var nnmSrcAttr=objSrc.attributes; if (nnmSrcAttr.getNamedItem) {for (var i in nnmSrcAttr) {objTgt.setAttributeNode(nnmSrcAttr[i]); } } else {} } objTgt.normalize(); } catch(e) {} return objFirstFieldElement;}function stopWidgetManagement(){glob_bWidgetsRefreshManagerStopPending=true; try {window.clearTimeout(glob_widgetsRefreshManagerTimeoutId); } catch(e) {} try {glob_objXMLHttpRequest1.abort(); } catch(e) {} try {glob_objXMLHttpRequest2.abort(); } catch(e) {} glob_objXMLHttpRequest1=null; glob_objXMLHttpRequest2=null; }