1function displayStatus() { 2 if (strStatus != "") alert(strStatus); 3} 4 5function MM_swapImgRestore() { // v3.0 6 7 var i, x, a = document.MM_sr; 8 9 for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc; 10} 11 12function MM_preloadImages() { // v3.0 13 14 var d = document; 15 16 if (d.images) { 17 if (!d.MM_p) d.MM_p = new Array(); 18 19 var i, j = d.MM_p.length, a = MM_preloadImages.arguments; 20 21 for (i = 0; i < a.length; i++) if (a[i].indexOf("#") != 0) { 22 d.MM_p[j] = new Image; 23 d.MM_p[j++].src = a[i]; 24 } 25 } 26} 27 28function MM_findObj(n, d) { //v3.0 29 30 var p, i, x; 31 32 if (!d) d = document; 33 if ((p = n.indexOf("?")) > 0 && parent.frames.length) { 34 d = parent.frames[n.substring(p + 1)].document; 35 n = n.substring(0, p); 36 } 37 if (!(x = d[n]) && d.all) x = d.all[n]; 38 for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n]; 39 for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document); 40 return x; 41} 42 43function MM_swapImage() { //v3.0 44 45 var i, j = 0, x, a = MM_swapImage.arguments; 46 47 document.MM_sr = new Array; 48 for (i = 0; i < (a.length - 2) ; i += 3) if ((x = MM_findObj(a[i])) != null) { 49 document.MM_sr[j++] = x; 50 if (!x.oSrc) x.oSrc = x.src; 51 x.src = a[i + 2]; 52 } 53} 54 55function dialogShow(strMessage) { 56 57 strMessage = String(strMessage); 58 59 if (strMessage.indexOf("<") == -1) { 60 strMessage = strMessage.replace(/\n/gi, "<br>"); 61 } 62 63 strMessage = "<table style=\"width: 100%; min-height: 100px\">" + 64 "<tr>" + 65 "<td style=\"height: 100%; text-align: center\">" + strMessage + "</td>" + 66 "</tr>" + 67 "</table>"; 68 69 document.getElementById("Alert").innerHTML = strMessage; 70 71 $("#Alert").dialog({ resizable: true, modal: true, show: { effect: "fade", duration: 200 } }); 72} 73 74// This function returns the screen postion on the calling object. 75function elementPos(strElement, strPos) { 76 77 var intPos = 0; 78 79 obj = document.getElementById(strElement); 80 81 if (!obj) return 0; 82 83 if (document.getBoxObjectFor) { 84 85 var bo = document.getBoxObjectFor(obj); 86 87 if (strPos == "Left") { 88 intPos = bo.x; 89 } else if (strPos == "Right") { 90 intPos = bo.x + bo.width; 91 } else if (strPos == "Top") { 92 intPos = bo.y; 93 } else { 94 intPos = bo.y + bo.height; 95 } 96 97 } else { 98 if (obj.getBoundingClientRect) { 99 100 var rect = obj.getBoundingClientRect(); 101 102 if (strPos == "Left") { 103 intPos = rect.left; 104 } else if (strPos == "Right") { 105 intPos = rect.right; 106 } else if (strPos == "Top") { 107 intPos = rect.top + document.documentElement.scrollTop; 108 } else { 109 intPos = rect.bottom + document.documentElement.scrollTop; 110 } 111 } else if (obj.offsetParent != null) { 112 113 var intHeight = obj.offsetHeight; 114 var intWidth = obj.offsetWidth; 115 116 while (obj) { 117 if (strPos == "Left") { 118 intPos += obj.offsetLeft; 119 } else if (strPos == "Right") { 120 intPos += obj.offsetLeft + intWidth; 121 } else if (strPos == "Top") { 122 intPos += obj.offsetTop; 123 } else { 124 intPos += obj.offsetTop + intHeight; 125 } 126 obj = obj.offsetParent; 127 } 128 } 129 } 130 return intPos; 131} 132 133// This function checks to see if a supplied email address is valid. 134function emailCheck(strEmail) { 135 136 var checkTLD = 1; 137 //var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|kiwi)$/; 138 var emailPat = /^(.+)@(.+)$/; 139 var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; 140 var validChars = "\[^\\s" + specialChars + "\]"; 141 var quotedUser = "(\"[^\"]*\")"; 142 var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; 143 var atom = validChars + '+'; 144 var word = "(" + atom + "|" + quotedUser + ")"; 145 var userPat = new RegExp("^" + word + "(\\." + word + ")*$"); 146 var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$"); 147 var matchArray = strEmail.toLowerCase().match(emailPat); 148 149 if (strEmail == "") return true; 150 151 if (matchArray == null) return false; 152 153 var user = matchArray[1]; 154 var domain = matchArray[2]; 155 156 for (i = 0; i < user.length; i++) { 157 if (user.charCodeAt(i) > 127) return false; 158 } 159 160 for (i = 0; i < domain.length; i++) { 161 if (domain.charCodeAt(i) > 127) return false; 162 } 163 164 if (user.match(userPat) == null) return false; 165 166 var IPArray = domain.match(ipDomainPat); 167 168 if (IPArray != null) { 169 for (var i = 1; i <= 4; i++) { 170 if (IPArray[i] > 255) return false; 171 } 172 return true; 173 } 174 175 var atomPat = new RegExp("^" + atom + "$"); 176 var domArr = domain.split("."); 177 var len = domArr.length; 178 179 for (i = 0; i < len; i++) { 180 if (domArr[i].search(atomPat) == -1) return false; 181 } 182 //if (checkTLD && domArr[domArr.length - 1].length != 2 && domArr[domArr.length - 1].search(knownDomsPat) == -1) return false; 183 184 if (len < 2) return false; 185 186 return true; 187} 188 189// Checks the specified password for strength. 190function validatePassword(passwordText) 191{ 192 var strTemp = ""; 193 var intUppercase = 0; 194 var intLowercase = 0; 195 var intNumber = 0; 196 var intSpecial = 0; 197 198 for (var intCount = 0; intCount < passwordText.length; intCount++) { 199 200 strTemp = passwordText.substring(intCount, intCount + 1); 201 202 if ("ABCDEFGHIJKLMNOPQRSTUvWXYZ".includes(strTemp) == true) { 203 intUppercase = 1; 204 } 205 206 if ("abcdefghijklmnopqurstuvwxyz".includes(strTemp) == true) { 207 intLowercase = 1; 208 } 209 210 if ("0123456789".includes(strTemp) == true) { 211 intNumber = 1; 212 } 213 214 if ("(~!@#$%^&*()_+|[]'\\:;\"<>,./?)".includes(strTemp) == true) { 215 intSpecial = 1; 216 } 217 } 218 219 return intUppercase + intLowercase + intNumber + intSpecial; 220} 221 222function DrawCaptcha() { 223 224 var a = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 225 var b = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 226 var c = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 227 var d = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 228 var e = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 229 var f = String.fromCharCode(Math.ceil(Math.random() * 58) + 32); 230 231 var code = a + b + c + d + e + f; 232 233 if (document.getElementById("Captcha") != null) { 234 document.getElementById("Captcha").value = code; 235 document.getElementById("CaptchaInput").value = ""; 236 } 237} 238 239// Validate the Entered input aganist the generated security code function. 240function ValidCaptcha() { 241 var str1 = removeSpaces(document.getElementById('Captcha').value).toLowerCase(); 242 var str2 = removeSpaces(document.getElementById('CaptchaInput').value).toLowerCase(); 243 244 if (str1 == str2) return true; 245 246 return false; 247} 248 249// Encodes the supplied value so it is safe to use in form submissions. 250function htmlEncode(value) { 251 return $('<div/>').text(value).html().replace(/\"/g, """); 252} 253 254// Performs the opposite of the encode function. 255function htmlDecode(value) { 256 return $('<div/>').html(value).text().replace(/"/g, "\""); 257} 258 259// Remove the spaces from the entered and generated code. 260function removeSpaces(string) { 261 return string.split(' ').join(''); 262} 263 264// Check the length and lines of text for a form element. 265function checkContent(objField, intLength, intLines) { 266 var blnOK = true; 267 268 if (intLength > 0) { 269 if (objField.value.length >= intLength) { 270 blnOK = false; 271 } 272 } 273 if (intLines > 0) { 274 if (objField.value.split("\n").length > intLines) { 275 blnOK = false; 276 } 277 } 278 return blnOK; 279} 280 281// This function returns part of the cookie object. 282function getCookieVal(offset) { 283 var endstr = document.cookie.indexOf(";", offset); 284 285 if (endstr == -1) endstr = document.cookie.length; 286 287 return unescape(document.cookie.substring(offset, endstr)); 288} 289 290// function to retrieve a cookie. 291function getCookie(name) { 292 293 var arg = name + "="; 294 var alen = arg.length; 295 var clen = document.cookie.length; 296 var i = 0; 297 298 while (i < clen) { 299 var j = i + alen; 300 if (document.cookie.substring(i, j) == arg) return getCookieVal(j); 301 302 i = document.cookie.indexOf(" ", i) + 1; 303 304 if (i == 0) break; 305 } 306 return null; 307} 308 309// This function allows the language to be set from with the page's content. 310function setLanguage(strLanguage) { 311 312 var strContent = document.getElementById("MoSTContent").innerHTML; 313 314 // Relaod the page to set the selected language and display it. 315 if (window.location.href.indexOf("LANG=") > -1) {
316 window.location.href = window.location.href.replace("LANG=" + getCookie("MoSTLanguage"), "LANG=" + strLanguage); 317 } else { 318 window.location.href = window.location.href + "?LANG=" + strLanguage; 319 } 320} 321 322// This function is called from the body tag and is used for displaying the correct language. 323function showLanguage(node) { 324 325 if (document.getElementById("MoSTContent") != null) { 326 327 var strContent = document.getElementById("MoSTContent").innerHTML; 328 329 // If the page uses language blocks, then show the correct language. 330 if (strContent.indexOf("MoSTLang_") > 0) { 331 332 // Get the current language setting. 333 var strLanguage = getCookie("MoSTLanguage"); 334 335 // If no language is selected then set it to English. 336 if (strLanguage == null) strLanguage = "English"; 337 338 // Loop through all the page objects it find the language blocks. 339 for (var i = 0; i < node.childNodes.length; i++) { 340 if (node.childNodes[i].id != null) { 341 342 // If the current object contains a reference to the current language then display it. 343 if (node.childNodes[i].id.indexOf(strLanguage) > -1) { 344 document.getElementById(node.childNodes[i].id).style.display = "inline"; 345 } else { 346 347 // Reset all other languages so they aren't displayed. 348 if (node.childNodes[i].id.indexOf("MoSTLang_") > -1 && node.childNodes[i].id.indexOf(strLanguage) == -1) { 349 document.getElementById(node.childNodes[i].id).style.display = "none"; 350 } 351 } 352 } 353 354 // Call the function again to find all object within the current object. 355 showLanguage(node.childNodes[i]); 356 } 357 } 358 } 359} 360 361// Pass the page content into the printable version of the DIV tag. 362function printVersion() { 363 364 var strContent = document.getElementById("MoSTContent").innerHTML; 365 366 // You can't have duplicate ID's, so change them to be unique for language blocks. 367 strContent = strContent.replace(/ name=\"/gi, " name=\"Print"); 368 strContent = strContent.replace(/ id=\"/gi, " id=\"Print"); 369 strContent = strContent.replace(/\n/g, "").replace(/\r/g, ""); 370 strContent = strContent.replace(/<script([^>]*)>.*?<\/script>/gi, ""); 371 strContent = strContent.replace(/rel=lightbox\[Images\]/gi, ""); 372 373 document.getElementById("MoSTPrintContent").innerHTML = strContent; 374} 375 376// Resize the window to fit the content. 377function resizeMe() { 378 379 var intWidth = document.body.scrollWidth + 70; 380 var intHeight = document.body.scrollHeight + 70; 381 var intTop = (screen.height / 2) - (intHeight / 2) - 100; 382 var intLeft = (screen.width / 2) - (intWidth / 2); 383 384 if (screen.width < intWidth) intWidth = screen.width - 100; 385 if (screen.height < intHeight) intHeight = screen.height - 150; 386 if (intTop < 10) intTop = 10; 387 388 self.resizeTo(intWidth, intHeight); 389 self.moveTo(intLeft, intTop); 390} 391 392function fixURL(strElement) { 393 394 var objElement = document.getElementById(strElement); 395 var strDesc = objElement.innerHTML; 396 var strURL = objElement.href; 397 398 if (strURL.indexOf("mailto:") == -1) { 399 400 var strChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 401 402 var strFix = ""; 403 404 strURL = strURL.substring(strURL.indexOf("#") + 1) 405 406 for (var i = 0; i < strURL.length; i++) { 407 408 strTemp = strURL.substring(i, i + 1); 409 410 if (i / 2 == parseInt(i / 2)) { 411 strFix += strTemp; 412 if (strChars.indexOf(strTemp) != -1) strFix = strFix.replace(strTemp, "@"); 413 } 414 } 415 objElement.href = "mailto:" + strFix; 416 objElement.innerHTML = strDesc; 417 } 418} 419 420function formatCurrency(dblAmount) { 421 422 dblAmount = dblAmount.toString().replace("/\$|\,/g", ''); 423 424 if (isNaN(dblAmount)) { 425 dblAmount = "0"; 426 } 427 428 blnSign = (dblAmount == (dblAmount = Math.abs(dblAmount))); 429 430 dblAmount = Math.floor(dblAmount * 100 + 0.50000000001); 431
432 intCents = dblAmount % 100; 433 434 dblAmount = Math.floor(dblAmount / 100).toString(); 435 436 if (intCents < 10) { 437 intCents = "0" + intCents; 438 } 439 440 for (var i = 0; i < Math.floor((dblAmount.length - (1 + i)) / 3) ; i++) { 441 dblAmount = dblAmount.substring(0, dblAmount.length - (4 * i + 3)) + ',' + dblAmount.substring(dblAmount.length - (4 * i + 3)); 442 } 443 444 return (((blnSign) ? '' : '-') + dblAmount + '.' + intCents); 445} 446 447function topLayer() { 448 449 var intMaxZindex = 0; 450 451 var objDivs = document.getElementsByTagName("DIV") 452 453 for (var i = 0; i < objDivs.length; i++) { 454 455 if (intMaxZindex < objDivs[i].style.zIndex) intMaxZindex = objDivs[i].style.zIndex + 1; 456 } 457 458 return intMaxZindex; 459} 460 461function dialogOpen(strWindow) { 462 463 if (window.top != window.self) { 464 465 var strContent = strWindow + "Content"; 466 467 parent.$("#" + strWindow).dialog("open"); 468 469 parent.$("#" + strContent).css("width", "0"); 470 parent.$("#" + strContent).css("height", "0"); 471 472 parent.$("#" + strWindow).dialog("option", "width", 0); 473 parent.$("#" + strWindow).dialog("option", "height", 0); 474 475 parent.$("#" + strContent).css("width", $("body").width() + "px"); 476 parent.$("#" + strContent).css("min-width", "calc(100vw - 50%)"); 477 parent.$("#" + strContent).css("max-width", "calc(100vw - 50px)"); 478 parent.$("#" + strContent).css("height", $(document).height() + "px"); 479 480 parent.$("#" + strWindow).dialog("option", "width", $("body").width() + 40); 481 parent.$("#" + strWindow).dialog("option", "height", $(document).height() + 80); 482 483 dialogCenter(strWindow); 484 } 485} 486 487function dialogCenter(strWindow) { 488 489 if (navigator.appVersion.indexOf("MSIE ") != -1) { 490 strVersion = navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE ") + 5); 491 strVersion = strVersion.substring(0, strVersion.indexOf(".")); 492 493 if (Number(strVersion) < 10) { 494 var intTop = (parent.document.body.scrollHeight / 4) - (document.body.scrollHeight / 2) - 20; 495 var intLeft = (parent.document.body.scrollWidth / 2) - (document.body.scrollWidth / 2) - 10; 496 497 if (intTop < 0) { 498 499 intTop = (parent.document.body.scrollHeight / 2) - (document.body.scrollHeight / 2) - 20; 500 } 501 502 if (intTop > 0 && intLeft > 0) { 503 504 parent.$("." + strWindow).css("top", intTop + "px"); 505 parent.$("." + strWindow).css("left", intLeft + "px"); 506 } 507 } 508 } else { 509 510 parent.$("#" + strWindow).dialog("option", "position", "center"); 511 } 512} 513 514function renderControls() { 515 try { 516 $(".MoSTMenu").menu(); 517 } 518 catch (e) { 519 } 520 521 try { 522 $(".MoSTNumericField").spinner({ 523 numberFormat: "n" 524 }); 525 } 526 catch (e) { 527 } 528 529 try { 530 $(".MoSTDatePicker").datepicker({ 531 dateFormat: "d M yy", 532 changeMonth: true, 533 changeYear: true, 534 yearRange: "1900:2078" 535 }); 536 } 537 catch (e) { 538 } 539} 540 541$(function () { 542 renderControls(); 543 $("input[type='text']").keyup(function (e) { 544 var $this = $(this); 545 $this.val($this.val().replace(/[<>]/g, "")); 546 }); 547 $("input[type='text']").on("paste", function (e) { 548 var $this = $(this); 549 $this.val($this.val().replace(/[<>]/g, "")); 550 }); 551 $("textarea").keyup(function (e) { 552 var $this = $(this); 553 $this.val($this.val().replace(/[<>]/g, "")); 554 }); 555 $("textarea").on("paste", function (e) { 556 var $this = $(this); 557 $this.val($this.val().replace(/[<>]/g, "")); 558 }); 559});
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.