1var a_ImageName = new Array(); 2var a_ImageDownloaded = new Array() 3var a_ProdURL = new Array() 4var a_StdCode = new Array() 5var a_MatchType = new Array() 6 7var LastId = 0; 8 9ImageObject = new Image(); 10ImageObject.src="/img/src/hourglass_small.gif" 11 12function DownloadImages() { 13 for (var k=0; k<a_ImageName.length-1; k++) { 14 if (a_ImageDownloaded[k] == false) { 15 ImageObject.src=a_ImageName[k] 16 a_ImageDownloaded[k] = true 17 } 18 } 19} 20 21function ProgressBar(yFlag) { 22 if (document.getElementById("divProgress")) { 23 if (yFlag) { 24 document.getElementById("divProgress").style.visibility = "visible"; 25 } 26 else { 27 document.getElementById("divProgress").style.visibility = "hidden"; 28 } 29 } 30} 31var ProgressBarId = 0; 32var MaxRecordsInTheDB = 10000; 33function GetNextPage() { 34 var currobj=document.Gallery 35 if (currobj.txtSearch.value.length > 0) { 36 37 CurrentPage = parseInt(currobj.CurrentPage.value) + 1 38 if (CurrentPage <= MaxPages) { 39 currobj.CurrentPage.value = CurrentPage 40 41 42 if (MaxRecordsInTheDB > LastMax) { 43 SendRequest() 44 } 45 if (MaxRecordsInTheDB <= LastMax) { 46 clearTimeout(TimeOutId); 47 48 } 49 else { 50 TimeOutId = setTimeout("GetNextPage()", 6000); 51 } 52 } 53 else { 54 clearTimeout(TimeOutId); 55 56 } 57 } 58} 59 60function SendRequest() { 61 var currobj=document.Gallery 62 var xparam; 63 var xrequesttype = "imagesearch" ; 64 65 var xtxtsearch = currobj.txtSearch.value.split(' ').join('%20'); 66 var xquicksearch = currobj.txtQuickSearch.value.split(' ').join('%20'); 67 var xcurrentpage = currobj.CurrentPage.value; 68 var xfree = currobj.free.value; 69 var xdept_id = currobj.dept_id.value; 70 var xshowrelevant = "checked"; 71 if (currobj.showrelevant) { 72 if (currobj.showrelevant.checked) { 73 xshowrelevant = currobj.showrelevant.value 74 } 75 else { 76 xshowrelevant = "" 77 } 78 } 79 var MaxProductsToShow = PageSize * MaxPages 80 xparam = MakeParam("requesttype;txtsearch;currentpage;free;dept_id;showrelevant;PageSize;MaxProductsToShow;txtQuickSearch", xrequesttype + ";" + xtxtsearch + ";" + xcurrentpage + ";" + xfree + ";" + GalleryDeptId + ";" + xshowrelevant + ";" + PageSize + ";" + MaxProductsToShow + ';' + xquicksearch) 81 82 83 84 if (window.location.href.indexOf("beta") != -1) {//try to check on beta,should use smartserach page 12/10/2014 85 xresp = CallASP("/xp/RequestProducts.asp", xparam) 86 } else { 87 xresp ='' 88 } 89 90 if (xresp.length <= 0) { 91 return; 92 } 93 else { 94 if (xresp.indexOf("Error#") >= 0) { 95 return; 96 } 97 else if (xresp.indexOf("False#") >= 0) { 98 return; 99 } 100 else if (xresp.indexOf("True#") >= 0) { 101 xresp = xresp.split('True#').join('') 102 if (xresp.length > 0) { 103 a_resp = xresp.split('|^|') 104 105 MaxRecordsInTheDB = a_resp[0].split('~') 106 var t_ImageName = a_resp[1].split('~') 107 var t_ImageDownloaded = a_resp[2].split('~') 108 var t_ProdURL = a_resp[3].split('~') 109 var t_StdCode = a_resp[4].split('~') 110 var t_MatchType = a_resp[5].split('~') 111 112 xMax = a_ImageName.length 113 for (var k=0; k<t_ImageName.length-1; k++) { 114 a_ImageName[xMax+k] = thumbnailImagePath + '/' + t_ImageName[k] 115 a_ImageDownloaded[xMax+k] = false 116 a_ProdURL[xMax+k] = t_ProdURL[k] 117 a_StdCode[xMax+k] = t_StdCode[k] 118 a_MatchType[xMax+k] = t_MatchType[k] 119 } 120 ShowImages() 121 if (parseInt(MaxRecordsInTheDB) == 0) { 122 ShowErrorMessage() 123 } 124 } 125 else { 126 //this may not be called at all 127 ShowErrorMessage() 128 } 129 } 130 } 131} 132 133function ShowErrorMessage() { 134 var currobj=document.Gallery 135 LastMax = 0 136 for (var k=1; k<=RowMax; k++) { 137 document.getElementById("divGallery" + k).innerHTML = "" 138 if (k == 1) { 139 var xmsg = "<font face=verdana size=3 color=#CC0000><br><b>Sorry!</b> We could not find any matching record for your search.<br>Please <b>check spelling</b> of your search.</font><br>" 140 if (currobj.showrelevant) { 141 if (currobj.showrelevant.checked) { 142 xmsg = xmsg + "<font face=verdana size=3 color=#CC0000>Or, you may also try unchecking the <b>Show Most Relevant</b> box.</font>" 143 } 144 } 145 document.getElementById("divGallery" + k).innerHTML = xmsg 146 } 147 } 148 149} 150function CallASP(yurl, yparam) { 151 var xmlhttp = false;
152 try { 153 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 154 } 155 catch (e) { 156 try { 157 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 158 } 159 catch (E) { 160 xmlhttp = false; 161 } 162 } 163 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 164 xmlhttp = new XMLHttpRequest(); 165 } 166 xmlhttp.open("POST", yurl, false); 167 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") //"text/xml" 168 xmlhttp.send(yparam) 169 170 if (xmlhttp.readyState==4) { 171 var xretstr = "" 172 if (xmlhttp.status==200) { 173 xretstr = xmlhttp.responseText; 174 } 175 else if (xmlhttp.status==404) { 176 xretstr = "" 177 } 178 else { 179 xretstr = "" 180 } 181 return xretstr; 182 } 183 return ""; 184} 185 186var SendRequestTimerId = 0 187function SendRequest_Async() { 188 var currobj=document.Gallery 189 var xparam; 190 var xrequesttype = "imagesearch" ; 191 192 var xtxtsearch = currobj.txtSearch.value.split(' ').join('%20'); 193 var xquicksearch = currobj.txtQuickSearch.value.split(' ').join('%20'); 194 var xcurrentpage = currobj.CurrentPage.value; 195 var xfree = currobj.free.value; 196 var xdept_id = currobj.dept_id.value; 197 var xshowrelevant = "checked"; 198 if (currobj.showrelevant) { 199 if (currobj.showrelevant.checked) { 200 xshowrelevant = currobj.showrelevant.value 201 } 202 else { 203 xshowrelevant = "" 204 } 205 } 206 var MaxProductsToShow = PageSize * MaxPages 207 xparam = MakeParam("requesttype;txtsearch;currentpage;free;dept_id;showrelevant;PageSize;MaxProductsToShow;txtQuickSearch", xrequesttype + ";" + xtxtsearch + ";" + xcurrentpage + ";" + xfree + ";" + GalleryDeptId + ";" + xshowrelevant + ";" + PageSize + ";" + MaxProductsToShow + ';' + xquicksearch) 208 209 if (window.location.href.indexOf("beta") != -1) {//try to check on beta,should use smartserach page 12/10/2014 210 CallASP("/xp/RequestProducts.asp", xparam) 211 } else { 212 213 } 214 215 SendRequestTimerId = setTimeout("TreatTheResponse()", 1000); 216} 217 218function TreatTheResponse_Async() { 219 alert("TreatTheResponse \n" + ResponseStr) 220 xresp = ResponseStr 221 if (xresp.length <= 0) { 222 223 SendRequestTimerId = setTimeout("TreatTheResponse()", 1000); 224 return; 225 } 226 else { 227 if (SendRequestTimerId > 0 ) { 228 clearTimeout(SendRequestTimerId) 229 } 230 ResponseStr = "" 231 if (xresp.indexOf("Error#") >= 0) { 232 return; 233 } 234 else if (xresp.indexOf("False#") >= 0) { 235 return; 236 } 237 else if (xresp.indexOf("True#") >= 0) { 238 xresp = xresp.split('True#').join('') 239 if (xresp.length > 0) { 240 a_resp = xresp.split('|^|') 241 242 MaxRecordsInTheDB = a_resp[0].split('~') 243 var t_ImageName = a_resp[1].split('~') 244 var t_ImageDownloaded = a_resp[2].split('~') 245 var t_ProdURL = a_resp[3].split('~') 246 var t_StdCode = a_resp[4].split('~') 247 var t_MatchType = a_resp[5].split('~') 248 249 xMax = a_ImageName.length 250 for (var k=0; k<t_ImageName.length-1; k++) { 251 a_ImageName[xMax+k] = thumbnailImagePath + '/' + t_ImageName[k] 252 a_ImageDownloaded[xMax+k] = false 253 a_ProdURL[xMax+k] = t_ProdURL[k] 254 a_StdCode[xMax+k] = t_StdCode[k] 255 a_MatchType[xMax+k] = t_MatchType[k] 256 } 257 ShowImages() 258 if (parseInt(MaxRecordsInTheDB) == 0) { 259 ShowErrorMessage() 260 } 261 } 262 else { 263 //this may not be called at all 264 ShowErrorMessage() 265 } 266 267 } 268 } 269 270} 271 272var ResponseStr = ""; 273function CallASP_Async(yurl, yparam) { 274 var xmlhttp = false; 275 try { 276 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 277 } 278 catch (e) { 279 try { 280 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 281 } 282 catch (E) { 283 xmlhttp = false; 284 } 285 } 286 if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 287 xmlhttp = new XMLHttpRequest(); 288 } 289 xmlhttp.open("POST", yurl, true); 290 xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") //"text/xml" 291 292 xmlhttp.onreadystatechange = 293 function () 294 { 295 if (xmlhttp.readyState==4) { 296 var xretstr = "" 297 if (xmlhttp.status==200) { 298 xretstr = xmlhttp.responseText; 299 } 300 else if (xmlhttp.status==404) { 301 xretstr = "" 302 } 303 else { 304 xretstr = "" 305 } 306 307 ResponseStr = xretstr 308 } 309 } 310 311 xmlhttp.send(yparam) 312 313} 314 315function MakeParam(snames, svalues) { 316 var xparam = ""; 317 var a_names, a_values; 318 if (snames.length > 0) { 319 a_names = snames.split(';') 320 a_values = svalues.split(';') 321 for (var k=0; k<a_names.length; k++) { 322 if (k > 0) { 323 xparam = xparam + "&" 324 } 325 xparam = xparam + a_names[k] + "=" + a_values[k] 326 } 327 } 328 return xparam; 329} 330 331var oXMLHTTP 332function ProductCallOut(stdcode, numberofproducts) { 333 var xprotocol; 334 if (location.protocol === 'https:') { 335 xprotocol = "https://"; 336 } else { 337 xprotocol = "http://"; 338 } 339 var sURL = xprotocol + HTTP_HOST + "/v2/product/xpcallout?ss=1&ShowMedResImage=1&stdcode=" + stdcode; 340 341 if (numberofproducts == 1){ 342 sURL = sURL + "&multiple=0"; 343 } else { 344 sURL = sURL + "&multiple=1"; 345 } 346 347 348 oXMLHTTP = null; 349 350 if (window.XMLHttpRequest){ 351 // code for Mozilla, etc. 352 oXMLHTTP = new XMLHttpRequest() 353 } else if (window.ActiveXObject){ 354 // code for IE 355 oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP"); 356 } 357 if (oXMLHTTP!=null){ 358 oXMLHTTP.onreadystatechange=state_Change; 359 oXMLHTTP.open("GET", sURL, false); 360 oXMLHTTP.send(null); 361 }else{ 362 363 } 364 365 ol_fgcolor="#FFFFFF"; 366 ol_bgcolor="#CCCCCC"; 367 ol_border=0; 368 369 ol_padxl = 0; 370 ol_padxr = 0; 371 ol_padyt = 0; 372 ol_padyb = 0;
373 o3_hauto = 1; 374 375 ol_delay=500; 376 return oXMLHTTP.responseText; 377} 378 379function state_Change(){ 380 if (oXMLHTTP.readyState==4){ // if xmlhttp shows "loaded" 381 if (oXMLHTTP.status==200){ // if "OK" 382 383 }else { 384 385 } 386 } 387} 388 389var RightScrollId = 0; 390var LeftScrollId = 0; 391 392function ScrollBigRight(yjump) { 393 document.getElementById("divGallery").scrollLeft = document.getElementById("divGallery").scrollLeft + yjump; 394 if (IsMouseDown) { 395 396 IsMouseHover = false; 397 } 398 if (IsMouseHover) { 399 RightScrollId = setTimeout("ScrollBigRight(" + yjump + ")", 10); 400 401 } 402} 403 404function ScrollBigLeft(yjump) { 405 document.getElementById("divGallery").scrollLeft = document.getElementById("divGallery").scrollLeft - yjump; 406 if (IsMouseDown) { 407 408 IsMouseHover = false; 409 } 410 if (IsMouseHover) { 411 LeftScrollId = setTimeout("ScrollBigLeft(" + yjump + ")", 10); 412 413 } 414 415} 416 417function ScrollRight() { 418 document.getElementById("divGallery").scrollLeft = document.getElementById("divGallery").scrollLeft + 60; 419} 420 421function ScrollLeft(ygotostart) { 422 if (ygotostart) { 423 document.getElementById("divGallery").scrollLeft = 0; 424 } 425 else { 426 document.getElementById("divGallery").scrollLeft = document.getElementById("divGallery").scrollLeft - 60; 427 } 428} 429 430var ns4dom = (document.layers)? true:false 431var ie4dom = (document.all)? true:false; 432var ns6dom = false 433 434startX=0 435startY=0 436endX=0 437endY=0 438 439IsMouseDown = false 440IsMouseHover = false 441 442var TimeOutId=0; 443function nmoveHandler(yevt) { 444 var xdom; 445 446 startX = endX 447 startY = endY 448 449 if (ns4dom || ns6dom) { 450 endX = yevt.pageX 451 endY = yevt.pageY 452 } 453 else { 454 endX = window.event.clientX 455 endY = window.event.clientY 456 } 457 458 if (IsMouseDown) { 459 if (endX < startX) { 460 ScrollLeft() 461 } 462 else if (endX > startX) { 463 ScrollRight() 464 } 465 466 } 467} 468 469function nupHandler(yevt) { 470 IsMouseDown = false 471} 472 473function ndownHandler(yevt) { 474 IsMouseDown = true 475 if (ns4dom || ns6dom) { 476 startX = yevt.pageX 477 startY = yevt.pageY 478 } 479 else { 480 startX = window.event.clientX 481 startY = window.event.clientY 482 } 483 endX = startX 484 endY = startY 485} 486 487var LastMax = 0 488function ShowImages() { 489 for (var k=LastMax; k<a_ImageName.length; k++) { 490 var xrowno = (k % RowMax) + 1 491 var xleft = k * 142 492 var xtop = 122 493 494 var xwidth = 126 495 var xheight = 142 496 497 onmouseoverstr = "onmouseover = \"return overlib(ProductCallOut(\'" + a_StdCode[k] + "\', 1), VAUTO,BACKGROUND,\'transparent\');\"" 498 onmouseoutstr = "onmouseout = \"return nd();\"" 499 500 var targetDiv = document.getElementById("divGallery" + xrowno) 501 var newDiv = document.createElement("SPAN"); 502 503 xBgColor = "#EEFFFF" //Cyan 504 xBorderColor = "#DDDDDD" //"#404080" 505 if (a_MatchType[k].toLowerCase() == "exact") { 506 xBgColor = "#FFFFFF" //Cream #FFFFDD 507 xBorderColor = "#DDDDDD" //"#804040" 508 } 509 510 511 newDiv.innerHTML = "<table width=" + xwidth + " height=" + xheight + " bgColor=" + xBgColor + " cellpadding=0 cellspacing=0 align=left style='border-width:1; border-right-width:0; border-style:dotted; border-color:" + xBorderColor + ";'><tr><td width=" + xwidth + " align=center class=body8 valign=bottom><a href='" + a_ProdURL[k] + "'><img src='" + a_ImageName[k] + "' border='0' " + onmouseoverstr + " " + onmouseoutstr + "'></a><div class=body7 style='margin:1px 0px 3px 0px;'>" + a_StdCode[k] + "</div></td></tr></table>"; 512 newDiv.width = xwidth; 513 newDiv.height = xheight; 514 515 targetDiv.appendChild(newDiv); 516 517 document.getElementById("GalleryStatus").innerHTML = "Total Images Displayed: <b>" + (k + 1) + "</b>" 518 LastMax = k+1 519 } 520} 521function SubmitNow() { 522 var currobj=document.Gallery 523 524 ScrollLeft(true); 525 526 currobj.CurrentPage.value = 0 527 a_ImageName.length = 0 528 a_ImageDownloaded.length = 0 529 a_ProdURL.length = 0 530 a_StdCode.length = 0 531 a_MatchType.length = 0 532 533 LastMax = 0 534 for (var k=1; k<=RowMax; k++) { 535 document.getElementById("divGallery" + k).innerHTML = "" 536 } 537 LastSearch = currobj.txtSearch.value 538 MaxRecordsInTheDB = 10000 539 540 TimeOutId = setTimeout("GetNextPage()", 1000); 541 542} 543
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.