1function PShowWaitMessage(container_id, bHide) 2{ 3 if (bHide == null) bHide = false; 4 PCloseWaitMessage(container_id, bHide); 5 6 var obContainer = document.getElementById(container_id); 7 8 if (obContainer) 9 { 10 if (window.ajaxMessages == null) window.ajaxMessages = {}; 11 if (!window.ajaxMessages.wait) window.ajaxMessages.wait = 'Wait...'; 12 13 obContainer.innerHTML = window.ajaxMessages.wait; 14 15 if (bHide) obContainer.style.display = 'inline'; 16 } 17} 18 19function PCloseWaitMessage(container_id, bHide) 20{ 21 if (bHide == null) bHide = false; 22 23 var obContainer = document.getElementById(container_id); 24 25 if (obContainer) 26 { 27 obContainer.innerHTML = ''; 28 29 if (bHide) obContainer.style.display = 'none'; 30 } 31 32} 33 34function JCPHttpRequest() 35{ 36 this.Action = {}; //{TID:function(result){}} 37 38 this.InitThread = function() 39 { 40 while (true) 41 { 42 var TID = 'TID' + Math.floor(Math.random() * 1000000); 43 if (!this.Action[TID]) break; 44 } 45 46 return TID; 47 } 48 49 this.SetAction = function(TID, actionHandler) 50 { 51 this.Action[TID] = actionHandler; 52 } 53 54 this._Close = function(TID, httpRequest) 55 { 56 if (this.Action[TID]) this.Action[TID] = null; 57// httpRequest.onreadystatechange = null; 58 httpRequest = null; 59 } 60 61 this._OnDataReady = function(TID, result) 62 { 63 if(this.Action[TID]) 64 { 65 this.Action[TID](result); 66 } 67 } 68 69 this._CreateHttpObject = function() 70 { 71 var obj = null; 72 if(window.XMLHttpRequest) 73 { 74 try {obj = new XMLHttpRequest();} catch(e){} 75 } 76 else if(window.ActiveXObject) 77 { 78 try {obj = new ActiveXObject("Microsoft.XMLHTTP");} catch(e){} 79 if(!obj) 80 try {obj = new ActiveXObject("Msxml2.XMLHTTP");} catch (e){} 81 } 82 return obj; 83 } 84 85 this._SetHandler = function(TID, httpRequest) 86 { 87 var _this = this; 88 89 function __handlerReadyStateChange() 90 { 91 //alert(httpRequest.readyState); 92 if(httpRequest.readyState == 4) 93 { 94// try 95// { 96 var s = httpRequest.responseText; 97 var code = []; 98 var start; 99 100 while((start = s.indexOf('<script>')) != -1) 101 { 102 var end = s.indexOf('</script>', start); 103 if(end != -1) 104 { 105 code[code.length] = s.substr(start+8, end-start-8); 106 s = s.substr(0, start) + s.substr(end+9); 107 } 108 else 109 { 110 s = s.substr(0, start) + s.substr(start+8); 111 } 112 } 113 114 _this._OnDataReady(TID, s); 115 116 for(var i in code) 117 if(code[i] != '') 118 eval(code[i]); 119// } 120// catch (e) 121// { 122// var w = window.open("about:blank"); 123// w.document.write(httpRequest.responseText); 124// //w.document.close(); 125// } 126 127 _this._Close(TID, httpRequest); 128 } 129 //alert('done'); 130 } 131 132 httpRequest.onreadystatechange = __handlerReadyStateChange; 133 } 134 135 this._MyEscape = function(str) 136 { 137 return escape(str).replace(/\+/g, '%2B'); 138 } 139 140 this._PrepareData = function(arData, prefix) 141 { 142 var data = ''; 143 if (arData != null) 144 { 145 for(var i in arData) 146 { 147 if (data.length > 0) data += '&'; 148 var name = this._MyEscape(i); 149 if(prefix) 150 name = prefix + '[' + name + ']'; 151 if(typeof arData[i] == 'object') 152 data += this._PrepareData(arData[i], name) 153 else 154 data += name + '=' + this._MyEscape(arData[i]) 155 } 156 } 157 return data; 158 } 159 160 this.Send = function(TID, url, arData) 161 { 162 if (arData != null) 163 var data = this._PrepareData(arData); 164 165 if (data.length > 0) 166 { 167 if (url.indexOf('?') == -1) 168 url += '?' + data; 169 else 170 url += '&' + data; 171 } 172 173 var httpRequest = this._CreateHttpObject(); 174 if(httpRequest) 175 { 176 httpRequest.open("GET", url, true); 177 this._SetHandler(TID, httpRequest); 178 return httpRequest.send(""); 179 } 180 return false; 181 } 182 183 this.Post = function(TID, url, arData) 184 { 185 var data = ''; 186 187 if (arData != null) 188 data = this._PrepareData(arData); 189 190 var httpRequest = this._CreateHttpObject(); 191 if(httpRequest) 192 { 193 httpRequest.open("POST", url, true); 194 this._SetHandler(TID, httpRequest); 195 httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 196 return httpRequest.send(data); 197 } 198 return false; 199 } 200 201 this.__migrateSetHandler = function(obForm, obFrame, handler) 202 { 203 function __formResultHandler() 204 { 205 if (!obFrame.contentWindow.document || obFrame.contentWindow.document.body.innerHTML.length == 0) return; 206 if (null != handler) 207 handler(obFrame.contentWindow.document.body.innerHTML); 208 209 // uncomment next to return form back after first query 210 211 /* 212 obForm.target = ''; 213 obForm.removeChild(obForm.lastChild); 214 document.body.removeChild(obFrame); 215 */ 216 } 217 218 if (obFrame.addEventListener) 219 { 220 obFrame.addEventListener("load", __formResultHandler, false); 221 } 222 else if (obFrame.attachEvent) 223 { 224 obFrame.attachEvent("onload", __formResultHandler); 225 } 226 } 227 228 this.MigrateFormToAjax = function(obForm, handler) 229 { 230 if (!obForm) 231 return; 232 if (obForm.target && obForm.target.substring(0, 5) == 'AJAX') 233 return; 234 235 var obAJAXIndicator = document.createElement('INPUT'); 236 obAJAXIndicator.type = 'hidden'; 237 obAJAXIndicator.name = 'AJAX_CALL'; 238 obAJAXIndicator.value = 'Y'; 239
240 obForm.appendChild(obAJAXIndicator); 241 242 var frameName = 'AJAX_' + Math.round(Math.random() * 100000); 243 244 if (document.getElementById('frameName')) 245 var obFrame = document.getElementById('frameName'); 246 else 247 { 248 if (currentBrowserDetected == 'IE') 249 var obFrame = document.createElement('<iframe name="' + frameName + '"></iframe>'); 250 else 251 var obFrame = document.createElement('IFRAME'); 252 253 obFrame.style.display = 'none'; 254 obFrame.src = ''; 255 obFrame.id = frameName; 256 obFrame.name = frameName; 257 258 document.body.appendChild(obFrame); 259 } 260 261 obForm.target = frameName; 262 263 this.__migrateSetHandler(obForm, obFrame, handler); 264 } 265} 266 267var CPHttpRequest = new JCPHttpRequest(); 268 269var currentBrowserDetected = ""; 270if (window.opera) 271 currentBrowserDetected = "Opera"; 272else if (navigator.userAgent) 273{ 274 if (navigator.userAgent.indexOf("MSIE") != -1) 275 currentBrowserDetected = "IE"; 276 else if (navigator.userAgent.indexOf("Firefox") != -1) 277 currentBrowserDetected = "Firefox"; 278} 279 280
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.