



function Istext(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. ";



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



return IsText;



}











/*function isValidSSN(value) {



    var re = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/;



    if (!re.test(value)) { return false; }



    var temp = value;



    if (value.indexOf("-") != -1) { temp = (value.split("-")).join(""); }



    if (value.indexOf(" ") != -1) { temp = (value.split(" ")).join(""); }



    if (temp.substring(0, 3) == "000") { return false; }



    if (temp.substring(3, 5) == "00") { return false; }



    if (temp.substring(5, 9) == "0000") { return false; }



    return true;



}

*/





var ssn_data1="001 02 002 02    003 98    004 06    005 06*    006 04 007 04    008 88    009 86    010 88  011 88  012 88   013 88  014 88   015 88    016 88    017 88    018 88 019 88    020 88*    021 86    022 86    023 86    024 86 025 86    026 86 027 86   028 86    029 86    030 86  031 86    032 86    033 86    034 86    035 70    036 70  037 70    038 70    039 68    040 08  041 08* 042 06  043 06    044 06    045 06    046 06    047 06    048 06  049 06    050 94    051 94    052 94    053 94 054 94 055 94    056 94    057 94    058 94    059 94  060 94  061 94  062 94  063 94  064 94  065 94    066 94  067 94    068 94 069 94    070 94    071 94    072 94  073 94    074 94    075 94    076 94    077 94    078 94  079 94    080 94*    081 94*    082 94*    083 94*    084 92  085 92    086 92    087 92    088 92    089 92    090 92   091 92    092 92    093 92    094 92    095 92    096 92  097 92    098 92    099 92    100 92    101 92    102 92  103 92    104 92    105 92    106 92    107 92    108 92 109 92    110 92    111 92    112 92    113 92  114 92  115 92  116 92  117 92  118 92  119 92    120 92  121 92    122 92    123 92    124 92    125 92    126 92  127 92    128 92    129 92    130 92    131 92    132 92  133 92    134 92    135 15  136 16 137 15    138 15  139 15    140 15*    141 13    142 13  143 13    144 13  145 13    146 13    147 13    148 13    149 13   150 13 151 13    152 13    153 13    154 13  155 13    156 13 157 13    158 13    159 82    160 82    161 82    162 82 163 82    164 82 165 82    166 82    167 82    168 82 169 82    170 82    171 82    172 82    173 82    174 82 175 82    176 82    177 82    178 82   179 82    180 82*  181 80    182 80    183 80    184 80    185 80    186 80 187 80    188 80    189 80    190 80    191 80 192 80 193 80    194 80    195 80  196 80    197 80    198 80 199 80    200 80    201 80    202 80    203 80    204 80 205 80    206 80    207 80    208 80    209 80    210 80 211 80    212 71    213 71    214 71*    215 69    216 69 217 69    218 69    219 69     220 69    221 98    222 98 223 99    224 99  225 99  226 99  227 99    228 99 229 99    230 99    231 99*    232 51    233 51    234 51 235 49    236 49    237 99    238 99    239 99    240 99 241 99    242 99    243 99  244 99  245 99    246 99 247 99 248 99    249 99    250 99    251 99    252 99 253 99    254 99    255 99    256 99    257 99    258 99 259 99    260 99    261 99    262 99    263 99    264 99 265 99    266 99    267 99    268 11    269 11    270 11* 271 11*    272 08    273 08    274 08 275 08    276 08 277 08    278 08    279 08    280 08    281 08    282 08 283 08    284 08    285 08    286 08  287 08    288 08 289 08    290 08    291 08    292 08    293 08    294 08 295 08    296 08    297 08    298 08    299 08    300 08 301 08  302 08 303 29    304 29    305 27    306 27 307 27    308 27    309 27    310 27    311 27    312 27 313 27    314 27  315 27   316 27 317 27    318 04 319 04    320 04    321 04    322 04    323 04    324 04 325 04    326 04    327 04*    328 04*    329 04*    330 02 331 02    332 02    333 02    334 02  335 02  336 02 337 02    338 02    339 02    340 02    341 02    342 02 343 02    344 02 345 02    346 02    347 02    348 02 349 02    350 02    351 02    352 02    353 02    354 02 355 02    356 02    357 02    358 02    359 02    360 02 361 02    362 31    363 31    364 31    365 31    366 31 367 31    368 31    369 31    370 31*    371 29 372 29 373 29    374 29    375 29    376 29    377 29    378 29 379 29    380 29    381 29    382 29    383 29    384 29 385 29 386 29  387 25    388 25    389 25    390 25 391 25    392 25    393 25  394 25    395 25*    396 23 397 23    398 23    399 23 400 63    401 63    402 63  403 63*    404 61    405 61    406 61    407 61    408 99 409 97    410 97    411 97  412 97    413 97    414 97 415 97    416 57    417 57    418 57    419 57    420 57 421 57    422 57    423 57*    424 55    425 95    426 95 427 95    428 95    429 99    430 99    431 99    432 99 433 99    434 99    435 99    436 99    437 99    438 99 439 99  440 19 441 19    442 19    443 19    444 19 445 19    446 19    447 19*    448 17    449 99    450 99 451 99    452 99    453 99    454 99    455 99    456 99 457 99    458 99    459 99    460 99    461 99    462 99 463 99    464 99    465 99    466 99    467 99    468 45 469 45    470 45    471 45    472 45    473 45    474 43 475 43    476 43 477 43    478 35    479 35    480 33 481 33  482 33    483 33    484 33    485 33    486 21 487 21    488 21    489 21    490 21 491 21    492 21 493 21    494 21    495 21    496 21    497 21    498 21 499 21  500 19    501 31    502 29    503 37  504 35 505 47    506 47    507 47    508 47    509 23    510 23 511 23    512 23    513 23  514 23    515 23    516 41 517 39    518 69 519 69  520 49  521 99    522 99 523 99    524 99    525 99    526 99    527 99    528 99 529 99    530 99    531 55    532 55    533 55    534 55 535 55  536 53    537 53    538 53 539 53    540 67 541 67    542 67    543 67    544 65    545 99   546 99 547 99    548 99    549 99    550 99    551 99    552 99 553 99    554 99    555 99    556 99    557 99    558 99 559 99    560 99 561 99    562 99    563 99    564 99 565 99    566 99 567 99    568 99    569 99    570 99 571 99    572 99    573 99    574 41    575 99    576 99 577 39    578 37  579 37    580 35 581 99    582 99 583 99    584 99    585 99    586 55    587 95    589 99 590 99    591 99    592 99    593 99  594 99  595 99 596 76    597 76    598 76    599 76*    600 99    601 99 602 47    603 47    604 47    605 47    606 47    607 47 608 47    609 47 610 47    611 47  612 47  613 47 614 47    615 47* 616 47*    617 47*    618 47*    619 47* 620 47*    621 45    622 45    623 45 624 45    625 45 626 45    627 94*    628 94*    629 94*    630 94*    631 92 632 92     633 92     634 92  635 92  636 92    637 92 638 92    639 92    640 92  641 92    642 92 643 92 644 92    645 92    646 78  647 78*    648 36*    649 34 650 34* 651 32    652 32  653 32    654 18    655 18 656 18    657 18    658 18*    659 10  660 10* 661 09   662 09  663 09  664 09  665 09     667 24  668 24  669 24  670 24* 671 22  672 22 673 22    674 22   675 22  676 09* 677 07  678 07  679 07    680 62* 681 05    682 05  683 05  684 05     685 05  686 05 687 05  688 05  689 05*    690 03    700 18  701 18 702 18  703 18     704 18  705 18  706 18  707 18   708 18  709 18  710 18  711 18    712 18    713 18 714 18  715 18  716 18  717 18    718 18    719 18 720 18  721 18  722 18  723 18    724 28    725 18 726 18  727 10    728 14  729 03    730 03     731 03 732 03*    733 01  750 01  764 46*   765 46* 766 34 767 34* 768 34* 769 34*  770 32 771 32 772 32   ";



var ssn_data=new Array("001 02", "002 02",    "003 98" ,   "004 06" ,   "005 06"  ,  "006 04", "007 04"  ,  "008 88" ,   "009 86" ,   "010 88", "011 88",  "012 88"  , "013 88" , "014 88",   "015 88",    "016 88",    "017 88" ,   "018 88", "019 88" ,   "020 88" ,   "021 86" ,   "022 86" ,   "023 86",    "024 86", "025 86" ,   "026 86", "027 86" ,  "028 86",    "029 86"  ,  "030 86" , "031 86",    "032 86",    "033 86" ,   "034 86"  ,  "035 70",    "036 70",  "037 70",    "038 70"  ,  "039 68"  ,  "040 08" , "041 08", "042 06",  "043 06" ,   "044 06"  ,  "045 06"  ,  "046 06"  ,  "047 06" ,   "048 06",  "049 06",    "050 94"  ,  "051 94"  ,  "052 94"  ,  "053 94", "054 94" , "055 94"  ,  "056 94" ,   "057 94" ,   "058 94"  ,  "059 94" , "060 94",  "061 94",  "062 94" , "063 94",  "064 94", "065 94",    "066 94",  "067 94",    "068 94", "069 94",   "070 94" ,  "071 94"  ,  "072 94",  "073 94",    "074 94"  ,  "075 94",    "076 94",    "077 94",    "078 94",  "079 94",    "080 94"  ,  "081 94" ,   "082 94" ,   "083 94"  ,  "084 92",  "085 92"  ,  "086 92"  ,  "087 92"  , "088 92",    "089 92",    "090 92",   "091 92"  ,  "092 92",    "093 92",    "094 92",    "095 92"  ,  "096 92",  "097 92"  ,  "098 92",    "099 92",    "100 92",    "101 92" ,   "102 92",  "103 92",    "104 92",    "105 92",    "106 92",    "107 92",    "108 92", "109 92",    "110 92",    "111 92",    "112 92",    "113 92",  "114 92",  "115 92" , "116 92" , "117 92" , "118 92",  "119 92",    "120 92",  "121 92",    "122 92",    "123 92",    "124 92",    "125 92" ,   "126 92",  "127 92",    "128 92",    "129 92",    "130 92",    "131 92",    "132 92",  "133 92",    "134 92",    "135 15",  "136 16", "137 15",    "138 15",  "139 15",    "140 15",    "141 13"  ,  "142 13",  "143 13",    "144 13",  "145 13",    "146 13",    "147 13",    "148 13",    "149 13",   "150 13", "151 13",    "152 13",    "153 13",    "154 13",  "155 13",    "156 13", "157 13",    "158 13",    "159 82",    "160 82",    "161 82",    "162 82", "163 82",    "164 82", "165 82",    "166 82",    "167 82",    "168 82", "169 82",    "170 82",    "171 82",    "172 82",    "173 82"  ,  "174 82", "175 82",    "176 82",    "177 82",    "178 82",   "179 82",    "180 82",  "181 80",    "182 80"  ,  "183 80",    "184 80",    "185 80",    "186 80", "187 80",    "188 80"   , "189 80",    "190 80",    "191 80", "192 80", "193 80",    "194 80",    "195 80",  "196 80",    "197 80",    "198 80", "199 80",    "200 80",    "201 80",    "202 80",    "203 80",    "204 80", "205 80" ,   "206 80",    "207 80",    "208 80",    "209 80",   "210 80", "211 80",    "212 71",    "213 71",   "214 71" ,   "215 69",    "216 69", "217 69",    "218 69",    "219 69",     "220 69",    "221 98",    "222 98", "223 99",    "224 99",  "225 99",  "226 99",  "227 99",    "228 99", "229 99",    "230 99",    "231 99",    "232 51",    "233 51",    "234 51", "235 49"  ,  "236 49" ,   "237 99",    "238 99",    "239 99",    "240 99", "241 99"  ,  "242 99" ,   "243 99",  "244 99",  "245 99",    "246 99", "247 99", "248 99",      "249 99",    "250 99",    "251 99",    "252 99", "253 99",    "254 99",    "255 99",    "256 99",   "257 99",    "258 99", "259 99",    "260 99",    "261 99",    "262 99",    "263 99",    "264 99", "265 99",    "266 99",    "267 99",    "268 11",    "269 11",    "270 11", "271 11",    "272 08",    "273 08",    "274 08", "275 08",    "276 08", "277 08",    "278 08",    "279 08",    "280 08",    "281 08",    "282 08", "283 08",    "284 08"  ,  "285 08"  ,  "286 08",  "287 08",    "288 08", "289 08 ",   "290 08",   "291 08",    "292 08",    "293 08",    "294 08", "295 08",    "296 08",    "297 08",    "298 08",    "299 08",    "300 08", "301 08",  "302 08", "303 29"  ,  "304 29"  ,  "305 27",    "306 27", "307 27" ,   "308 27" ,   "309 27",    "310 27",    "311 27",    "312 27", "313 27",    "314 27",  "315 27",   "316 27", "317 27"  ,  "318 04", "319 04",    "320 04",    "321 04",    "322 04",    "323 04",    "324 04", "325 04",    "326 04",    "327 04",    "328 04",    "329 04" ,   "330 02", "331 02",       "332 02",    "333 02",    "334 02",  "335 02",  "336 02", "337 02",    "338 02",    "339 02",    "340 02",    "341 02",    "342 02", "343 02",    "344 02", "345 02",    "346 02",    "347 02",    "348 02", "349 02",    "350 02",    "351 02",    "352 02",    "353 02",    "354 02", "355 02"   , "356 02",    "357 02",    "358 02",    "359 02",    "360 02", "361 02",    "362 31",    "363 31",    "364 31",    "365 31",    "366 31", "367 31",    "368 31",    "369 31",    "370 31",    "371 29", "372 29", "373 29",    "374 29",    "375 29",    "376 29",    "377 29",    "378 29", "379 29",    "380 29",    "381 29",    "382 29",    "383 29",    "384 29", "385 29", "386 29",  "387 25",    "388 25",    "389 25",    "390 25", "391 25",    "392 25",    "393 25",  "394 25",    "395 25",    "396 23", "397 23",    "398 23",    "399 23", "400 63",    "401 63",    "402 63",  "403 63",    "404 61",    "405 61",    "406 61",    "407 61",   "408 99", "409 97",    "410 97",    "411 97",  "412 97",    "413 97",    "414 97",        "415 97",    "416 57",    "417 57",    "418 57",    "419 57",    "420 57", "421 57",    "422 57",    "423 57",    "424 55",    "425 95",    "426 95", "427 95",    "428 95",    "429 99",    "430 99",    "431 99",   "432 99", "433 99",    "434 99",    "435 99",    "436 99",    "437 99",    "438 99", "439 99",  "440 19", "441 19",    "442 19",    "443 19",    "444 19", "445 19",    "446 19",    "447 19",    "448 17",    "449 99",    "450 99", "451 99",    "452 99",    "453 99",    "454 99",    "455 99",    "456 99", "457 99",    "458 99",    "459 99",    "460 99",    "461 99",    "462 99", "463 99",    "464 99",    "465 99",    "466 99",    "467 99",    "468 45", "469 45",    "470 45",    "471 45",    "472 45"  ,  "473 45",    "474 43", "475 43",    "476 43", "477 43",    "478 35",    "479 35",    "480 33", "481 33",  "482 33",    "483 33",    "484 33",    "485 33",    "486 21", "487 21",    "488 21",    "489 21",    "490 21", "491 21",    "492 21", "493 21",    "494 21",    "495 21",    "496 21",    "497 21","498 21", "499 21",  "500 19",    "501 31",    "502 29",    "503 37",  "504 35", "505 47",    "506 47",    "507 47",    "508 47",    "509 23",    "510 23", "511 23",    "512 23",    "513 23",  "514 23",    "515 23",    "516 41", "517 39",    "518 69","519 69",  "520 49" , "521 99",    "522 99", "523 99",    "524 99",    "525 99",    "526 99",    "527 99",    "528 99", "529 99",    "530 99",    "531 55",    "532 55",    "533 55",    "534 55", "535 55",  "536 53",    "537 53",    "538 53", "539 53",    "540 67", "541 67",    "542 67",    "543 67",    "544 65",    "545 99",   "546 99", "547 99",    "548 99",    "549 99",    "550 99",    "551 99",    "552 99", "553 99",    "554 99",    "555 99",    "556 99",    "557 99",    "558 99", "559 99",    "560 99", "561 99",    "562 99",    "563 99",    "564 99", "565 99",    "566 99", "567 99",    "568 99",    "569 99",    "570 99", "571 99",    "572 99",    "573 99",   "574 41",    "575 99",    "576 99", "577 39",    "578 37",  "579 37",    "580 35", "581 99",        "582 99", "583 99",    "584 99",    "585 99",    "586 55",    "587 95",    "589 99", "590 99",    "591 99",    "592 99" ,  "593 99",  "594 99",  "595 99", "596 76",    "597 76",    "598 76",    "599 76",    "600 99",    "601 99", "602 47",    "603 47",    "604 47",    "605 47",    "606 47",    "607 47", "608 47",    "609 47", "610 47",    "611 47",  "612 47",  "613 47", "614 47",    "615 47", "616 47"  ,  "617 47"  ,  "618 47",    "619 47", "620 47",    "621 45",    "622 45",    "623 45", "624 45",    "625 45","626 45",    "627 94",    "628 94",    "629 94",   "630 94",    "631 92", "632 92",     "633 92",     "634 92",  "635 92",  "636 92",    "637 92", "638 92",    "639 92",    "640 92",  "641 92",    "642 92", "643 92", "644 92",    "645 92",    "646 78",  "647 78",    "648 36",    "649 34", "650 34", "651 32",    "652 32",  "653 32",    "654 18",    "655 18", "656 18",    "657 18",    "658 18"  ,  "659 10",  "660 10", "661 09",   "662 09",  "663 09",  "664 09",  "665 09" ,    "667 24",  "668 24",       "669 24",  "670 24", "671 22",  "672 22", "673 22",    "674 22",   "675 22",  "676 09", "677 07",  "678 07",  "679 07" ,   "680 62", "681 05",    "682 05",  "683 05",  "684 05",     "685 05",  "686 05", "687 05",  "688 05",  "689 05",    "690 03",    "700 18",  "701 18", "702 18",  "703 18",     "704 18",  "705 18",  "706 18",  "707 18",   "708 18",  "709 18",  "710 18",  "711 18",    "712 18",    "713 18", "714 18",  "715 18",  "716 18",  "717 18" ,   "718 18" ,   "719 18", "720 18",  "721 18",  "722 18",  "723 18",    "724 28",    "725 18", "726 18",  "727 10",    "728 14",  "729 03",    "730 03",     "731 03", "732 03" ,   "733 01",  "750 01",  "764 46",   "765 46", "766 34", "767 34", "768 34", "769 34" , "770 32", "771 32", "772 32");





var known_bogus = new Array("111111111",  "222222222",  "333333333",  "444444444",  "555555555", 

                     "666666666",  "777777777",  "888888888",  "999999999",  "000000000", 

                     "123456789",  "987654321",  "121212121",  "101010101",  "010101010", 

                     "002281852",  "042103580",  "062360749",  "078051120",  "095073645", 

                     "128036045",  "135016629",  "141186941",  "165167999",  "165187999",   

                     "165207999",  "165227999",  "165247999",  "189092294",  "212097694",   

                     "212099999",  "306302348",  "308125070",  "468288779",  "549241889" , "123456789" , "987654321"); 



function getLevelSSN(num) { 

  var level;

  if ( (num<10) && ((num%2)==1) ) level=1; 

  if ( (num>9) && ((num%2)==0) ) level=2; 

  if ( (num<10) && ((num%2)==0) ) level=3; 

  if ( (num>9) && ((num%2)==1) ) level=4; 

  return level; 

} 



function isValidSSN(ssn1) {

	//alert(ssn1);

  //global $ssn_data, $known_bogus; 

    var ssn = ssn1.replace("-", "");

	ssn=ssn.replace("-", "");

	//alert(ssn);

    var area = ssn.substring(0, 3); 

	//alert(area);

    var group = ssn.substring(3, 5); 

	//alert(group);

    var serial = ssn.substring(5, 9);

	//alert(serial);

	/*var myRe = /(\d{3}\s\d{2})/;

	var results=new Array();

    results = ssn_data.split(myRe);*/

  //preg_match_all("/(\d{3} \d{2})/",  $ssn_data,  $results,  PREG_SET_ORDER); 

  var group_val=new Array(); 

  var pass=true;

  //alert(results.length);

  var t=0;

  for(i=0;i<ssn_data.length;i++) { 

 /* if(ssn_data[i].length==6)

  {*/ 

  var temp = new Array(); 

  temp = ssn_data[i].split(' ');   

      group_val[temp[0]] =temp[1]; 

 // }

  } 

   //high=new Array();

  var high = group_val[area]; 

  var group_level = getLevelSSN(group); 

  var high_level = getLevelSSN(high); 

  //alert(high);

  //alert(group_level);

  //alert(high_level);

  //if (group_level<high_level) pass=true; 

   // if ( (group_level==high_level) && (group<=high) ) pass=true;  

  //if ( (area==0) || (group==0) || (serial==0) ) pass=false; 

   // if ( (area==666) || ( (area>699) && (area<729) ) || (area>899) ) pass=false; 

    if ( (ssn.length!=9) || (!parseInt(ssn)) ) pass=false; 

    for(i=0;i<known_bogus.length;i++) if (ssn==known_bogus[i]) pass=false; 
    //alert(pass);
    return pass; 

} 











function Isvalidaddress(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'0123456789-/. ";



var ValidCharcter="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.";



var Validnumber="0123456789";



var numflag=0;



var charflag=0;



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(charflag==0)



{



if(ValidCharcter.indexOf(Char)==-1)



{



charflag=0;



}



else



{



charflag=1;



}



}



if(numflag==0)



{



if(Validnumber.indexOf(Char)==-1)



{



numflag=0;



}



else



{



numflag=1;



}



}



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



if(IsText==true&&charflag==1&&numflag==1)



{



return true;



}



else



{



return false;



}



}



function toUpperFn(text){



var pattern=/(\w)(\w*)/;



var a=text.split(" ");



for(i=0;i<a.length;i++){



var length=a[i].length;



var firstLetter=a[i].substring(0,1);



firstLetter=firstLetter.toUpperCase();



var restOfWord=a[i].substring(1,length);



restOfWord=restOfWord.toLowerCase();



a[i]=firstLetter+restOfWord;



}



text=a.join(" ");



return text;



}



function Istextapostrophe(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.";



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



return IsText;



}



function Istextapostrophewtsp(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'. ";



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



return IsText;



}



function Istextblank(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. ";



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



return IsText;



}



function IsJOb(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'/-. ";



var IsText=true;



var Char;



for(i=0;i<sText.length&&IsText==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsText=false;



}



}



return IsText;



}



function IsNumeric(sText)



{



var ValidChars="0123456789.- ";



var IsNumber=true;



var Char;



for(i=0;i<sText.length&&IsNumber==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsNumber=false;



}



}



return IsNumber;



}



function IsOnlyNumeric1(sText)



{



var ValidChars="0123456789";



var IsNumber=true;



var Char;



for(i=0;i<sText.length&&IsNumber==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsNumber=false;



}



}



return IsNumber;



}



function IsNumeric1(sText)



{



var ValidChars="0123456789.-()";



var IsNumber=true;



var Char;



for(i=0;i<sText.length&&IsNumber==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsNumber=false;



}



}



return IsNumber;



}



function echeckemail(str){



var at="@";



var dot=".";



var lat=str.indexOf(at);



var lstr=str.length;



var ldot=str.indexOf(dot);



if(str.indexOf(at)==-1){



return false;



}



if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){



return false;



}



if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){



return false;



}



if(str.indexOf(at,(lat+1))!=-1){



return false;



}



if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(dot,(lat+2))==-1){



return false;



}



if(str.indexOf(" ")!=-1){



return false;



}



return true;



}



function IsNumeric2(sText)



{



var ValidChars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789. ";



var IsNumber=true;



var Char;



for(i=0;i<sText.length&&IsNumber==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{







IsNumber=false;



}



}



return IsNumber;



}



function echeck(str){



var at="@";



var dot=".";



var lat=str.indexOf(at);



var lstr=str.length;



var ldot=str.indexOf(dot);



if(str.indexOf(at)==-1){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(at,(lat+1))!=-1){



alert("Invalid E-mail ID");



return false;



}



if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(dot,(lat+2))==-1){



alert("Invalid E-mail ID");



return false;



}



if(str.indexOf(" ")!=-1){



alert("Invalid E-mail ID");



return false;



}



return true;



}



function trim(s)



{



var temp=s;



return temp.replace(/^\s+/,'').replace(/\s+$/,'');



}



function validation()



{



if(trim(document.getElementById("fname").value)=="")



{



alert("Please Enter Your Firstname");



document.getElementById("fname").focus();



return false;



}



if(!Istext(document.getElementById("fname").value))



{



alert('Invalid Firstname');



document.getElementById("fname").focus();



return false;



}



if(trim(document.getElementById("lname").value)=="")



{





alert("Please Enter Your Lastname");



document.getElementById("lname").focus();



return false;



}



if(!Istext(document.getElementById("lname").value))



{



alert('Invalid Lastname');



document.getElementById("lname").focus();



return false;



}



if(trim(document.getElementById("address1").value)=="")



{



alert("Please Enter Your Address");



document.getElementById("address1").focus();



return false;



}



if(trim(document.getElementById("city").value)=="")



{



alert("Please Enter Your City");



document.getElementById("city").focus();



return false;



}



if(trim(document.getElementById("state").value)=="")



{



alert("Please Select Your State");



document.getElementById("state").focus();



return false;



}



if(trim(document.getElementById("zip").value)=="")



{



alert("Please Enter Your Zip Code");



document.getElementById("zip").focus();



return false;



}



if(!IsNumeric2(document.getElementById("zip").value))



{



alert('Invalid Zip Code');



document.getElementById("zip").focus();



return false;



}



if(trim(document.getElementById("zip").value)=="")



{



alert("Please Enter Your Zip Code");



document.getElementById("zip").focus();



return false;



}



if((document.getElementById("zip").value).length>5)



{



alert("Please Enter Valid Zip Code");



document.getElementById("zip").focus();



return false;



}



if(trim(document.getElementById("homeyear").value)=="")



{



alert("Please Select The Time At Residence");



document.getElementById("homeyear").focus();



return false;



}



if(trim(document.getElementById("homemonth").value)=="")



{



alert("Please Select The Time At Residence");



document.getElementById("homemonth").focus();



return false;



}



if((document.getElementById("homeyear").value==0)&&(document.getElementById("homemonth").value==0))



{



alert("Please Select Valid Time At Residence");



document.getElementById("homeyear").focus();



return false;



}



if(trim(document.getElementById("homephone").value)=="")



{



alert("Please Enter Your Homephone No");



document.getElementById("homephone").focus();



return false;



}



if(!IsNumeric1(document.getElementById("homephone").value))



{



alert('Invalid Phone No');



document.getElementById("homephone").focus();



return false;



}



if((document.getElementById("homephone").value).length>14)



{



alert("Please Enter Valid Homephone No");



document.getElementById("homephone").focus();



return false;



}



if((document.getElementById("homephone").value).length<10)



{



alert("Please Enter Valid Homephone No");



document.getElementById("homephone").focus();



return false;



}



if(trim(document.getElementById("email").value)=="")



{



alert("Please Enter Your Email Id");



document.getElementById("email").focus();



return false;



}



if(echeck(document.getElementById("email").value)==false){



document.getElementById("email").value="";



document.getElementById("email").focus();



return false;



}



if(trim(document.getElementById("workphone").value)=="")



{



alert("Please Enter Your Workphone No");



document.getElementById("workphone").focus();



return false;



}



if(!IsNumeric1(document.getElementById("workphone").value))



{



alert('Invalid Phone No');



document.getElementById("workphone").focus();



return false;



}



if((document.getElementById("workphone").value).length>14)



{



alert("Please Enter Valid Workphone No");



document.getElementById("workphone").focus();



return false;



}



if((document.getElementById("workphone").value).length<10)



{



alert("Please Enter Valid Workphone No");



document.getElementById("workphone").focus();



return false;



}



if(trim(document.getElementById("ssn").value)=="")



{



alert("Please Enter Your Social Security #");



document.getElementById("ssn").focus();



return false;



}



if(!IsNumeric1(document.getElementById("ssn").value))



{



alert('Invalid Social Security #');



document.getElementById("ssn").focus();



return false;



}



if((document.getElementById("ssn").value).length>11)



{



alert("Please Enter Valid SSN ");



document.getElementById("ssn").focus();



return false;



}



if((document.getElementById("ssn").value).length<9)



{



alert("Please Enter Valid SSN ");



document.getElementById("ssn").focus();



return false;



}



if(trim(document.getElementById("bmonth").value)=="")



{



alert("Please Enter Your DOB Properly");



document.getElementById("bmonth").focus();



return false;



}



if(trim(document.getElementById("bday").value)=="")



{



alert("Please Enter Your DOB Properly");



document.getElementById("bday").focus();



return false;



}



if(trim(document.getElementById("byear").value)=="")



{



alert("Please Enter Your DOB Properly");



document.getElementById("byear").focus();



return false;



}



if(trim(document.getElementById("employername").value)=="")



{



alert("Please Enter Your company Name");



document.getElementById("employername").focus();



return false;



}



if(trim(document.getElementById("yourjobtitle").value)=="")



{



alert("Please Enter Your Job Title");



document.getElementById("yourjobtitle").focus();



return false;



}



if(trim(document.getElementById("monthlyincome").value)=="")



{



alert("Please Enter Your Monthly Income");



document.getElementById("monthlyincome").focus();



return false;



}



if(!IsNumeric(document.getElementById("monthlyincome").value))



{



alert('Invalid Gross Monthly Income');



document.getElementById("monthlyincome").focus();



return false;



}



if(document.getElementById("jobyear").value=="")



{



alert("Please Select How long You Are In The Job");



document.getElementById("jobyear").focus();



return false;



}



if(document.getElementById("jobmonth").value=="")



{



alert("Please Select How long You Are In The Job");



document.getElementById("jobmonth").focus();



return false;



}



if((document.getElementById("jobyear").value==0)&&(document.getElementById("jobmonth").value==0))



{



alert("Please Select Valid Time At Job");



document.getElementById("jobyear").focus();



return false;



}



if(trim(document.getElementById("monthlypayment").value)=="")



{



alert("Please Enter Residence Monthly Payment");



document.getElementById("monthlypayment").focus();



return false;



}



if(!IsNumeric(document.getElementById("monthlypayment").value))



{



alert('Invalid Residence Monthly Payment');



document.getElementById("monthlypayment").focus();



return false;



}



if(trim(document.getElementById("rent_or_own").value)=="")



{



alert("Please Select Your residence Type");



document.getElementById("rent_or_own").focus();



return false;



}



if(document.getElementById("bankruptcy").value=="")



{



alert("Please Select whether Bankrupt In Last 7 Years");



document.getElementById("bankruptcy").focus();



return false;



}



if(document.getElementById("cosigner").value=="")



{



alert("Please Select whether You Have A Co-borrower");



document.getElementById("cosigner").focus();



return false;



}



if(!(document.getElementById("agreetopolicy").checked))



{



alert("You should Agree With Our Terms Of Use");



document.getElementById("agreetopolicy").focus();



return false;



}



return true;



}



var arErrorBlank=new Array();



arErrorBlank[0]="First name is required";



arErrorBlank[1]="Last name is required";



arErrorBlank[2]="Residence address is required";



arErrorBlank[3]="Zip code is required";



arErrorBlank[4]="City is required";



arErrorBlank[5]="State is required";



arErrorBlank[6]="Time at Residence is required";



arErrorBlank[7]="Home phone is required";



arErrorBlank[8]="E-mail is required";



arErrorBlank[9]="Work phone is required";



arErrorBlank[10]="Social Security is required";



arErrorBlank[11]="Date of birth is required";



arErrorBlank[12]="Employer's name is required";



arErrorBlank[13]="Job title is required";



arErrorBlank[14]="Gross monthly income is required";



arErrorBlank[15]="Time at job is required";



arErrorBlank[16]="Residence monthly payment  is required";



arErrorBlank[17]="Residence type  is required";



arErrorBlank[18]="This information is required";



arErrorBlank[19]="This information is required";



var arErrorFill=new Array();



arErrorFill[0]="Only letters and apostrophes are allowed for First Name";



arErrorFill[1]="Only letters and apostrophes are allowed for Last Name";



arErrorFill[2]="Residence address is required";



arErrorFill[3]="Only numeric are allowed for Zip. And length must be less then 5 digit";



arErrorFill[4]="Only letters, spaces are allowed";



arErrorFill[5]="State is required";



arErrorFill[6]="Time at Residence is required";



arErrorFill[7]="Only numeric are allowed for Home Phone";



arErrorFill[8]="E-mail format is wrong";



arErrorFill[9]="Only numeric are allowed for Work phone";



arErrorFill[10]="Only numeric are allowed for Social Security And length must be less then 5 digit";



arErrorFill[11]="Date of birth is required";



arErrorFill[12]="Only letters and apostrophes are allowed for Employer's name";



arErrorFill[13]="Job title is required";



arErrorFill[14]="Only numeric are allowed for Gross monthly";



arErrorFill[15]="Time at job is required";



arErrorFill[16]="Only numeric are allowed for Residence monthly payment";



arErrorFill[17]="Residence type  is required";



arErrorFill[18]="This information is required";



arErrorFill[19]="This information is required";



var Flagfname=false;



var Flaglname=false;



var Flagaddress1=false;



var Flagzip=false;



var Flagcity=false;



var Flaghomephone=false;



var Flagemail=false;



var Flageworkphone=false;



var Flagessn=false;



var Flageemployername=false;



var Flageyourjobtitle=false;



var Flagemonthlyincome=false;



var Flagemonthlypayment=false;



function valid1()



{



var ValidChars="0123456789";



var IsNumber=true;



var Char;



var sText=document.getElementById("zip").value;



if(sText.length!=5)



{



return false;



}



else



{



for(i=0;i<5&&IsNumber==true;i++)



{



Char=sText.charAt(i);



if(ValidChars.indexOf(Char)==-1)



{



IsNumber=false;



}



}



if(IsNumber==false)



{



return false;



}



}



return true;



}



var status="true";



var goID;



var TLD;



var xmlHttp,xmlHttp1;



function GetXmlHttpObject()



{



var objXMLHttp=null;



if(window.XMLHttpRequest)



{



objXMLHttp=new XMLHttpRequest();



}



else if(window.ActiveXObject)



{



try



{



objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");



}catch(e)



{



try



{



objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");



}catch(e)



{



objXMLHttp=false;



}



}



}



return objXMLHttp;



}



function call(val)



{



xmlHttp=GetXmlHttpObject()



var str=val;



if(xmlHttp==null)



{



alert("Browser does not support HTTP Request");



return



}



if(str.length==5)



{



var url="state.php";



url=url+"?zip="+str;



url=url+"&sid="+Math.random();



xmlHttp.onreadystatechange=stateChanged2;



xmlHttp.open("GET",url,true);



xmlHttp.send(null);



}



else



{



document.getElementById("city").value="";



document.getElementById("state").value="";



}



}



function stateChanged2()



{



if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")



{



var dat=xmlHttp.responseText;



var arr=dat.split("@");



document.getElementById("sta").innerHTML=arr[0];



document.getElementById("city").value=arr[1];



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById("zipimg").style.visibility="visible";



document.getElementById("errorzi").className="";



document.getElementById("errorzi").innerHTML="<strong>Zip Code</strong>";



document.getElementById("errorzip").style.visibility="hidden";



document.getElementById("errorzip").style.position="absolute";



document.getElementById("zipimg").src="css_images/carloan_check.gif";



shiftOpacity("zipimg",4000);



if(arr[1]!="")



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById("cityimg").style.visibility="visible";



document.getElementById("errorci").className="";



document.getElementById("errorci").innerHTML="<strong>City</strong>";



document.getElementById("errorcity").style.visibility="hidden";



document.getElementById("errorcity").style.position="absolute";



document.getElementById("cityimg").src="css_images/carloan_check.gif";



shiftOpacity("cityimg",4000);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById("stateimg").style.visibility="visible";



document.getElementById("errorst").className="";



document.getElementById("errorst").innerHTML="<strong>State</strong>";



document.getElementById("errorstate").style.visibility="hidden";



document.getElementById("errorstate").style.position="absolute";



document.getElementById("stateimg").src="css_images/carloan_check.gif";



shiftOpacity("stateimg",4000);



document.getElementById("homeyear").focus();



}



else



{



document.getElementById("city").focus();



}



}



}



function field_description(ObjId1)



{



if(ObjId1!="SSN-1"&&ObjId1!="SSN-2"&&ObjId1!="homeyear"&&ObjId1!="HOMEPHONE-2"&&ObjId1!="HOMEPHONE-1"&&ObjId1!="WORKPHONE-2"&&ObjId1!="WORKPHONE-1"&&ObjId1!="bmonth"&&ObjId1!="bday"&&ObjId1!="jobyear")



{



var imgid=ObjId1+"img";



document.getElementById(imgid).style.visibility="hidden";



}



if(ObjId1=="ssn"||ObjId1=="byear"||ObjId1=="SSN-1"||ObjId1=="SSN-2"||ObjId1=="bmonth"||ObjId1=="bday")



{



bgimage='url(css_images/carloan_desc_arrow111.gif)';



document.getElementById("lyDESC").style.backgroundImage=bgimage;



}



else



{



bgimage='url(css_images/carloan_desc_arrow.gif)';



document.getElementById("lyDESC").style.backgroundImage=bgimage;



}



var ObjTop=findPos(document.getElementById(ObjId1));



var ObjLeft=findPosLeft(document.getElementById(ObjId1));



var ObjSize=0;



ObjSize=document.getElementById(ObjId1).offsetWidth;



var posLeft=ObjLeft+ObjSize+1;



document.getElementById("lyDESC").style.top=ObjTop+"px";



document.getElementById("lyDESC").style.left=(posLeft+2)+"px";



document.getElementById("lyDESC").style.visibility="visible";



}



function sahiSendToServer()



{



try{



var http=GetXmlHttpObject();



var url="state.php";



http.open("GET",url,false);



http.send(null);



return http.responseText;



}catch(ex)



{throw ex;}



}



var ferror=0;



var lerror=0;



function field_onchange(ObjId,TdId)



{



if(status=="false")



{



return false;



}



var imgid=ObjId+"img";



var errordisplay="error"+ObjId;

var errortd="errortd"+ObjId;



if(ObjId=="fname")



{



if(document.getElementById("fname").value!="")



{



var tid="textbox"+ObjId;



if(!Istextapostrophewtsp(document.getElementById("fname").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;First Name";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="only letters and apostrophes allowed for this field";



}



else



{



document.getElementById("fname").value=toUpperFn(document.getElementById("fname").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>First Name</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="lname")



{



if(document.getElementById("lname").value!="")



{



var tid="textbox"+ObjId;



if(!Istextapostrophewtsp(document.getElementById("lname").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Last Name";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="only letters and apostrophes allowed for this field";



}



else



{



document.getElementById("lname").value=toUpperFn(document.getElementById("lname").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Last Name</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="address1")



{



if(document.getElementById("address1").value!="")



{



document.getElementById("address1").value=toUpperFn(document.getElementById("address1").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Residence Address</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="zip")



{



if(document.getElementById("zip").value!="")



{



var flag=valid1();



if(flag)



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Zip Code</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



else



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Zip Code";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Must contain only 5 numeric digits";



}



}



}



if(ObjId=="city")



{



if(document.getElementById("city").value!="")



{



if(!Istextapostrophewtsp(document.getElementById("city").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;City";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="only letters and apostrophes allowed for this field";



}



else



{



document.getElementById("city").value=toUpperFn(document.getElementById("city").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>City</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="state")



{



if(document.getElementById("state").value=="")



{



if(!Istext(document.getElementById("state").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please select state";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>State</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="homeyear")



{



if(document.getElementById("homeyear").value=="")
{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time At Residence";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="please select year ";
}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Time At Residence</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="homephone")



{



if(trim(document.getElementById("homephone").value)!="")



{



	var hom=document.getElementById("homephone").value+document.getElementById("HOMEPHONE-1").value+document.getElementById("HOMEPHONE-2").value;



	var homflag=0;



	var c=1;



	while(c<hom.length)



	{



		if(hom.substr(c-1,1)==hom.substr(c,1))



		{



			homflag=1;	



		}



		else



		{



			homflag=0;



			break;



		}



		c++;



	}



if((!IsOnlyNumeric1(document.getElementById("homephone").value))||(!IsOnlyNumeric1(document.getElementById("HOMEPHONE-1").value))||(!IsOnlyNumeric1(document.getElementById("HOMEPHONE-2").value))||



(document.getElementById("homephone").value.length!=4)||(document.getElementById("HOMEPHONE-1").value.length!=3)||(document.getElementById("HOMEPHONE-2").value.length!=3))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home Phone";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="please input number EX-(111-234-1234)";



}



else



if(homflag==1)



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Home Phone";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Invalid number sequence EX-(111-234-1234)";





}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Home Phone</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";









document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="email")



{



if(document.getElementById("email").value!="")



{



document.getElementById("lyDESC").style.visibility="hidden";



if(echeckemail(document.getElementById("email").value)==false)



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Email";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="not a proper email address";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Email</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="workphone")



{



if(trim(document.getElementById("workphone").value)!="")



{



	var wor=document.getElementById("workphone").value+document.getElementById("WORKPHONE-1").value+document.getElementById("WORKPHONE-2").value;



	var worflag=0;



	var c=1;



	while(c<wor.length)



	{



		if(wor.substr(c-1,1)==wor.substr(c,1))



		{



			worflag=1;	



		}



		else



		{



			worflag=0;



			break;



		}



		c++;



	}



if((!IsOnlyNumeric1(document.getElementById("workphone").value))||(!IsOnlyNumeric1(document.getElementById("WORKPHONE-1").value))||(!IsOnlyNumeric1(document.getElementById("WORKPHONE-2").value))||



(document.getElementById("workphone").value.length!=4)||(document.getElementById("WORKPHONE-1").value.length!=3)||(document.getElementById("WORKPHONE-2").value.length!=3))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Work Phone";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="please input number EX-(111-234-1234)";











}



else



if(worflag==1)



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Work Phone";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Invalid number sequence EX-(111-234-1234)";









}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>WORK Phone</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";





document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="ssn")



{

	

	if(trim(document.getElementById("SSN-1").value)!=""  )



{



	var worssn=document.getElementById("SSN-1").value+document.getElementById("SSN-2").value+document.getElementById("ssn").value;



	var worflagssn=0;



	var c=1;



	while(c<worssn.length)



	{



		if(worssn.substr(c-1,1)==worssn.substr(c,1))



		{



			worflagssn=1;	



		}



		else



		{



			worflagssn=0;



			break;



		}



		c++;



	}

}



if(trim(document.getElementById("ssn").value)!="")



{



	var flagssn=document.getElementById("SSN-1").value+"-"+document.getElementById("SSN-2").value+"-"+document.getElementById("ssn").value;



if((!IsOnlyNumeric1(document.getElementById("ssn").value))||(!IsOnlyNumeric1(document.getElementById("SSN-1").value))||(!IsOnlyNumeric1(document.getElementById("SSN-2").value))||



(document.getElementById("ssn").value.length!=4)||(document.getElementById("SSN-1").value.length!=3)||(document.getElementById("SSN-2").value.length!=2)||!isValidSSN(flagssn) )



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG";



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Social Security";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="please input valid ssn number EX-(111-23-1234)";



}



else

	if(worflagssn==1)

{

	document.getElementById(imgid).style.visibility="hidden";



	document.getElementById(imgid).src="images/space.JPG";

	

	document.getElementById(TdId).className="orange";

	

	document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Social Security";

	

	document.getElementById(errordisplay).style.visibility="visible";

	

	document.getElementById(errordisplay).style.position="relative";

	document.getElementById(errortd).innerHTML="Invalid  sequence of ssn number EX-(111-23-1234)";



}

else

{

document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Social Security</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="byear")



{



if(document.getElementById("byear").value==""||document.getElementById("bday").value==""||document.getElementById("bmonth").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date of Birth";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please select  month , day &amp; year";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Date of Birth</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="employername")



{



if(document.getElementById("employername").value!="")



{



if(!IsJOb(document.getElementById("employername").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Employers Name (company)";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="only letters and apostrophes allowed for this field";



}



else



{



document.getElementById("employername").value=toUpperFn(document.getElementById("employername").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Employers Name (company)</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="yourjobtitle")



{



if(document.getElementById("yourjobtitle").value!="")



{



if(!IsJOb(document.getElementById("yourjobtitle").value))



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Job Title";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Only letters ,number ,/,-, apostrophe";



}



else



{



document.getElementById("yourjobtitle").value=toUpperFn(document.getElementById("yourjobtitle").value);



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Job Title</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



if(ObjId=="monthlyincome")



{



if(document.getElementById("monthlyincome").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gross Monthly Income";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please Select Gross Monthly Income";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Gross Monthly Income</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="jobyear")



{



if(document.getElementById("jobyear").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time At Job";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please select year  ";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Time At Job</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="monthlypayment")



{



if(document.getElementById("monthlypayment").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Monthly rent or mortgage amount";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please Select Monthly rent";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Monthly rent or mortgage amount</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="rent_or_own")



{



if(document.getElementById("rent_or_own").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Residence Type";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please Select Residence Type";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Residence Type</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="bankruptcy")



{



if(document.getElementById("bankruptcy").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bankrupt in the past 7 years";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";

document.getElementById(errortd).innerHTML="Please Select Bankrupt in the past 7 years";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



document.getElementById(TdId).innerHTML="<strong>Bankrupt in the past 7 years</strong>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



if(ObjId=="cosigner")



{



if(document.getElementById("cosigner").value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Will you have a co-borrower ?";



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";



document.getElementById(errortd).innerHTML="Please Select co-borrower";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";


var cont='"<strong> co-borrower </strong> <br/><br/> Additional borrower(s) whose<br/>income and credit contributes to<br/>qualifing for the loan and whose<br/>name(s) appears on the loan <br/>documents."';
document.getElementById(TdId).innerHTML="<strong>Will you have a <a   style='cursor:pointer;' onMouseover='ddrivetip(" + cont + ", 200)'; onMouseout='hideddrivetip()'> <u>co-borrower</u></a> ?</strong></span>";



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



}



function chkDD(ObjDDID,TableID,imgID,TdId)



{



var imgid=imgID;



var errordisplay=TableID;



var errortd="errortd"+ObjDDID;



if(document.getElementById(ObjDDID).value=="")



{



document.getElementById(imgid).style.visibility="hidden";



document.getElementById(imgid).src="images/space.JPG"



document.getElementById(TdId).className="orange";



if(ObjDDID=="state")



{



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;State";

document.getElementById(errortd).innerHTML="Please select state";



}



if(ObjDDID=="homeyear"||ObjDDID=="homemonth")



{



document.getElementById(TdId).innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time At residence";



}



document.getElementById(errordisplay).style.visibility="visible";



document.getElementById(errordisplay).style.position="relative";



}



else



{



document.getElementById("lyDESC").style.visibility="hidden";



document.getElementById(imgid).style.visibility="visible";



document.getElementById(TdId).className="";



if(ObjDDID=="state")



{



document.getElementById(TdId).innerHTML="<strong>State</strong>";



}



if(ObjDDID=="homeyear"||ObjDDID=="homemonth")



{



document.getElementById(TdId).innerHTML="<strong>Time At residence</strong>";



}



document.getElementById(errordisplay).style.visibility="hidden";



document.getElementById(errordisplay).style.position="absolute";



document.getElementById(imgid).src="css_images/carloan_check.gif";



shiftOpacity(imgid,4000);



}



}



function field_description_hidden()



{



document.getElementById("lyDESC").style.visibility="hidden";



}



function findPos(obj){



var curtop=0;



if(obj.offsetParent){



do{



curtop+=obj.offsetTop;



}while(obj=obj.offsetParent);



}



return curtop;



}



function findPosLeft(obj){



var curleft=0;



if(obj.offsetParent){



do{



curleft+=obj.offsetLeft;



}while(obj=obj.offsetParent);



}



return curleft;



}



function opacity(id,opacStart,opacEnd,millisec){



var speed=Math.round(millisec/100);



var timer=0;



if(opacStart>opacEnd){



for(i=opacStart;i>=opacEnd;i--){



setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));



timer++;



}



}else if(opacStart<opacEnd){



for(i=opacStart;i<=opacEnd;i++)



{



setTimeout("changeOpac("+i+",'"+id+"')",(timer*speed));



timer++;



}



}



}



function changeOpac(opacity,id){



var object=document.getElementById(id).style;



object.opacity=(opacity/100);



object.MozOpacity=(opacity/100);



object.KhtmlOpacity=(opacity/100);



object.filter="alpha(opacity="+opacity+")";



}



function shiftOpacity(id,millisec){



opacity(id,100,0,millisec);



}



function shiftOpacity1(id,millisec){



opacity(id,0,100,millisec);



}



var field_length=0;



function TabNext(obj,event,len,next_field){



if(!next_field){return;}



if(event=="down"){



field_length=obj.value.length;



}



else if(event=="up"){



if(obj.value.length!=field_length){



field_length=obj.value.length;



if(field_length==len){



next_field.focus();



}



}



}



}



