﻿var sAreaCodes = "|248|250|251|252|253|254|256|260|262|267|269|270|276|281|289|301|302|303|304|305|306|307|308|309|310|312|313|314|315|316|317|318|319|320|321|323|325|330|334|336|337|339|347|351|352|360|361|385|386|401|402|403|404|405|406|407|408|409|410|412|413|414|415|416|585|586|601|602|603|604|605|606|607|608|609|610|612|613|614|615|616|617|618|619|620|623|626|630|631|636|641|646|647|650|651|660|661|662|678|682|701|702|703|704|705|706|707|815|816|817|818|819|822|828|830|831|832|833|843|844|845|847|848|850|855|856|857|858|859|860|862|863|864|865|866|867|870|877|878|888|901|902|903|904|905|906|907|908|909|910|912|913|914|915|916|917|918|919|920|925|928|931|936|937|940|941|947|949|951|952|954|956|970|971|972|973|978|979|980|985|989|201|202|203|204|205|206|207|208|209|210|212|213|214|215|216|217|218|219|224|225|226|228|229|231|234|239|240|417|418|419|423|425|430|432|434|435|438|440|443|450|469|478|479|480|484|501|502|503|504|505|506|507|508|509|510|512|513|514|515|516|517|518|519|520|530|540|541|551|559|561|562|563|567|570|571|573|574|580|708|709|710|712|713|714|715|716|717|718|719|720|724|727|731|732|734|740|754|757|760|763|765|770|772|773|774|775|778|780|781|785|786|800|801|802|803|804|805|806|807|808|810|812|813|814|";
var sZipCodeBegs3 = "000|001|002|003|004|006|007|008|009|090|091|092|093|094|095|096|097|098|099|213|269|340|343|345|348|353|419|428|429|517|518|519|529|533|536|552|568|578|579|589|621|632|642|643|659|663|682|694|695|696|697|698|699|702|709|715|732|742|771|817|818|819|839|848|849|851|854|858|861|862|866|867|868|869|872|876|886|887|888|892|896|899|909|929|962|963|964|965|966|969|987";
var sZipCodeBegs4 = "0051|0052|0053|0055|0056|0057|0058|0059|0116|0117|0118|0121|0128|0129|0131|0132|0139|0140|0141|0148|0149|0162|0163|0164|0166|0167|0168|0169|0179|0199|0200|0225|0227|0231|0239|0240|0241|0243|0250|0251|0252|0259|0261|0262|0268|0269|0275|0293|0295|0296|0297|0298|0299|0300|0301|0302|0309|0312|0313|0314|0315|0316|0317|0318|0319|0320|0331|0332|0333|0334|0335|0336|0337|0338|0339|0340|0341|0342|0348|0349|0350|0351|0352|0353|0354|0355|0361|0362|0363|0364|0365|0366|0367|0368|0369|0370|0371|0372|0373|0379|0392|0393|0394|0395|0396|0397|0398|0399|0413|0414|0415|0416|0417|0418|0419|0420|0430|0431|0432|0437|0438|0439|0450|0451|0452|0458|0459|0470|0471|0472|0479|0480|0481|0482|0483|0487|0488|0489|0501|0502|0511|0512|0513|0517|0518|0519|0521|0522|0523|0524|0527|0528|0529|0531|0532|0533|0537|0538|0539|0541|0542|0551|0552|0553|0555|0556|0557|0558|0559|0561|0569|0571|0572|0578|0579|0580|0588|0589|0591|0592|0593|0594|0595|0596|0597|0598|0599|0620|0621|0629|0630|0631|0655|0656|0657|0658|0659|0662|0663|0664|0666|0668|0673|0693|0694|0695|0696|0697|0698|0699|0712|0713|0714|0715|0716|0721|0722|0723|0724|0725|0726|0727|0728|0729|0732|0733|0734|0735|0736|0737|0738|0755|0756|0757|0758|0759|0761|0768|0778|0781|0791|0812|0813|0814|0815|0816|0817|0818|0819|0828|0829|0837|0838|0839|0841|0842|0843|0844|0845|0846|0847|0848|0849|0857|0858|0859|0868|0871|0876|0877|0878|0879|0891|0894|0895|0896|0897|0899|1022|1023|1032|1033|1034|1035|1036|1037|1038|1039|1040|1041|1042|1043|1044|1048|1062|1063|1064|1065|1066|1067|1068|1069|1072|1073|1074|1075|1076|1077|1078|1079|1081|1082|1083|1084|1085|1086|1087|1088|1089|1106|1107|1108|1111|1113|1114|1115|1116|1117|1118|1119|1126|1127|1128|1129|1130|1131|1132|1133|1134|1144|1146|1147|1148|1160|1161|1162|1163|1164|1165|1166|1167|1168|1182|1183|1184|1186|1187|1188|1189|1191|1192|1199|1227|1229|1231|1233|1235|1236|1237|1238|1239|1261|1262|1263|1264|1265|1266|1267|1268|1269|1289|1300|1301|1317|1318|1319|1327|1328|1337|1338|1339|1351|1352|1353|1354|1355|1356|1357|1358|1370|1371|1372|1387|1388|1389|1391|1392|1393|1394|1395|1396|1397|1398|1399|1418|1419|1425|1429|1431|1432|1433|1434|1435|1436|1437|1438|1439|1440|1449|1479|1491|1493|1494|1495|1496|1497|1498|1499|1515|1516|1517|1518|1519|1539|1557|1558|1559|1579|1581|1588|1589|1597|1598|1599|1607|1608|1609|1618|1619|1627|1628|1629|1639|1645|1646|1648|1649|1657|1658|1659|1671|1676|1677|1678|1679|1681|1689|1696|1697|1698|1699|1715|1716|1718|1719|1728|1729|1738|1739|1742|1743|1744|1745|1746|1747|1748|1749|1759|1762|1763|1764|1765|1766|1767|1768|1771|1778|1779|1789|1791|1799|1811|1812|1813|1814|1815|1816|1818|1826|1827|1828|1829|1831|1838|1839|1848|1849|1853|1855|1856|1858|1859|1867|1868|1872|1873|1874|1875|1878|1879|1886|1887|1888|1889|1920|1921|1922|1923|1926|1927|1928|1929|1957|1958|1959|1962|1963|1965|1966|1967|1968|1969|1974|1975|1976|1977|1978|1979|1982|1983|1984|1986|1987|1991|1992|1999|2032|2036|2048|2049|2080|2092|2093|2094|2095|2096|2097|2098|2117|2118|2119|2142|2143|2144|2145|2146|2147|2148|2149|2151|2157|2158|2159|2188|2194|2195|2196|2197|2198|2199|2205|2214|2225|2226|2227|2228|2229|2234|2235|2236|2237|2238|2239|2249|2259|2267|2268|2269|2275|2276|2277|2278|2279|2286|2287|2288|2289|2299|2320|2336|2337|2349|2353|2356|2357|2358|2359|2364|2371|2372|2373|2374|2375|2376|2377|2378|2379|2381|2398|2399|2419|2439|2449|2466|2467|2468|2469|2476|2477|2478|2479|2522|2529|2534|2545|2546|2547|2548|2549|2558|2559|2573|2574|2576|2578|2579|2589|2599|2601|2602|2608|2609|2611|2619|2631|2639|2647|2648|2649|2664|2677|2678|2679|2687|2689|2706|2707|2708|2714|2716|2717|2718|2738|2744|2746|2747|2768|2773|2774|2775|2776|2777|2778|2779|2799|2806|2818|2819|2849|2882|2883|2884|2885|2886|2887|2888|2889|2891|2892|2893|2894|2895|2896|2897|2898|2899|2909|2919|2927|2928|2975|2976|2977|2978|2979|2987|2988|2995|2996|2997|2998|2999|3019|3048|3069|3076|3077|3078|3079|3084|3085|3086|3087|3088|3089|3092|3093|3094|3095|3096|3097|3098|3116|3117|3118|3123|3124|3125|3126|3127|3128|3134|3135|3136|3137|3138|3139|3143|3144|3145|3146|3147|3148|3149|3157|3158|3161|3166|3167|3168|3184|3185|3186|3187|3188|3189|3192|3193|3194|3195|3196|3197|3198|3228|3237|3238|3247|3248|3249|3267|3284|3298|3299|3320|3321|3322|3327|3336|3337|3379|3415|3416|3417|3418|3419|3440|3441|3462|3464|3490|3491|3492|3493|3496|3510|3519|3541|3542|3543|3551|3552|3553|3568|3570|3571|3572|3578|3579|3583|3584|3585|3586|3587|3588|3591|3592|3593|3594|3615|3616|3618|3622|3623|3624|3629|3638|3639|3641|3649|3671|3681|3682|3688|3689|3693|3694|3695|3696|3697|3698|3699|3700|3726|3727|3728|3729|3743|3744|3746|3747|3748|3749|3751|3752|3753|3755|3756|3757|3758|3759|3763|3767|3778|3779|3796|3797|3798|3809|3821|3829|3841|3843|3849|3851|3852|3853|3859|3869|3871|3879|3881|3889|3897|3898|3899|3900|3901|3902|3924|3931|3937|3938|3939|3941|3949|3951|3961|3967|3968|3969|3972|3978|3979|3980|3991|3992|3993|3994|3995|3996|3997|3998|3999|4008|4009|4013|4018|4019|4030|4056|4063|4064|4065|4066|4067|4068|4069|4071|4078|4079|4088|4089|4119|4128|4129|4132|4137|4144|4148|4149|4158|4159|4167|4168|4169|4178|4179|4187|4188|4189|4201|4209|4211|4218|4219|4229|4231|4238|4239|4247|4248|4249|4257|4258|4259|4261|4266|4267|4268|4269|4279|4317|4318|4337|4338|4339|4347|4348|4349|4358|4359|4364|4367|4385|4386|4387|4388|4389|4399|4415|4416|4429|4434|4435|4436|4438|4452|4453|4454|4456|4457|4458|4459|4474|4477|4478|4491|4492|4493|4494|4495|4496|4497|4498|4508|4509|4518|4519|4551|4552|4553|4554|4555|4556|4557|4558|4559|4579|4590|4591|4592|4593|4594|4595|4596|4597|4598|4602|4609|4619|4633|4642|4643|4644|4645|4646|4647|4648|4649|4664|4665|4667|4687|4705|4707|4708|4709|4718|4721|4729|4731|4741|4748|4769|4776|4777|4778|4779|4782|4789|4829|4849|4854|4856|4857|4858|4859|4869|4879|4894|4896|4897|4899|4914|4915|4916|4917|4918|4919|4921|4929|4936|4937|4938|4939|4947|4948|4949|4957|4998|4999|5008|5009|5018|5019|5028|5029|5037|5041|5049|5069|5071|5072|5073|5074|5075|5076|5077|5078|5079|5081|5082|5087|5088|5089|5090|5091|5092|5096|5097|5099|5107|5108|5109|5112|5113|5114|5115|5116|5117|5118|5119|5121|5122|5126|5127|5128|5129|5131|5132|5137|5138|5139|5141|5142|5147|5148|5149|5158|5161|5162|5166|5167|5168|5169|5201|5202|5208|5211|5212|5218|5219|5226|5227|5228|5229|5237|5238|5239|5242|5243|5244|5245|5246|5247|5248|5251|5252|5267|5268|5269|5271|5278|5279|5281|5282|5283|5284|5285|5286|5287|5288|5289|5341|5342|5343|5344|5345|5346|5347|5348|5373|5375|5376|5383|5384|5385|5386|5387|5388|5389|5397|5398|5399|5403|5404|5405|5406|5407|5409|5419|5425|5426|5427|5428|5429|5433|5435|5436|5437|5438|5439|5457|5458|5459|5468|5469|5471|5478|5479|5549|5550|5551|5552|5553|5554|5562|5563|5564|5565|5566|5567|5568|5569|5582|5583|5584|5585|5586|5587|5588|5589|5619|5641|5649|5669|5677|5678|5679|5695|5696|5698|5699|5708|5709|5712|5713|5714|5715|5716|5717|5728|5729|5741|5749|5751|5759|5761|5767|5768|5769|5809|5811|5813|5814|5815|5816|5817|5818|5819|5829|5839|5851|5859|5861|5866|5867|5868|5869|5881|5882|5886|5887|5888|5889|5909|5912|5913|5914|5915|5916|5917|5918|5919|5928|5929|5936|5937|5938|5939|5949|5951|5955|5956|5957|5958|5959|5961|5965|5966|5967|5968|5969|5978|5979|5988|5989|5994|5995|5996|5997|5998|5999|6021|6022|6023|6024|6025|6026|6027|6028|6031|6032|6033|6034|6035|6036|6037|6038|6072|6073|6074|6075|6076|6077|6078|6079|6081|6083|6084|6085|6086|6087|6088|6089|6098|6099|6114|6115|6116|6117|6118|6119|6121|6122|6138|6139|6158|6159|6166|6167|6168|6169|6178|6189|6190|6196|6197|6198|6199|6239|6249|6258|6259|6331|6332|6341|6342|6348|6349|6351|6352|6357|6358|6359|6361|6368|6369|6371|6372|6379|6381|6389|6391|6392|6397|6398|6399|6441|6451|6452|6453|6454|6455|6456|6457|6458|6459|6461|6469|6471|6481|6482|6488|6489|6490|6491|6492|6493|6495|6496|6497|6498|6509|6512|6513|6514|6515|6516|6517|6518|6519|6522|6531|6537|6538|6539|6541|6542|6549|6551|6582|6583|6584|6585|6586|6587|6588|6612|6613|6614|6615|6617|6618|6619|6623|6624|6626|6629|6646|6647|6648|6649|6656|6657|6658|6659|6679|6681|6682|6688|6689|6691|6692|6698|6699|6708|6709|6716|6717|6718|6719|6724|6725|6728|6729|6731|6732|6737|6738|6739|6759|6761|6768|6769|6771|6772|6777|6778|6779|6781|6782|6789|6791|6792|6793|6794|6796|6797|6798|6799|6808|6809|6839|6847|6848|6849|6855|6856|6857|6859|6861|6867|6868|6869|6889|6891|6899|6901|6905|6906|6907|6908|6909|6911|6918|6923|6924|6925|6926|6927|6928|6929|6931|6932|6937|6938|6939|7002|7010|7032|7041|7048|7049|7067|7068|7069|7084|7085|7086|7109|7118|7119|7138|7139|7162|7168|7169|7178|7179|7181|7187|7188|7189|7198|7224|7225|7227|7228|7249|7259|7269|7278|7279|7287|7288|7289|7296|7297|7298|7299|7331|7332|7333|7335|7336|7337|7338|7339|7341|7347|7351|7358|7359|7361|7368|7369|7378|7379|7381|7382|7387|7388|7389|7391|7392|7396|7397|7398|7399|7409|7431|7432|7438|7439|7441|7448|7449|7451|7458|7459|7461|7462|7466|7467|7468|7469|7471|7477|7478|7479|7489|7491|7492|7497|7498|7499|7519|7529|7551|7552|7553|7554|7558|7562|7572|7573|7574|7581|7582|7587|7589|7628|7632|7633|7634|7639|7641|7658|7660|7661|7672|7673|7674|7675|7676|7677|7678|7681|7691|7692|7696|7697|7698|7699|7760|7768|7769|7773|7774|7775|7776|7777|7778|7779|7781|7782|7789|7791|7792|7793|7794|7808|7809|7817|7818|7819|7830|7831|7832|7843|7844|7845|7849|7881|7889|7890|7891|7892|7897|7898|7899|7913|7914|7919|7921|7927|7928|7929|7930|7939|7944|7947|7948|7957|7958|7959|7961|7962|7963|7964|7965|7966|7967|7968|7979|7980|7981|7986|7987|7988|7989|8005|8006|8007|8008|8009|8014|8017|8018|8019|8033|8034|8035|8036|8037|8038|8039|8056|8057|8058|8059|8066|8067|8068|8069|8071|8076|8077|8078|8079|8085|8087|8088|8089|8098|8111|8116|8117|8118|8119|8126|8127|8128|8131|8134|8135|8136|8137|8138|8139|8144|8145|8146|8147|8148|8149|8151|8153|8154|8155|8156|8157|8158|8159|8166|8167|8168|8169|8202|8203|8204|8209|8210|8211|8212|8213|8214|8215|8216|8217|8218|8223|8225|8226|8227|8228|8229|8234|8235|8236|8237|8238|8239|8246|8247|8248|8249|8253|8254|8255|8256|8257|8258|8259|8265|8266|8267|8268|8269|8274|8275|8276|8277|8278|8279|8281|8282|8285|8286|8287|8288|8289|8291|8295|8296|8297|8298|8299|8303|8304|8305|8306|8307|8308|8309|8313|8314|8315|8316|8317|8318|8319|8329|8336|8337|8338|8339|8347|8348|8349|8351|8356|8357|8358|8359|8369|8374|8376|8377|8378|8388|8389|8421|8422|8423|8425|8426|8427|8428|8429|8435|8436|8437|8438|8439|8442|8443|8444|8445|8446|8447|8448|8449|8455|8456|8457|8458|8459|8461|8467|8468|8469|8551|8552|8556|8557|8558|8559|8568|8569|8576|8578|8579|8595|8596|8597|8598|8599|8606|8607|8608|8609|8636|8637|8638|8639|8645|8646|8647|8648|8649|8656|8657|8658|8659|8709|8733|8738|8739|8743|8744|8747|8748|8776|8777|8778|8779|8781|8784|8785|8786|8787|8788|8789|8791|8792|8795|8796|8797|8798|8799|8809|8814|8815|8816|8817|8818|8819|8827|8828|8829|8836|8837|8838|8839|8844|8845|8846|8847|8848|8849|8850|8891|8892|8893|8894|8895|8896|8897|8898|8899|8909|8932|8933|8934|8935|8936|8937|8938|8939|8947|8948|8954|8956|8958|8973|8974|8975|8976|8977|8978|8979|8984|8985|8986|8987|8989|9011|9012|9013|9014|9015|9016|9017|9019|9032|9033|9034|9035|9036|9037|9038|9042|9043|9044|9045|9046|9047|9048|9049|9052|9053|9054|9055|9056|9057|9058|9059|9069|9076|9077|9078|9079|9086|9087|9105|9108|9109|9114|9115|9116|9117|9123|9124|9125|9126|9127|9128|9129|9144|9145|9146|9153|9154|9155|9156|9157|9158|9159|9162|9163|9164|9165|9166|9167|9168|9169|9181|9182|9183|9185|9186|9187|9188|9243|9244|9245|9246|9247|9248|9249|9274|9275|9276|9277|9305|9307|9308|9317|9318|9332|9333|9334|9335|9336|9337|9349|9357|9368|9369|9380|9381|9382|9383|9385|9386|9387|9389|9397|9398|9399|9405|9431|9432|9433|9434|9435|9436|9437|9438|9439|9441|9442|9443|9444|9445|9446|9447|9448|9463|9467|9468|9469|9473|9474|9475|9476|9477|9478|9479|9481|9483|9484|9486|9487|9488|9489|9498|9508|9509|9518|9527|9528|9578|9580|9587|9617|9618|9619|9687|9688|9709|9715|9716|9717|9718|9719|9751|9755|9756|9757|9758|9759|9761|9765|9766|9767|9768|9769|9777|9778|9779|9789|9793|9794|9795|9796|9797|9798|9799|9869|9887|9888|9889|9891|9896|9897|9898|9899|9905|9906|9907|9908|9909|9919|9923|9924|9927|9928|9931|9938|9939|9941|9942|9943|9944|9945|9946|9947|9948|9949|9986|9987|9988|9989|9993|9994|9996|9997|9998|9999";

var submitCount = 0;

function ValidatePhone( form )
{
   if( form.Phone1.value.length != 3 )
      return false;      
   if( form.Phone2.value.length != 3 )
      return false;
   if( form.Phone3.value.length != 4 )
      return false;
   if( form.Phone2.value == '555' )
      return false;
   if( sAreaCodes.indexOf( form.Phone1.value ) < 1 )
      return false;
   return true;
}



function ValidName( first, last )
{
   if( first == "First" || last == "Last" )
      return false;
   
   return true;
}

function ValidEmail( email )
{
   if( email == "" )
      return false;
   return ( email.match( /^\w(\.?\w)*@\w(\.?[-\w])*\.[a-z]{2,4}$/i ) ? true : false );
}

function ValidateForm( form )
{
   var isValid = true;
   var errMsg = '';

   if( ValidName( form.FirstName.value, form.LastName.value ) == false )
      errMsg = errMsg + '\n' + '- Enter Your Name.';

   if( ValidEmail( form.EmailAddr.value ) == false )
      errMsg = errMsg + '\n' + '- Valid Email.';

   if( form.Address.value == '' )
      errMsg = errMsg + '\n' + '- Valid Address.';

   if( ValidatePhone( form ) == false )
      errMsg = errMsg + '\n' + '- Valid Phone Number.';

   if( ValidUSZip( form.Zip.value ) == false )
      errMsg = errMsg + '\n' + '- Valid US Zip Code.';

   if( errMsg != '' )
   {
      alert( 'Please fill the following fields' + '\n' + errMsg );
      return false;
   }

   submitCount++;
   if( submitCount > 1 )
      return false;
   form.submit();
}

function ValidUSZip( zipcode )
{
   if( zipcode == "Enter Zip" )
      return false;

   if( sZipCodeBegs3.indexOf( zipcode.substr( 0, 3 ) ) >= 0 )
      return false;

   if( sZipCodeBegs4.indexOf( zipcode.substr( 0, 4 ) ) >= 0 )
      return false;

   var objRegExp  = /(^\d{5}$)/;
   return objRegExp.test( zipcode );
}

function MM_findObj( n )
{
   var p, i, x;
   d = document;

   if((p=n.indexOf("?"))>0 && parent.frames.length)
   {
      d = parent.frames[ n.substring( p + 1 ) ].document;
      n = n.substring( 0, p );
   }

   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
   if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MakeString( str )
{
   str = str.substring( 0, str.length - 3 );
   if( str == "" ) return "0";
   return str;
}

function LimitDropdown( maxvalue, dropdown )
{
   // delete all options greater than the maxvalue
   for( var i = dropdown.options.length - 1; i >= 0; i-- )
   {
      var value = StrToInt( dropdown.options[ i ].value );
      if( value <= maxvalue ) break;
      dropdown.options[ i ] = null;
      dropdown.selectedIndex = i - 1;
   }

   // add any values that need to be added
   for( var i = dropdown.options.length; StrToInt( dropdown.options[ i - 1 ].value ) < maxvalue; i++ )
   {
      var newnumber = StrToInt( dropdown.options[ i - 1 ].value );

      // corner case when dealing w/ $1M+
      if( newnumber >= 990000 )
         break;

      // corner case when dealing w/ add cash drop down
      if( newnumber + 10000 >= maxvalue )
         break;

      // corner case when dealing w/ $0
      if( newnumber < 10000 )
         newnumber = -10000;

      var fromstring = MakeString( ( newnumber + 10000 ).toString() );
      var tostring = MakeString( ( newnumber + 30000  ).toString() );
      dropdown.options[ i ] = new Option( "$" + fromstring + "K - $" + tostring + "K", newnumber + 20000 );
   }
}

function StrToInt( vNum )
{
   return Number( vNum.toString() );
}

function UpdateLoanBalance()
{
   var valuedrop = MM_findObj( "Value" );
   var loandrop = MM_findObj( "Loan" );
   var homevalue = StrToInt( valuedrop.options[ valuedrop.selectedIndex ].value );
   LimitDropdown( homevalue, loandrop );
}

function UpdateDownPayment()
{
   var valuedrop = MM_findObj( "Value" );
   var dpdrop = MM_findObj( "DownPayment" );
   var homevalue = StrToInt( valuedrop.options[ valuedrop.selectedIndex ].value );
   LimitDropdown( homevalue, dpdrop );
}

function UpdateAddCash()
{
   var valuedrop = MM_findObj( "Value" );
   var loandrop = MM_findObj( "Loan" );
   var addcashdrop = MM_findObj( "AddCash" );
   var homevalue = StrToInt( valuedrop.options[ valuedrop.selectedIndex ].value );
   var loanvalue = StrToInt( loandrop.options[ loandrop.selectedIndex ].value );
   LimitDropdown( homevalue - loanvalue, addcashdrop );
}

function LoanBalanceChange()
{
   UpdateAddCash();
}

function HomeValueChange()
{
   UpdateLoanBalance();
   UpdateAddCash();
   UpdateDownPayment();
}

function TypeChange( dropdown )
{
   var nhpanel = MM_findObj( "newhomepanel" );
   var mtgpanel = MM_findObj( "mortgagepanel" );

   var refi_info = MM_findObj( "refiinfo" );
   var newhome_info = MM_findObj( "newhomeinfo" );
   var equity_info = MM_findObj( "equityinfo" );

   if( dropdown.selectedIndex == 2 )
   {
      nhpanel.style.display = "";
      mtgpanel.style.display = "none";
      newhome_info.style.display = "";
      refi_info.style.display = "none";
      equity_info.style.display = "none";
   }
   else
   {
      nhpanel.style.display = "none";
      mtgpanel.style.display = "";
      newhome_info.style.display = "none";

      if( dropdown.selectedIndex == 0 )
      {
         refi_info.style.display = "";
         equity_info.style.display = "none";
      }
      else
      {
         refi_info.style.display = "none";
         equity_info.style.display = "";
      }
   }
}