1//Cache the images used by the application: 2 3//Text menu images: 4var _agentsOut = new Image(75, 48); 5var _agentsOver = new Image(75, 48); 6var _statutesOut = new Image(75, 48); 7var _statutesOver = new Image(75, 48); 8var _linksOut = new Image(65, 48); 9var _linksOver = new Image(65, 48); 10var _contactOut = new Image(95, 48); 11var _contactOver = new Image(95, 48); 12var _faqOut = new Image(65, 48); 13var _faqOver = new Image(65, 48); 14 15_agentsOut.src = "images/siteskin/menu/agents_out.png"; 16_agentsOver.src = "images/siteskin/menu/agents_over.png"; 17_statutesOut.src = "images/siteskin/menu/statutes_out.png"; 18_statutesOver.src = "images/siteskin/menu/statutes_over.png"; 19_linksOut.src = "images/siteskin/menu/links_out.png"; 20_linksOver.src = "images/siteskin/menu/links_over.png"; 21_contactOut.src = "images/siteskin/menu/contact_out.png"; 22_contactOver.src = "images/siteskin/menu/contact_over.png"; 23_faqOut.src = "images/siteskin/menu/faq_out.png"; 24_faqOver.src = "images/siteskin/menu/faq_over.png"; 25 26//Icon menu images: 27var _homeOut = new Image(50, 48); 28var _homeOver = new Image(50, 48); 29var _emailOut = new Image(50, 48); 30var _emailOver = new Image(50, 48); 31var _sitemapOut = new Image(50, 48); 32var _sitemapOver = new Image(50, 48); 33var _raiOut = new Image(50, 48); 34var _raiOver = new Image(50, 48); 35 36_homeOut.src = "images/siteskin/menu/home_out.png"; 37_homeOver.src = "images/siteskin/menu/home_over.png"; 38_emailOut.src = "images/siteskin/menu/email_out.png"; 39_emailOver.src = "images/siteskin/menu/email_over.png"; 40_sitemapOut.src = "images/siteskin/menu/sitemap_out.png"; 41_sitemapOver.src = "images/siteskin/menu/sitemap_over.png"; 42_raiOut.src = "images/siteskin/menu/rai_out.png"; 43_raiOver.src = "images/siteskin/menu/rai_over.png"; 44 45//Application buttons: 46var _contactButtonOut = new Image(118, 24); 47var _contactButtonOver = new Image(118, 24); 48var _contactButtonDown = new Image(118, 24); 49var _loginButtonOut = new Image(118, 24); 50var _loginButtonOver = new Image(118, 24); 51var _loginButtonDown = new Image(118, 24); 52var _sendButtonOut = new Image(118, 24); 53var _sendButtonOver = new Image(118, 24); 54var _sendButtonDown = new Image(118, 24); 55var _sendEmailButtonOut = new Image(118, 24); 56var _sendEmailButtonOver = new Image(118, 24); 57var _sendEmailButtonDown = new Image(118, 24); 58var _submitButtonOut = new Image(118, 24); 59var _submitButtonOver = new Image(118, 24); 60var _submitButtonDown = new Image(118, 24); 61var _submitResponseButtonOut = new Image(118, 24); 62var _submitResponseButtonOver = new Image(118, 24); 63var _submitResponseButtonDown = new Image(118, 24); 64var _submitReviewButtonOut = new Image(118, 24); 65var _submitReviewButtonOver = new Image(118, 24); 66var _submitReviewButtonDown = new Image(118, 24); 67 68_contactButtonOut.src = "images/siteskin/buttons/button_contact_out.png"; 69_contactButtonOver.src = "images/siteskin/buttons/button_contact_over.png"; 70_contactButtonDown.src = "images/siteskin/buttons/button_contact_down.png"; 71_loginButtonOut.src = "images/siteskin/buttons/button_login_out.png"; 72_loginButtonOver.src = "images/siteskin/buttons/button_login_over.png"; 73_loginButtonDown.src = "images/siteskin/buttons/button_login_down.png"; 74_sendButtonOut.src = "images/siteskin/buttons/button_send_out.png"; 75_sendButtonOver.src = "images/siteskin/buttons/button_send_over.png"; 76_sendButtonDown.src = "images/siteskin/buttons/button_send_down.png"; 77_sendEmailButtonOut.src = "images/siteskin/buttons/button_send_email_out.png"; 78_sendEmailButtonOver.src = "images/siteskin/buttons/button_send_email_over.png"; 79_sendEmailButtonDown.src = "images/siteskin/buttons/button_send_email_down.png"; 80_submitButtonOut.src = "images/siteskin/buttons/button_submit_out.png"; 81_submitButtonOver.src = "images/siteskin/buttons/button_submit_over.png"; 82_submitButtonDown.src = "images/siteskin/buttons/button_submit_down.png"; 83_submitResponseButtonOut.src = "images/siteskin/buttons/button_submit_response_out.png"; 84_submitResponseButtonOver.src = "images/siteskin/buttons/button_submit_response_over.png"; 85_submitResponseButtonDown.src = "images/siteskin/buttons/button_
85submit_response_down.png"; 86_submitReviewButtonOut.src = "images/siteskin/buttons/button_submit_review_out.png"; 87_submitReviewButtonOver.src = "images/siteskin/buttons/button_submit_review_over.png"; 88_submitReviewButtonDown.src = "images/siteskin/buttons/button_submit_review_down.png"; 89 90//-------------------------------------------------------------------------------------------------------------------------------------------------------------- 91//WINDOW: 92//-------------------------------------------------------------------------------------------------------------------------------------------------- 93if (window.onload){ 94 95 var funWindowLoad = window.onload; 96 window.onload = new Function("funWindowLoad(); Window_OnLoad();"); 97 98} 99else 100 window.onload = Window_OnLoad; 101 102//-------------------------------------------------------------------------------------------------------------------------------------------------- 103var _form; 104function Window_OnLoad(){ 105 106 //Set the form object used by the UOF: 107 _form = document.frmMain; 108 109} 110//-------------------------------------------------------------------------------------------------------------------------------------------------- 111 112//-------------------------------------------------------------------------------------------------------------------------------------------------- 113//HELP POPUP: 114function HelpPopup_ShowHelp(imageControl, show){ 115 116 //Start by getting the help popup table and hiding it: 117 var tblHelpPopup = document.getElementById("tblHelpPopup"); 118 tblHelpPopup.style.display = "none"; 119 120 //If we were supposed to hide the control, then we are done: 121 if (!show) return; 122 123 //First, get the popup properties, and reference to the title cell, body cell, and div positioning container: 124 var controlId = imageControl.getAttribute("controlid"); 125 var width = imageControl.getAttribute("popupwidth") * 1; 126 var height = imageControl.getAttribute("popupheight"); 127 var title = imageControl.getAttribute("popuptitle"); 128 var body = imageControl.getAttribute("popupbody"); 129 130 //We need some custom handling for this control if its for the Card Code: 131 if (title.toLowerCase().indexOf("card code") != -1){ 132 133 var cardTypeDesc = Trim(_form.selCardType.options[_form.selCardType.options.selectedIndex].text.toLowerCase()); 134 135 if (cardTypeDesc == "american express"){ 136 137 body = imageControl.getAttribute("popupbodyalt"); 138 139 } 140 141 } 142 143 var position = imageControl.getAttribute("popupside"); 144 145 var titleCellElement = tblHelpPopup.rows[0].cells[0]; 146 var bodyCellElement = tblHelpPopup.rows[1].cells[0]; 147 var divContainerElement = document.getElementById("divHelpIcon_" + controlId); 148 149 //Calculate the Left and Top properties: 150 var left = 0; 151 var top = 0; 152 153 if (position == "right"){ 154 left = divContainerElement.offsetLeft + 19; 155 } 156 else { 157 left = divContainerElement.offsetLeft - width; 158 } 159 top = divContainerElement.offsetTop - (height / 2); 160 161 //Set the popup properties: 162 tblHelpPopup.style.left = left; 163 tblHelpPopup.style.top = top; 164 tblHelpPopup.style.width = width; 165 bodyCellElement.style.height = height - 18; //18 is for the title cell 166 titleCellElement.innerHTML = " " + title; 167 bodyCellElement.innerHTML = "<div style=\"padding: 10px; padding-bottom: 0px\">" + body + "</div>"; 168 169 //Show the popup: 170 tblHelpPopup.style.display = "block"; 171 172} 173//-------------------------------------------------------------------------------------------------------------------------------------------------- 174//SHARED FUNCTIONS: 175//-------------------------------------------------------------------------------------------------------------------------------------------------- 176function LoadSelectOptions(selectControl, dataString, rowDelimiter, colDelimiter){ 177 178 //Capture the value of the current selected option: 179 var value = selectControl.value; 180 181 var index = selectControl.options.selectedIndex; 182 var text = (index == -1?"":selectControl.options[index].text); 183 184 //Clear all options from the select: 185 selectControl.length = 0; 186 187 if (Trim(dataString) != ""){ 188 189 //Split the data string up into an array: 190 var rowArray = dataString.split(rowDelimiter); 191 192 //Loop thru the array and add the maintenance options: 193 for (var i = 0; i < rowArray.length; i++){ 194 195 var colArray = rowArray[i].split(colDelimiter); 196 var option = new Option(colArray[1], colArray[0], false, false); 197 198 selectControl.options[i] = option; 199 200 } 201 202 //Reset the selected option to the value that matches value; 203 selectControl.value = value; 204 205 } 206 207} 208//--------------------------------------------------------------------------------------------------------------------------------------------------
209function IsInteger(value, allowNegative, allowThousands){ 210 211 if (value == ""){ 212 return true; 213 } 214 215 //Handle null params: 216 if (allowNegative == null) allowNegative = true; 217 if (allowThousands == null) allowThousands = false; 218 219 //Since this is a function for checking for integers, the 220 //isNaN() function does most of the work for us, however, 221 //the isNaN() function allows "." and "-" so we must 222 //check for the presence of these two symbols. If either 223 //exist in the string, then we return false: 224 if (value.indexOf(".") != -1){ 225 return false; 226 } 227 if (allowNegative == false){ 228 if (value.indexOf("-") != -1){ 229 return false; 230 } 231 } 232 233 if (allowThousands == false){ 234 if (value.indexOf(",") != -1){ 235 return false; 236 } 237 } 238 else { 239 //Strip out thousands "," incase they put them in because 240 //isNaN will return true if they are there: 241 value = Replace(value, ",", ""); 242 } 243 244 //Check for e or E since isNaN allows them: 245 if (value.indexOf("e") != -1){ 246 return false; 247 } 248 if (value.indexOf("E") != -1){ 249 return false; 250 } 251 252 //Finish the validation: 253 if (isNaN(value)){ 254 return false; 255 } 256 //If we made it here, then its a integer so we return true: 257 return true; 258} 259//-------------------------------------------------------------------------------------------------------------------------------------------------- 260function Replace(value, remove, insert){ 261 262 value = value.toString(); 263 264 return value.split(remove).join(insert); 265} 266//-------------------------------------------------------------------------------------------------------------------------------------------------- 267function Trim(value){ 268 269 if (value == null) value = ""; 270 271 value = value.toString(); 272 273 return LTrim(RTrim(value)); 274} 275//-------------------------------------------------------------------------------------------------------------------------------------------------- 276function LTrim(value){ 277 var spaceIndex = value.search( /^\s*(\S.*)/ ); 278 return ( ( spaceIndex == -1 ) ? "" : RegExp.$1 ); 279} 280//-------------------------------------------------------------------------------------------------------------------------------------------------- 281function RTrim(value){ 282 var spaceIndex = value.search( /\s+$/ ); 283 return ( ( spaceIndex == -1 ) ? value : value.substr( 0, spaceIndex ) ); 284} 285//-------------------------------------------------------------------------------------------------------------------------------------------------- 286function IsEmail(value){ 287 288 if (value == ""){ 289 return true; 290 } 291 292 //Check for an @ symbol: 293 if (value.indexOf("@") == -1){ 294 return false; 295 } 296 //Check for more than 1 @ symbol: 297 if (value.indexOf("@") != value.lastIndexOf("@")){ 298 return false; 299 } 300 301 //Check for an . symbol after @ symbol: 302 if (value.lastIndexOf(".") < value.indexOf("@")){ 303 return false; 304 } 305 306 //Check for an empty " " string: 307 if (value.indexOf(" ") != -1){ 308 return false; 309 } 310 311 //Check for invalid symbols: 312 if (value.indexOf("*") != -1){ 313 return false; 314 } 315 if (value.indexOf("%") != -1){ 316 return false; 317 } 318 if (value.indexOf(",") != -1){ 319 return false; 320 } 321 if (value.indexOf(";") != -1){ 322 return false; 323 } 324 if (value.indexOf("'") != -1){ 325 return false; 326 } 327 if (value.indexOf("\"") != -1){ 328 return false; 329 } 330 if (value.indexOf(":") != -1){ 331 return false; 332 } 333 return true; 334} 335//-------------------------------------------------------------------------------------------------------------------------------------------------- 336function CBln(value){ 337 338 value = Trim(value.toLowerCase()); 339 return (value == "true"?true:false); 340 341} 342//-------------------------------------------------------------------------------------------------------------------------------------------------- 343function CInt(value){ 344 345 return (value * 1); 346 347} 348//-------------------------------------------------------------------------------------------------------------------------------------------------- 349function GetUniqueCode(){ 350 351 var dateObject = new Date(); 352 var uniqueCode = "" + dateObject.getYear() + dateObject.getMonth() +
353 dateObject.getDate() + dateObject.getHours() + 354 dateObject.getMinutes() + dateObject.getSeconds() + dateObject.getMilliseconds(); 355 356 return uniqueCode; 357 358} 359//-------------------------------------------------------------------------------------------------------------------------------------------------- 360function GetRadioButtonValue(rblControl){ 361 362 var r; 363 for (r = 0; r < rblControl.length; r++){ 364 365 if (rblControl[r].checked) return rblControl[r].value; 366 367 } 368 369 return ""; 370 371} 372//-------------------------------------------------------------------------------------------------------------------------------------------------- 373function SetRadioButtonValue(rblControl, value){ 374 375 var r; 376 for (r = 0; r < rblControl.length; r++){ 377 378 //First uncheck all: 379 rblControl[r].checked = false; 380 381 //Then check if there's a match: 382 if (rblControl[r].value == value){ 383 384 rblControl[r].checked = true; 385 break; 386 387 } 388 389 } 390 391} 392//-------------------------------------------------------------------------------------------------------------------------------------------------- 393function IsNumber(value){ 394 if (value == ""){ 395 return true; 396 } 397 398 //Since this is an IsNumber function, we 399 //can expect valid numbers to have "." and "," and "-". Due to 400 //the fact that isNaN() returns false when a value has commas, 401 //we remove them all prior to the isNaN() check. However, if they 402 //are in the wrong location, then we immediately return false: 403 if (value.indexOf(",") != -1){ 404 //There is an assumption here that the function that called 405 //this function trimmed all leading and trailing spaces off 406 //of value: (This must be done!) 407 408 //Since a possibility of a decimal point has to be taken 409 //into consideration, we check for one decimal point, if there 410 //are more than one decimal points, then we immediately return 411 //false, we only perform this check if we are checking commas, 412 //else the isNaN() function handles the decimal point check 413 //internally: 414 var tempArray = value.split("."); 415 if (tempArray.length > 2){ 416 return false; 417 } 418 //If there is only one valid decimal point, then 419 //we find the length of the string after the decimal 420 //point including the decimal point. This is then 421 //subtracted from the value.length value below: 422 var tempLength = 0; 423 424 if (tempArray.length == 2){ 425 var tempString = value.substr(value.indexOf(".")); 426 tempLength = tempString.length; 427 } 428 var validateString = value.substr(0,value.length - tempLength); 429 430 //Next, we perform basically the same check for the negative symbol: 431 tempArray = value.split("-"); 432 if (tempArray.length > 2){ 433 return false; 434 } 435 436 if (tempArray.length == 2){ 437 //Make sure the "-" is the first character: 438 if (value.charAt(0) != "-"){ 439 return false; 440 } 441 else { 442 //Remove the "-" from the string to be validated: 443 validateString = validateString.substr(1); 444 } 445 } 446 447 switch (validateString.length){ 448 //1,000 - 10,000 - 100,000 449 case 5: case 6: case 7: //1,000.00 450 //Check to make sure there is only one comma: 451 tempArray = validateString.split(","); 452 if (tempArray.length > 2){ 453 return false; 454 } 455 if (validateString.charAt(validateString.length - 4) != ","){ 456 return false; 457 } 458 break; 459 //1,000,000 - 10,000,000 - 100,000,000 460 case 9: case 10: case 11: 461 //Check to make sure there are only two commas: 462 tempArray = validateString.split(","); 463 if (tempArray.length > 3){ 464 return false; 465 } 466 if (validateString.charAt(validateString.length - 4) != "," || 467 validateString.charAt(validateString.length - 8) != ","){ 468 return false; 469 } 470 break; 471 //Any other length and the comma is in the wrong location, 472 //so we return false: 473 default: 474 return false; 475 } 476 } 477 //Remove commas if there are any, since we checked for proper location 478 //above and isNaN() will return false if the string has any commas: 479 value = value.split(",").join(""); 480 481 //Check to see if its a valid number: 482 if (isNaN(value)){ 483 return false; 484 } 485 //If we made it here, then its a number so we return true: 486 return true; 487} 488//-------------------------------------------------------------------------------------------------------------------------------------------------- 489function FormatNumber(value, decimalCount, useThousandsSeparator, useCurrencySymbol){ 490 491 value = value.toString(); 492 493 if (Trim(value) == "") return ""; 494 495 //Remove any "," or "$" characters: 496 value = Replace(value, ",", ""); 497 value = Replace(value, "$", ""); 498 499 //Next, make sure this is a valid number, as we are not validating here, just formatting: 500 if (!IsNumber(value)) return value; 501 502 //Handle null args: 503 if (decimalCount == null) decimalCount = 0; 504 if (useThousandsSeparator == null) useThousandsSeparator = true; 505 if (useCurrencySymbol == null) useCurrencySymbol = false; 506
507 //Build the multiplier: 508 var multiplier = ""; 509 510 var r; 511 for (r = 0; r < decimalCount; r++){ 512 513 multiplier += "0"; 514 515 } 516 517 518 519 var tempValue = value * (("1" + multiplier) * 1); 520 521 if (tempValue.toString() == "NaN") return value; 522 523 var signNumber = 1; 524 525 if (tempValue < 0){ 526 527 signNumber = -1; 528 tempValue = tempValue * -1; 529 530 } 531 532 //Round the value: 533 tempValue = Math.round(tempValue).toString(); 534 535 //Based on the decimals arg, define what the tempValue should be, start by 536 //building the "0" padding string which is calcuated by the following function: 537 //((decimalCount - tempValue.length) + 1): 538 var zeroCount = ((decimalCount - tempValue.length) + 1); 539 var zerosString = ""; 540 for (r = 0; r < zeroCount; r++){ 541 542 zerosString += "0"; 543 544 } 545 546 //Add the zeros to the temp value: 547 tempValue = zerosString + tempValue; 548 549 tempValue = tempValue.substr(0, tempValue.length - decimalCount) + 550 "." + tempValue.substr(tempValue.length - decimalCount, decimalCount); 551 552 if (useThousandsSeparator){ 553 554 var searchIndex = tempValue.search(/[^-]...\./); 555 do { 556 557 if (searchIndex >= 0) 558 tempValue = tempValue.substr(0, searchIndex + 1) + "," + tempValue.substr(searchIndex + 1); 559 560 searchIndex = tempValue.search(/[^,-]...,/);
561 562 } while (searchIndex >= 0); 563 564 } 565 566 if ( signNumber == -1 ) tempValue = "-" + tempValue; 567 568 if (decimalCount == 0) tempValue = tempValue.substr(0, tempValue.length - 1); 569 570 if (useCurrencySymbol) tempValue = "$" + tempValue; 571 572 //Return the string as a formatted number: 573 return tempValue; 574 575} 576//-------------------------------------------------------------------------------------------------------------------------------------------------- 577function IsPassword(value){ 578 579 value = Trim(value).toLowerCase(); 580 581 if (value.length < 6 || value.length > 10) return false; 582 583 for (i = 0; i < value.length; i++){ 584 if (value.substr(i, 1) < "a" || value.substr(i, 1) > "z"){ 585 switch (value.substr(i, 1)){ 586 case "0": case "1": case "2": case "3": case "4": case "5": 587 case "6": case "7": case "8": case "9": 588 //Continue checking: 589 break; 590 default: 591 return false; 592 } 593 } 594 } 595 return true; 596 597} 598//-------------------------------------------------------------------------------------------------------------------------------------------------- 599function IsDate(value){ 600 601 if (value == ""){ 602 return true; 603 } 604 //Valid dates formats: 605 //1. mm(m)/dd(d)/yy(yyyy) 606 //2. mm(m)-dd(d)-yy(yyyy) 607 608 //First we make sure the date can validate based 609 //on javascript's built in date object: 610 var dateObject = new Date(value); 611 //If the date object does not validate to a number, then 612 //the string passed is not a valid date: 613 if (isNaN(dateObject)){ 614 return false; 615 } 616 //Since, the date string passed the first validation. We next 617 //check to make sure the string is in on of the two formats listed 618 //at the top of this function: 619 var dashArray = value.split("-"); 620 var slashArray = value.split("/"); 621 var separator = ""; 622 var month = ""; 623 var day = ""; 624 var year = ""; 625 626 //Ensure that the user did not enter mixed seperator symbols: 627 if (dashArray.length - 1 == 1 && slashArray.length - 1 == 1){ 628 return false; 629 } 630 631 //Dashes: 632 if (dashArray.length - 1 == 2){ 633 //Populate the month, day, and year variables: 634 month = "00" + dashArray[0]; 635 day = "00" + dashArray[1]; 636 year = dashArray[2]; 637 } 638 //Slashes: 639 else { 640 //Populate the month, day, and year variables: 641 month = "00" + slashArray[0]; 642 day = "00" + slashArray[1]; 643 year = slashArray[2]; 644 } 645 646 //Validate the month portion of the date: 647 month = month.substr(month.length - 2); 648 if (month < "01" || month > "12"){ 649 return false; 650 } 651 652 //Validate the year portion of the date: 653 if (year.length != 2 && year.length != 4){ 654 return false; 655 } 656 //Check for invalid characters in the year string: 657 for (i = 0; i < year.length; i++){ 658 if (year.charAt(i) < "0" || year.charAt(i) > "9"){ 659 return false; 660 } 661 } 662 663 //Validate the day portion of the date: 664 day = day.substr(day.length - 2); 665 switch (month){ 666 case "01": case "03": case "05": case "07": 667 case "08": case "10": case "12": 668 if (day < "01" || day > "31"){ 669 return false; 670 } 671 break; 672 case "04": case "06": case "09": case "11": 673 if (day < "01" || day > "30"){ 674 return false; 675 } 676 break; 677 case "02": 678 //First, we must determine if we are in a leap 679 //year or not: 680 var isLeapYear = false; 681 682 //If year is 2 Digits, then we convert it to 683 //the 4 year string: 684 if (year.length == 2){ 685 if (year >= "00" && year <= "80"){ 686 year = "20" + year; 687 } 688 else { 689 year = "19" + year; 690 } 691 } 692 var yearIndex = year * 1; 693 694 if ((yearIndex % 4) == 0){ 695 if ((yearIndex % 100) == 0){ 696 if ((yearIndex % 400) == 0){ 697 isLeapYear = true; 698 } 699 } 700 else { 701 isLeapYear = true; 702 } 703 } 704 705 if (isLeapYear){ 706 //If we are in a leap year: 707 if (day < "01" || day > "29"){ 708 return false; 709 } 710 } 711 else { 712 //If we are not in a leap year: 713 if (day < "01" || day > "28"){ 714 return false; 715 } 716 } 717 break; 718 } 719 720 //If we make it to hear, then it is a valid date: 721 return true; 722} 723//-------------------------------------------------------------------------------------------------------------------------------------------------- 724function SetSelectByText(selectControl, text){ 725 726 for (var r = 0; r < selectControl.options.length; r++){ 727 728 if (Trim(selectControl.options[r].text).toLowerCase() == Trim(text).toLowerCase()){ 729 730 selectControl.options.selectedIndex = r; 731 break; 732 733 } 734 735 } 736 737} 738//-------------------------------------------------------------------------------------------------------------------------------------------------- 739function HtmlEncode(text){ 740 741 return text.replace(/&/g, "&").replace(/\"/g, """).replace(/</g, "<").replace(/>/g, ">"); 742 743} 744//-------------------------------------------------------------------------------------------------------------------------------------------------- 745function HtmlDecode(s){ 746 747 var out = ""; 748 if (s==null) return; 749 750 var l = s.length; 751 for (var i=0; i<l; i++){ 752 753 var ch = s.charAt(i); 754 if (ch == '&'){ 755 756 var semicolonIndex = s.indexOf(';', i+1); 757 758 if (semicolonIndex > 0){ 759 760 var entity = s.substring(i + 1, semicolonIndex); 761 762 if (entity.length > 1 && entity.charAt(0) == '#'){ 763 764 if (entity.charAt(1) == 'x' || entity.charAt(1) == 'X') 765 766 ch = String.fromCharCode(eval('0'+entity.substring(1))); 767 768 else 769 770 ch = String.fromCharCode(eval(entity.substring(1))); 771 772 } 773 774 else 775 776 { 777 778 switch (entity){ 779 case 'quot': ch = String.fromCharCode(0x0022); break; 780 case 'amp': ch = String.fromCharCode(0x0026); break; 781 case 'lt': ch = String.fromCharCode(0x003c); break; 782 case 'gt': ch = String.fromCharCode(0x003e); break; 783 case 'nbsp': ch = String.fromCharCode(0x00a0); break; 784 case 'iexcl': ch = String.fromCharCode(0x00a1); break; 785 case 'cent': ch = String.fromCharCode(0x00a2); break; 786 case 'pound': ch = String.fromCharCode(0x00a3); break; 787 case 'curren': ch = String.fromCharCode(0x00a4); break; 788 case 'yen': ch = String.fromCharCode(0x00a5); break; 789 case 'brvbar': ch = String.fromCharCode(0x00a6); break; 790 case 'sect': ch = String.fromCharCode(0x00a7); break; 791 case 'uml': ch = String.fromCharCode(0x00a8); break; 792 case 'copy': ch = String.fromCharCode(0x00a9); break; 793 case 'ordf': ch = String.fromCharCode(0x00aa); break; 794 case 'laquo': ch = String.fromCharCode(0x00ab); break; 795 case 'not': ch = String.fromCharCode(0x00ac); break; 796 case 'shy': ch = String.fromCharCode(0x00ad); break;
797 case 'reg': ch = String.fromCharCode(0x00ae); break; 798 case 'macr': ch = String.fromCharCode(0x00af); break; 799 case 'deg': ch = String.fromCharCode(0x00b0); break; 800 case 'plusmn': ch = String.fromCharCode(0x00b1); break; 801 case 'sup2': ch = String.fromCharCode(0x00b2); break; 802 case 'sup3': ch = String.fromCharCode(0x00b3); break; 803 case 'acute': ch = String.fromCharCode(0x00b4); break; 804 case 'micro': ch = String.fromCharCode(0x00b5); break; 805 case 'para': ch = String.fromCharCode(0x00b6); break; 806 case 'middot': ch = String.fromCharCode(0x00b7); break; 807 case 'cedil': ch = String.fromCharCode(0x00b8); break; 808 case 'sup1': ch = String.fromCharCode(0x00b9); break; 809 case 'ordm': ch = String.fromCharCode(0x00ba); break; 810 case 'raquo': ch = String.fromCharCode(0x00bb); break; 811 case 'frac14': ch = String.fromCharCode(0x00bc); break; 812 case 'frac12': ch = String.fromCharCode(0x00bd); break; 813 case 'frac34': ch = String.fromCharCode(0x00be); break; 814 case 'iquest': ch = String.fromCharCode(0x00bf); break; 815 case 'Agrave': ch = String.fromCharCode(0x00c0); break; 816 case 'Aacute': ch = String.fromCharCode(0x00c1); break; 817 case 'Acirc': ch = String.fromCharCode(0x00c2); break; 818 case 'Atilde': ch = String.fromCharCode(0x00c3); break; 819 case 'Auml': ch = String.fromCharCode(0x00c4); break; 820 case 'Aring': ch = String.fromCharCode(0x00c5); break; 821 case 'AElig': ch = String.fromCharCode(0x00c6); break; 822 case 'Ccedil': ch = String.fromCharCode(0x00c7); break; 823 case 'Egrave': ch = String.fromCharCode(0x00c8); break; 824 case 'Eacute': ch = String.fromCharCode(0x00c9); break; 825 case 'Ecirc': ch = String.fromCharCode(0x00ca); break; 826 case 'Euml': ch = String.fromCharCode(0x00cb); break; 827 case 'Igrave': ch = String.fromCharCode(0x00cc); break; 828 case 'Iacute': ch = String.fromCharCode(0x00cd); break; 829 case 'Icirc': ch = String.fromCharCode(0x00ce ); break; 830 case 'Iuml': ch = String.fromCharCode(0x00cf); break; 831 case 'ETH': ch = String.fromCharCode(0x00d0); break; 832 case 'Ntilde': ch = String.fromCharCode(0x00d1); break; 833 case 'Ograve': ch = String.fromCharCode(0x00d2); break; 834 case 'Oacute': ch = String.fromCharCode(0x00d3); break; 835 case 'Ocirc': ch = String.fromCharCode(0x00d4); break; 836 case 'Otilde': ch = String.fromCharCode(0x00d5); break; 837 case 'Ouml': ch = String.fromCharCode(0x00d6); break; 838 case 'times': ch = String.fromCharCode(0x00d7); break; 839 case 'Oslash': ch = String.fromCharCode(0x00d8); break; 840 case 'Ugrave': ch = String.fromCharCode(0x00d9); break; 841 case 'Uacute': ch = String.fromCharCode(0x00da); break; 842 case 'Ucirc': ch = String.fromCharCode(0x00db); break; 843 case 'Uuml': ch = String.fromCharCode(0x00dc); break; 844 case 'Yacute': ch = String.fromCharCode(0x00dd); break; 845 case 'THORN': ch = String.fromCharCode(0x00de); break; 846 case 'szlig': ch = String.fromCharCode(0x00df); break; 847 case 'agrave': ch = String.fromCharCode(0x00e0); break; 848 case 'aacute': ch = String.fromCharCode(0x00e1); break; 849 case 'acirc': ch = String.fromCharCode(0x00e2); break; 850 case 'atilde': ch = String.fromCharCode(0x00e3); break; 851 case 'auml': ch = String.fromCharCode(0x00e4); break; 852 case 'aring': ch = String.fromCharCode(0x00e5); break; 853 case 'aelig': ch = String.fromCharCode(0x00e6); break; 854 case 'ccedil': ch = String.fromCharCode(0x00e7); break; 855 case 'egrave': ch = String.fromCharCode(0x00e8); break; 856 case 'eacute': ch = String.fromCharCode(0x00e9); break; 857 case 'ecirc': ch = String.fromCharCode(0x00ea); break; 858 case 'euml': ch = String.fromCharCode(0x00eb); break; 859 case 'igrave': ch = String.fromCharCode(0x00ec); break; 860 case 'iacute': ch = String.fromCharCode(0x00ed); break; 861 case 'icirc': ch = String.fromCharCode(0x00ee); break; 862 case 'iuml': ch = String.fromCharCode(0x00ef); break; 863 case 'eth': ch = String.fromCharCode(0x00f0); break; 864 case 'ntilde': ch = String.fromCharCode(0x00f1); break; 865 case 'ograve': ch = String.fromCharCode(0x00f2); break; 866 case 'oacute': ch = String.fromCharCode(0x00f3); break; 867 case 'ocirc': ch = String.fromCharCode(0x00f4); break; 868 case 'otilde': ch = String.fromCharCode(0x00f5); break; 869 case 'ouml': ch = String.fromCharCode(0x00f6); break;
870 case 'divide': ch = String.fromCharCode(0x00f7); break; 871 case 'oslash': ch = String.fromCharCode(0x00f8); break; 872 case 'ugrave': ch = String.fromCharCode(0x00f9); break; 873 case 'uacute': ch = String.fromCharCode(0x00fa); break; 874 case 'ucirc': ch = String.fromCharCode(0x00fb); break; 875 case 'uuml': ch = String.fromCharCode(0x00fc); break; 876 case 'yacute': ch = String.fromCharCode(0x00fd); break; 877 case 'thorn': ch = String.fromCharCode(0x00fe); break; 878 case 'yuml': ch = String.fromCharCode(0x00ff); break; 879 case 'OElig': ch = String.fromCharCode(0x0152); break; 880 case 'oelig': ch = String.fromCharCode(0x0153); break; 881 case 'Scaron': ch = String.fromCharCode(0x0160); break; 882 case 'scaron': ch = String.fromCharCode(0x0161); break; 883 case 'Yuml': ch = String.fromCharCode(0x0178); break; 884 case 'fnof': ch = String.fromCharCode(0x0192); break; 885 case 'circ': ch = String.fromCharCode(0x02c6); break; 886 case 'tilde': ch = String.fromCharCode(0x02dc); break; 887 case 'Alpha': ch = String.fromCharCode(0x0391); break; 888 case 'Beta': ch = String.fromCharCode(0x0392); break; 889 case 'Gamma': ch = String.fromCharCode(0x0393); break; 890 case 'Delta': ch = String.fromCharCode(0x0394); break; 891 case 'Epsilon': ch = String.fromCharCode(0x0395); break; 892 case 'Zeta': ch = String.fromCharCode(0x0396); break; 893 case 'Eta': ch = String.fromCharCode(0x0397); break; 894 case 'Theta': ch = String.fromCharCode(0x0398); break; 895 case 'Iota': ch = String.fromCharCode(0x0399); break; 896 case 'Kappa': ch = String.fromCharCode(0x039a); break; 897 case 'Lambda': ch = String.fromCharCode(0x039b); break; 898 case 'Mu': ch = String.fromCharCode(0x039c); break; 899 case 'Nu': ch = String.fromCharCode(0x039d); break; 900 case 'Xi': ch = String.fromCharCode(0x039e); break; 901 case 'Omicron': ch = String.fromCharCode(0x039f); break; 902 case 'Pi': ch = String.fromCharCode(0x03a0); break; 903 case ' Rho ': ch = String.fromCharCode(0x03a1); break; 904 case 'Sigma': ch = String.fromCharCode(0x03a3); break; 905 case 'Tau': ch = String.fromCharCode(0x03a4); break; 906 case 'Upsilon': ch = String.fromCharCode(0x03a5); break; 907 case 'Phi': ch = String.fromCharCode(0x03a6); break; 908 case 'Chi': ch = String.fromCharCode(0x03a7); break; 909 case 'Psi': ch = String.fromCharCode(0x03a8); break; 910 case 'Omega': ch = String.fromCharCode(0x03a9); break; 911 case 'alpha': ch = String.fromCharCode(0x03b1); break; 912 case 'beta': ch = String.fromCharCode(0x03b2); break; 913 case 'gamma': ch = String.fromCharCode(0x03b3); break; 914 case 'delta': ch = String.fromCharCode(0x03b4); break; 915 case 'epsilon': ch = String.fromCharCode(0x03b5); break; 916 case 'zeta': ch = String.fromCharCode(0x03b6); break; 917 case 'eta': ch = String.fromCharCode(0x03b7); break; 918 case 'theta': ch = String.fromCharCode(0x03b8); break; 919 case 'iota': ch = String.fromCharCode(0x03b9); break; 920 case 'kappa': ch = String.fromCharCode(0x03ba); break; 921 case 'lambda': ch = String.fromCharCode(0x03bb); break; 922 case 'mu': ch = String.fromCharCode(0x03bc); break; 923 case 'nu': ch = String.fromCharCode(0x03bd); break; 924 case 'xi': ch = String.fromCharCode(0x03be); break; 925 case 'omicron': ch = String.fromCharCode(0x03bf); break; 926 case 'pi': ch = String.fromCharCode(0x03c0); break; 927 case 'rho': ch = String.fromCharCode(0x03c1); break; 928 case 'sigmaf': ch = String.fromCharCode(0x03c2); break; 929 case 'sigma': ch = String.fromCharCode(0x03c3); break; 930 case 'tau': ch = String.fromCharCode(0x03c4); break; 931 case 'upsilon': ch = String.fromCharCode(0x03c5); break; 932 case 'phi': ch = String.fromCharCode(0x03c6); break; 933 case 'chi': ch = String.fromCharCode(0x03c7); break; 934 case 'psi': ch = String.fromCharCode(0x03c8); break; 935 case 'omega': ch = String.fromCharCode(0x03c9); break; 936 case 'thetasym': ch = String.fromCharCode(0x03d1); break; 937 case 'upsih': ch = String.fromCharCode(0x03d2); break; 938 case 'piv': ch = String.fromCharCode(0x03d6); break; 939 case 'ensp': ch = String.fromCharCode(0x2002); break; 940 case 'emsp': ch = String.fromCharCode(0x2003); break; 941 case 'thinsp': ch = String.fromCharCode(0x2009); break; 942 case 'zwnj': ch = String.fromCharCode(0x200c); break; 943 case 'zwj': ch = String.fromCharCode(0x200d); break; 944 case 'lrm': ch = String.fromCharCode(0x200e); break; 945 case 'rlm': ch = String.fromCharCode(0x200f); break; 946 case 'ndash': ch = String.fromCharCode(0x2013); break; 947 case 'mdash': ch = String.fromCharCode(0x2014); break; 948 case 'lsquo': ch = String.fromCharCode(0x2018); break; 949 case 'rsquo': ch = String.fromCharCode(0x2019); break; 950 case 'sbquo': ch = String.fromCharCode(0x201a); break; 951 case 'ldquo': ch = String.fromCharCode(0x201c); break; 952 case 'rdquo': ch = String.fromCharCode(0x201d); break; 953 case 'bdquo': ch = String.fromCharCode(0x201e); break; 954 case 'dagger': ch = String.fromCharCode(0x2020); break; 955 case 'Dagger': ch = String.fromCharCode(0x2021); break; 956 case 'bull': ch = String.fromCharCode(0x2022); break; 957 case 'hellip': ch = String.fromCharCode(0x2026); break; 958 case 'permil': ch = String.fromCharCode(0x2030); break; 959 case 'prime': ch = String.fromCharCode(0x2032); break; 960 case 'Prime': ch = String.fromCharCode(0x2033); break; 961 case 'lsaquo': ch = String.fromCharCode(0x2039); break; 962 case 'rsaquo': ch = String.fromCharCode(0x203a); break; 963 case 'oline': ch = String.fromCharCode(0x203e); break; 964 case 'frasl': ch = String.fromCharCode(0x2044); break; 965 case 'euro': ch = String.fromCharCode(0x20ac); break; 966 case 'image': ch = String.fromCharCode(0x2111); break; 967 case 'weierp': ch = String.fromCharCode(0x2118); break; 968 case 'real': ch = String.fromCharCode(0x211c); break; 969 case 'trade': ch = String.fromCharCode(0x2122); break; 970 case 'alefsym': ch = String.fromCharCode(0x2135); break; 971 case 'larr': ch = String.fromCharCode(0x2190); break; 972 case 'uarr': ch = String.fromCharCode(0x2191); break; 973 case 'rarr': ch = String.fromCharCode(0x2192); break; 974 case 'darr': ch = String.fromCharCode(0x2193); break; 975 case 'harr': ch = String.fromCharCode(0x2194); break; 976 case 'crarr': ch = String.fromCharCode(0x21b5); break; 977 case 'lArr': ch = String.fromCharCode(0x21d0); break; 978 case 'uArr': ch = String.fromCharCode(0x21d1); break; 979 case 'rArr': ch = String.fromCharCode(0x21d2); break; 980 case 'dArr': ch = String.fromCharCode(0x21d3); break; 981 case 'hArr': ch = String.fromCharCode(0x21d4); break; 982 case 'forall': ch = String.fromCharCode(0x2200); break; 983 case 'part': ch = String.fromCharCode(0x2202); break; 984 case 'exist': ch = String.fromCharCode(0x2203); break; 985 case 'empty': ch = String.fromCharCode(0x2205); break; 986 case 'nabla': ch = String.fromCharCode(0x2207); break; 987 case 'isin': ch = String.fromCharCode(0x2208); break; 988 case 'notin': ch = String.fromCharCode(0x2209); break; 989 case 'ni': ch = String.fromCharCode(0x220b); break; 990 case 'prod': ch = String.fromCharCode(0x220f); break; 991 case 'sum': ch = String.fromCharCode(0x2211); break; 992 case 'minus': ch = String.fromCharCode(0x2212); break; 993 case 'lowast': ch = String.fromCharCode(0x2217); break; 994 case 'radic': ch = String.fromCharCode(0x221a); break; 995 case 'prop': ch = String.fromCharCode(0x221d); break; 996 case 'infin': ch = String.fromCharCode(0x221e); break; 997 case 'ang': ch = String.fromCharCode(0x2220); break; 998 case 'and': ch = String.fromCharCode(0x2227); break; 999 case 'or': ch = String.fromCharCode(0x2228); break; 1000 case 'cap': ch = String.fromCharCode(0x2229); break; 1001 case 'cup': ch = String.fromCharCode(0x222a); break; 1002 case 'int': ch = String.fromCharCode(0x222b); break; 1003 case 'there4': ch = String.fromCharCode(0x2234); break; 1004 case 'sim': ch = String.fromCharCode(0x223c); break; 1005 case 'cong': ch = String.fromCharCode(0x2245); break; 1006 case 'asymp': ch = String.fromCharCode(0x2248); break;
1007 case 'ne': ch = String.fromCharCode(0x2260); break; 1008 case 'equiv': ch = String.fromCharCode(0x2261); break; 1009 case 'le': ch = String.fromCharCode(0x2264); break; 1010 case 'ge': ch = String.fromCharCode(0x2265); break; 1011 case 'sub': ch = String.fromCharCode(0x2282); break; 1012 case 'sup': ch = String.fromCharCode(0x2283); break; 1013 case 'nsub': ch = String.fromCharCode(0x2284); break; 1014 case 'sube': ch = String.fromCharCode(0x2286); break; 1015 case 'supe': ch = String.fromCharCode(0x2287); break; 1016 case 'oplus': ch = String.fromCharCode(0x2295); break; 1017 case 'otimes': ch = String.fromCharCode(0x2297); break; 1018 case 'perp': ch = String.fromCharCode(0x22a5); break; 1019 case 'sdot': ch = String.fromCharCode(0x22c5); break; 1020 case 'lceil': ch = String.fromCharCode(0x2308); break; 1021 case 'rceil': ch = String.fromCharCode(0x2309); break; 1022 case 'lfloor': ch = String.fromCharCode(0x230a); break; 1023 case 'rfloor': ch = String.fromCharCode(0x230b); break; 1024 case 'lang': ch = String.fromCharCode(0x2329); break; 1025 case 'rang': ch = String.fromCharCode(0x232a); break; 1026 case 'loz': ch = String.fromCharCode(0x25ca); break; 1027 case 'spades': ch = String.fromCharCode(0x2660); break; 1028 case 'clubs': ch = String.fromCharCode(0x2663); break; 1029 case 'hearts': ch = String.fromCharCode(0x2665); break; 1030 case 'diams': ch = String.fromCharCode(0x2666); break; 1031 default: ch = ''; break; 1032 1033 } 1034 1035 } 1036 1037 i = semicolonIndex; 1038 1039 } 1040 1041 } 1042 1043 out += ch; 1044 1045 } 1046 1047 return out; 1048 1049} 1050//--------------------------------------------------------------------------------------------------------------------------------------------------
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.