// eat cake
function fixLinks()
{
  if (!document.getElementsByTagName) return null;
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i < anchors.length; i++)
  {
    var a = anchors[i];
    var href = a.href;
    var id = a.id;
    var title = a.title;
    if ((href.indexOf("#") != -1) && (href.indexOf("header") == -1)) { // jump ref
      var index = href.indexOf("#") + 1;
      href = "javascript:show('" + href.substring(index) + "');";
      a.setAttribute("href",href);
    }
  }
}
 
function hideDivs(exempt)
{
  if (!document.getElementsByTagName) return null;
  if (!exempt) exempt = "";
  var divs = document.getElementsByTagName("div");
  for(var i=0; i < divs.length; i++)
  {
    var div = divs[i];
    var id = div.id;
    if ( (id != "") && (id != "container1") && (id != "container2") && (id != "container3") && (id != "col1") && (id != "col2") && (id != "col3") && (id != "footer") && (id != exempt))
    {
      div.style.display = "none";
    }
  }
}
 
function show(what)
{
  if (!document.getElementById) return null;
  showWhat = document.getElementById(what);
  showWhat.style.display = "block";
  hideDivs(what);
}
 
window.onload = function()
{
  fixLinks();
  hideDivs("intro"); 
  }
  
  //  cascading makes and models
  
  var makes = new Array("AMC","BUICK","CADILLAC","CHEVROLET","CHRYSLER","DODGE","EAGLE","FORD","GEO","GMC","INTERNATIONAL","JEEP","LINCOLN","MERCURY","OLDSMOBILE","PLYMOUTH","PONTIAC","SATURN","","","");
  var models = new Array();
  models["AMC"] = new Array("ALLIANCE","Ambassador","American","AMX","Classic","Concord","Custom","Deluxe","Eagle","Encore","Gremlin","Hornet","Javelin","Marlin","Matador","Pacer","Rambler","Rebel","Rogue","Spirit","Super Six");
  models["BUICK"] = new Array("Allure","Apollo","Centurion","Century","Electra","Enclave","Estate Wagon","Gran Sport","Grand Sport","GS","Invicta","LaCrosse","LeSabre","Limited","LS","Park Avenue","Rainier","Reatta","Regal","Rendezvous","Riviera","Roadmaster","Skyhawk","Skylark","Somerset","Somerset Regal","Special","Sport Wagon","Super","Terraza","Ultra","Wildcat");
  models["CADILLAC"] = new Array("60 Special","Allante","Calais","Catera","Cimmaron","Commercial Chassis","Concours","Coupe","CTS","Deville","DTS","Eldorado","Escalade","Fleetwood","Series 60 Fleetwood","Series 61","Series 62","Series 70","Series 75","Seville","SRX","STS");
  models["CHEVROLET"] = new Array("210","Astro","Avalanche","Aveo","Bel-Air","Beretta","Biscayne","Blazer - Full Size","Brookwood","C/K Pickup","Camaro","Caprice","Cavalier","Celebrity","Chevelle","Chevette","Chevy II","Citation","Citation II","Cobalt","Colorado","Concours","Corsica","Corvair","Corvette","Cosworth","Coupe","Delray","El Camino","Epica","Equinox","Estate Wagon","Express - Van","Fleetline","Fleetmaster","HHR","Impala","Kingswood","Kodiak","Laguna","Lumina","Lumina APV","Luv Pickup","Malibu","Metro","Monte Carlo","Monza","Nomad","Nova","One-Fifty Series","Prizm","S10 Blazer","S10 Pickup","Silverado","Spectrum","Sprint","Styleline","Styleline Deluxe","Styleline Special","Stylemaster","Suburban","Tahoe","Townsman","Tracker","TrailBlazer","Two-Ten Series","Uplander","Van - Full Size","Vega","Venture - Mini Van");
  models["CHRYSLER"] = new Array("300","300M","Arrow","Aspen","Challenger","Champ","Cirrus","Colt","Concorde","Conquest","Cordoba","Crossfire","Daytona","Dynasty","E Class","Executive Limousine","Executive Sedan","Fifth Avenue","Grand Voyager","Imperial","Intrepid","Laser","Lebaron","LHS","Nassau","Neon","New Yorker","Newport","Pacifica","Prowler","PT Cruiser","Royal","Salon","Sapporo","Saratoga","Sebring","St Regis","TC Maserati","Town & Country","Voyager","Windsor");
  models["DODGE"] = new Array("024","2000 GTX","330","400","440","600","880","A100","A108 Van","Aries","Aspen","Avenger","Caliber","Caravan","CB300","Challenger","Charger","Colt","Colt Vista","Concorde","Conquest","Coronet","Custom","D50 Pickup","Dakota","Dart","Daytona","Deluxe","Demon","Diplomat","Durango","Duster","Dynasty","Expo","Grand Caravan","Intrepid","Journey","Lancer","M300","M350","Magnum","Matador","Meadowbrook","Mini Ram","Mirada","Monaco","Neon","Nitro","Omni","Pickup - Pre-94","Polara","Power Wagon","Raider","Ram 50","Ram Pickup","Ramcharger","Rampage","Royal","Royal Monaco","Sebring","Shadow","Sierra","Spirit","Sprinter","SRT-4","St Regis","Stealth","Stratus","Suburban","Super Bee","Swinger","Van - Full Size","Viper","Voyager","Wayfarer");
  models["EAGLE"] = new Array("2000 GTX","Medallion","Premier","Summit","Talon","Vision","Vista");
  models["FORD"] = new Array("300","Aerostar","Aspire","Bronco - Full Size","Bronco II","Brougham","Club","Club Wagon","Contour","Country Sedan","Country Squire","Courier","Crestline","Crown Victoria","Custom","Customline","Del Rio Wagon","Deluxe","Econoline","Edge","Edsel","Elite","Escape","Escort","Excursion","EXP","Expedition","Explorer","Explorer Sport Trac","F-Series Pickup","Fairlane","Fairmont","Falcon","Falcon Station Bus","Festiva","Fiesta","Five Hundred","Focus","Ford","Ford 300","Freestar","Freestyle","Fusion","Futura","Galaxie","Gran Torino","Granada","GT","LTD","LTD II","M400","Mainline","Maverick","Model A","Model T","Mustang","Mustang II","P-Series Pickup","Park Lane Wagon","Pinto","Probe","Ranch Wagon","Ranchero","Ranger","Sedan Delivery","Skyliner","Sprint","Starliner","Sunliner","Super Deluxe","Taurus","Tempo","Thunderbird","Torino","Van - Full Size","Victoria","Windstar","ZX2");
  models["GEO"] = new Array("Metro","Prizm","Spectrum","Sprint","Storm","Tracker");
  models["GMC"] = new Array("Acadia","C/K Pickup","Caballero","Canyon","Denali","Envoy","Jimmy - Full Size","S-15 Jimmy","S-15 Pickup","Safari","Savanna","Sierra","Sonoma","Sprint","Suburban","Syclone","Topkick","Typhoon","Van - Full Size","Yukon");
  models["INTERNATIONAL"] = new Array("4300","4700","4900","4954","8200","9100","9100i","9200","9400","9900","M800 Post Office","Pickup - Full Size","Scout","Scout II","Travelall","Traveler","Van - Full Size");
  models["JEEP"] = new Array("Cherokee","CJ2A","CJ3","CJ3A","CJ3B","CJ5","CJ6","CJ7","Comanche","Commander","Commando","Compass","Dispatcher","DJ3","DJ5","DJ6","FC150","FC170","Gladiator","Gladiator Pickup","Grand Cherokee","Grand Wagoneer","J10","J20","Jeepster","Liberty","M38","M38A1","MB","Patriot","Pickup","Scrambler","Tornado","U.S. Postal","Universal","Utility","Wagoneer","Wrangler");
  models["LINCOLN"] = new Array("Aviator","Blackwood","Capri","Continental","Cosmopolitan","Custom","Lincoln  (MDL)","LS","Mark II","Mark III","Mark IV","Mark LT","Mark V","Mark VI","Mark VII","Mark VIII","MKX","MKZ","Navigator","Premier","Town Car","Town Coupe","Versailles","Zephyr");
  models["MERCURY"] = new Array("Bobcat","Breezeway","Brougham","Caliente","Capri","Colony Park","Comet","Commuter","Cougar","Country Cruiser","Custom","Cyclone","Grand Marquis","LN7","Lynx","Marauder","Mariner","Marquis","Medalist","Mercury","Meteor","Milan","Monarch","Montclair","Montego","Monterey","Mountaineer","Mystique","Parklane","S55","Sable","Topaz","Tracer","Turnpike Cruiser","Villager","Voyager","XR-7","Zephyr");
  models["OLDSMOBILE"] = new Array("442","88","95","96","98","Achieva","Alero","Aurora","Bravada","Calais","Ciera","Classic","Custom Cruiser","Cutlass","Cutlass Calais","Cutlass Ciera","Cutlass Cruiser","Cutlass Supreme","Delmont 88","Delta 88","Dynamic","F85","Fiesta","Firenza","Holiday","Intrigue","Jetfire","Jetstar 1","Jetstar 88","LSS","Omega","Regency","Series 76","Silhouette","Starfire","Super 88","Toronado","Trofeo","Turnpike Cruiser","Vista Cruiser");
  models["PLYMOUTH"] = new Array("Acclaim","Arrow","Barracuda","Belvedere","Breeze","Cambridge","Caravelle","Champ","Colt","Concord","Conquest","Cranbrook","Cricket","Cuda","Custom","Deluxe","Duster","Expo","Fleet Special","Fury","Fury I","Fury II","Fury III","Gran Fury","Grand Voyager","GTX","Horizon","Laser","Neon","Pickup - Full Size","Plaza","Prowler","Reliant","Roadrunner","Sapporo","Satellite","Savoy","Scamp","Sebring","Sport Wagon","Suburban","Sundance","Superbird","TC3","Trailduster","Turismo","Valiant","Van - Full Size","VIP","Vista","Volare","Voyager");
  models["PONTIAC"] = new Array("2000","6000","Acadian","Astre","Aztek","Bonneville","Catalina","Chieftain","Executive","Fiero","Firebird","Firefly","G6","Grand Am","Grand Lemans","Grand Prix","Grand Safari","Grandville","GTO","J2000","Laurentian","LeMans","Montana","Optima","Parisienne","Phoenix","Safari","Solstice","Star Chief","Streamliner","Sunbird","Sunburst","Sunfire","Sunrunner","Super Chief","T1000","Tempest","Torpedo","Torrent","Trans Sport","Ventura","Vibe");
  models["SATURN"] = new Array("ION","LS/LW","Outlook","Relay","SC Coupe","Sky","SL Sedan","SW Wagon","Vue");
  models[""] = new Array();

  
  function resetForm(theForm) {  /* reset makes */  theForm.makes.options[0] = new Option("Please Select Make", "");
    for (var i=0; i<makes.length; i++) {    theForm.makes.options[i+1] = new Option(makes[i], makes[i]);  }  theForm.makes.options[0].selected = true;
      /* reset models */  theForm.models.options[0] = new Option("Please Select Model", ""); 
   theForm.models.options[0].selected = true;}function updateModels(theForm) {  var make = theForm.makes.options[theForm.makes.options.selectedIndex].value; 
    var newModels = models[make];
   theForm.models.options.length = 0;  theForm.models.options[0] = new Option("Please Select Model", "");
    for (var i=0; i<newModels.length; i++) {    theForm.models.options[i+1] = new Option(newModels[i], newModels[i]);  }  theForm.models.options[0].selected = true;}
 
  
  //  Form Validation
  
  
  function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) 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 MM_validateForm() { //v4.0
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
  }
 
