1var debug = false; 2/** 3<summary> 4Browser Compatability function. 5Returns the correct XMLHttpRequest 6depending on the current browser. 7</summary> 8*/ 9function GetXmlHttp() { 10 var xmlhttp = false; 11 if (window.XMLHttpRequest) 12 { 13 xmlhttp = new XMLHttpRequest() 14 } 15 else if (window.ActiveXObject)// code for IE 16 { 17 try 18 { 19 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP") 20 } catch (e) { 21 try 22 { 23 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP") 24 } catch (E) { 25 xmlhttp=false 26 } 27 } 28 } 29 return xmlhttp; 30} 31 32function getDOMObject() { 33 if(document.implementation && document.implementation.createDocument){ 34 var xmlDoc=document.implementation.createDocument("","",null); 35 } 36 else{ 37 var xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); 38 xmlDoc.async="false"; 39 } 40 return xmlDoc; 41} 42/** 43<summary> 44Gets the response stream from the passed url, and then calls 45 the callbackFuntion passing the response and the div_ids. 46</summary> 47<param name="url">The url to make the request 48 to get the response data.</param> 49<param name="callbackFunction">The function to call after 50the response has been recieved. 51The response <b>must</b> always 52be the first argument to the function.</param> 53<param name="params"> (optional) Any other parameters 54you want to pass to the functions. 55(Note: only constants/strings/globals can be passed 56 as params, most variables will be out of scope.) 57</param> 58<example> 59 <code> 60PassAjaxResponseToFunction('?getsomehtml=1', 61 'FunctionToHandleTheResponse', 62 "\'div1\',\'div2\',\'div3\''); 63 64function FunctionToHandleTheResponse(response, d1, d2, d3){ 65 var data = response.split(';'); 66 document.getElementById(d1).innerHTML = data[0]; 67 document.getElementById(d2).innerHTML = data[1]; 68 document.getElementById(d3).innerHTML = data[2]; 69} 70 </code> 71</example> 72*/ 73 74function PassAjaxResponseToFunction(url, callbackFunction, params) { 75 var xmlhttp = new GetXmlHttp(); 76 //now we got the XmlHttpRequest object, send the request. 77 if (xmlhttp) { 78 xmlhttp.onreadystatechange = function () { 79 if (xmlhttp && xmlhttp.readyState==4) {//we got something back.. 80 if (xmlhttp.status==200) { 81 var response = xmlhttp.responseText; 82 var functionToCall = callbackFunction + '(response,'+params+')'; 83 if(debug) { 84 alert(response); 85 alert(functionToCall); 86 } 87 eval(functionToCall); 88 } else 89 if(debug) { document.write(xmlhttp.responseText); } 90 } 91 } 92 xmlhttp.open("GET",url,true); 93 xmlhttp.send(null); 94 } 95} 96 97 98/** 99<summary> 100Sets the innerHTML property of obj_id with the response from the passed url. 101</summary> 102<param name="url">The url to make the request 103to get the response data.</param> 104<param name="obj_id">The object or the id of 105the object to set the innerHTML for.</param> 106*/ 107function SetInnerHTMLFromAjaxResponse(url, obj_id) { 108 var xmlhttp = new GetXmlHttp(); 109 //now we got the XmlHttpRequest object, send the request. 110 if (xmlhttp) { 111 xmlhttp.onreadystatechange = function () { 112 if (xmlhttp && xmlhttp.readyState==4) {//we got something back.. 113 if (xmlhttp.status==200) { 114 if(debug) { 115 alert(xmlhttp.responseText); 116 } 117 if(typeof obj_id == 'object') { 118 119 obj_id.innerHTML = xmlhttp.responseText; 120 } 121 else { 122 if (document.getElementById(obj_id)) 123 document.getElementById(obj_id).innerHTML = xmlhttp.responseText; 124 } 125 } else 126 if(debug){ document.Write(xmlhttp.responseText); } 127 } 128 } 129 130 xmlhttp.open("GET",url,true); 131 xmlhttp.send(null); 132 } 133} 134 135/** 136<summary> 137Sets the innerHTML property of obj_id with the response from the passed url. 138</summary> 139<param name="url">The url to make the request 140to get the response data.</param> 141<param name="obj_id">The object or the id of 142the object to set the innerHTML for.</param> 143*/ 144function SetInnerHTMLFromAjaxResponse_WithXSL(url, obj_id, XSLfile) { 145 var xmlhttp = new GetXmlHttp(); 146 //now we got the XmlHttpRequest object, send the request. 147 if (xmlhttp) { 148 xmlhttp.onreadystatechange = function () { 149 if (xmlhttp && xmlhttp.readyState==4) {//we got something back.. 150 if (xmlhttp.status==200) { 151 if(debug) { 152 alert(xmlhttp.responseText); 153 } 154 155 var result = TransformXMLwithXSL(xmlhttp,XSLfile) 156 FillDiv(obj_id,result) 157 158 } else 159 if(debug){ document.Write(xmlhttp.responseText); } 160 } 161 } 162 xmlhttp.open("GET",url,true); 163 xmlhttp.send(null); 164 } 165} 166 167function FillDiv(obj_id, result){ 168 if(document.implementation && document.implementation.createDocument){ 169 if(typeof obj_id == 'object') 170 obj_id.appendChild(result); 171 else 172 document.getElementById(obj_id).appendChild(result); 173 } 174 else{ 175 if(typeof obj_id == 'object') 176 obj_id.innerHTML=result; 177 else 178 document.getElementById(obj_id).innerHTML=result; 179 } 180} 181 182 183function TransformXMLwithXSL(xmlData, XSLfile){ 184 if(document.implementation && document.implementation.createDocument){
185 // *** Mozilla 186 var xsltProcessor = new XSLTProcessor(); 187 // *** load the XSL file 188 var myXMLHTTPRequest = new XMLHttpRequest(); 189 myXMLHTTPRequest.open("GET", xslFile, false); 190 myXMLHTTPRequest.send(null); 191 // *** get the XML document 192 xslStylesheet = myXMLHTTPRequest.responseXML; 193 xsltProcessor.importStylesheet(xslStylesheet); 194 // *** load the xml file 195 var xmlSource = xmlData.responseXML; 196 // *** transform 197 var resultDocument = xsltProcessor.transformToFragment(xmlSource, document); 198 return resultDocument; 199 } 200 else if(window.ActiveXObject){ 201 // *** IE 202 // *** Load XML 203 xml = new ActiveXObject("MSXML2.DOMDocument"); 204 xml.async = false 205 xml.load(xmlData.responseXML) 206 // *** Load XSL 207 xsl = new ActiveXObject("MSXML2.DOMDocument"); 208 xsl.async = false 209 xsl.load(xslFile) 210 // *** Transform 211 return xml.transformNode(xsl); 212 } 213 else{ 214 // *** Browser unknown 215 //alert("Browser unknown"); 216 } 217} 218 219/** 220<summary> 221Sets the value of javascript varialble with the response from the passed url. 222</summary> 223<param name="url">The url to make the request 224to get the response data.</param> 225<param name="Variable">The object or the id of the object to set the innerHTML for.</param> 226to be finished 227*/ 228function SetTextFromAjaxResponse(url, jsVariable) { 229 var xmlhttp = new GetXmlHttp(); 230 //now we got the XmlHttpRequest object, send the request. 231 if (xmlhttp) { 232 xmlhttp.onreadystatechange = function () { 233 if (xmlhttp && xmlhttp.readyState==4) {//we got something back.. 234 if (xmlhttp.status==200) { 235 if(debug) { 236 alert(xmlhttp.responseText); 237 } 238 239 eval(jsVariable +"='"+ xmlhttp.responseText +"'" ); 240 241 } else 242 if(debug){ document.Write(xmlhttp.responseText); } 243 } 244 } 245 xmlhttp.open("GET",url,true); 246 xmlhttp.send(null); 247 } 248} 249 250function SendAjaxRequest(url) { 251 var xmlhttp = new GetXmlHttp(); 252 //now we got the XmlHttpRequest object, send the request. 253 if (xmlhttp) { 254 xmlhttp.open("GET",url,true); 255 xmlhttp.send(null); 256 } 257} 258 259 260function SendPostAjaxRequest(url,str,callbackFunction) { 261 /*var xmlHttp = new GetXmlHttp(); 262 //now we got the XmlHttpRequest object, send the request. 263 if (xmlHttp) { 264 265 xmlHttp.onreadystatechange = function () { 266 if (xmlHttp && xmlHttp.readyState==4) {//we got something back.. 267 if (xmlHttp.status==200) { 268 if(debug) { 269 alert(xmlHttp.responseText); 270 } 271 eval(callbackFunction); 272 } 273 else 274 if(debug){ document.Write(xmlHttp.responseText); } 275 } 276 } 277 278 */ 279 280 $.post( url + '&' + str , function (data) { 281 eval(callbackFunction); 282 }); 283 284 //$.post(url); 285 /* 286 xmlHttp.open("POST",url,true); 287 xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 288 xmlHttp.send(str); 289 290 }*/ 291} 292 293 294function addme_cart_ajax(pid, pip_str, pip_prices, pip_ids, quan, numOfItems, ItemPromotionIdentStr, BuildComputerItems, CartParamsStr) { 295 296 if (pip_str == undefined) { 297 pip_str = ""; 298 pip_prices = ""; 299 pip_ids = ""; 300 301 } 302 if (CartParamsStr == undefined) 303 { CartParamsStr = ""; } 304 305 if (ItemPromotionIdentStr == undefined) 306 { ItemPromotionIdentSt = ""; } 307 308 if (BuildComputerItems == undefined) 309 { BuildComputerItems = ""; } 310 311 if (quan == undefined) 312 { quan = ""; } 313 314 315 316 if (numOfItems == undefined || numOfItems == 0) 317 { numOfItems = ""; } 318 319 320 321 var URL = "/CartLogic.asp?Ajax=1" 322 var strBody = "pid=" + pid + "&pip_str=" + pip_str + "&pip_prices=" + pip_prices + "&pip_ids=" + pip_ids + "&quan=" + quan + "&RequestGiftInfo=" + ItemPromotionIdentStr + "&m=" + numOfItems + "&BuildComputerItems=" + BuildComputerItems + "&CartParams=" + CartParamsStr; 323 324 var responsePost = SendPostAjaxRequest(URL, strBody, "Ajax_updateCartInfo()"); 325 326 327 328} 329 330 331 332 333 334function removeAjaxDivNote() { 335 try { 336 337 var d = document.getElementById('MainWrapDiv'); 338 var olddiv = document.getElementById("AddToCartAjaxDivNote"); 339 d.removeChild(olddiv); 340 } 341 catch (e) { } 342 343} 344 345 346function showdeadcenterdiv(divid) { 347 var scrolledX, scrolledY; 348 if (self.pageYOffset) { 349 scrolledX = self.pageXOffset; 350 scrolledY = self.pageYOffset; 351 } else if (document.documentElement && document.documentElement.scrollTop) { 352 scrolledX = document.documentElement.scrollLeft; 353 scrolledY = document.documentElement.scrollTop; 354 } else if (document.body) { 355 scrolledX = document.body.scrollLeft; 356 scrolledY = document.body.scrollTop; 357 } 358 var centerX, centerY;
359 if (self.innerHeight) { 360 centerX = self.innerWidth; 361 centerY = self.innerHeight; 362 } else if (document.documentElement && document.documentElement.clientHeight) { 363 centerX = document.documentElement.clientWidth; 364 centerY = document.documentElement.clientHeight; 365 } else if (document.body) { 366 centerX = document.body.clientWidth; 367 centerY = document.body.clientHeight; 368 } 369 var leftOffset = scrolledX + (centerX) / 2; 370 var topOffset = scrolledY + (centerY) / 2; 371 var o = document.getElementById(divid); 372 var r = o.style; 373 r.position = 'absolute'; 374 r.top = topOffset + 'px'; 375 r.left = leftOffset + 'px'; 376 r.display = "block"; 377} 378 379 380 381 382
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.