

function initCars() { 


T(2,"ألفا روميو");
T(3,"هامر");
T(5,"أستون مارتين");
T(6,"أوودى");
T(7,"بنتلى");
T(8,"بى أم دبليو");
T(9,"بوويك");
T(10,"كاديلاك");
T(11,"شيفورليه");
T(12,"كرايسلر");
T(13,"سترووين");
T(14,"داسيا");
T(15,"دايوو");
T(16,"دايهاتسو");
T(17,"داتسون");
T(18,"دى توماسو");
T(21,"فيرارى");
T(22,"فيات");
T(23,"فورد");
T(25,"جيو");
T(26,"جى ام سى");
T(27,"هوندا");
T(28,"هيونداى");
T(29,"انفنيتى");
T(30,"أيسوزو");
T(31,"جاجوار");
T(32,"جيب");
T(33,"كيا");
T(34,"لادا");
T(35,"لامبورجينى");
T(36,"لانسيا");
T(37,"لاند روفر");
T(38,"ليكسوز");
T(39,"لينكولن");
T(40,"لوتس");
T(42,"مازدا");
T(43,"مكلارين");
T(44,"مرسيدس بنز");
T(45,"ميركيورى");
T(47,"أم جى");
T(48,"ميتسوبيشى");
T(50,"نيسان");
T(51,"أولدز موبايل");
T(52,"أوبل");
T(54,"بيروضوا");
T(55,"بيجوت");
T(59,"بورش");
T(60,"بورتن");
T(61,"رينولت");
T(62,"رولز رويس");
T(63,"ساب");
T(64,"ساتورن");
T(65,"سيات");
T(66,"سكودا");
T(67,"ستيرلنج");
T(68,"سوبارو");
T(69,"سوزوكى");
T(70,"توفاس");
T(71,"تويوتا");
T(72,"تريامف");
T(75,"فولكس واجن");
T(76,"فولفو");
T(78,"يوجو");


M(2,"133");M(2,"146");M(2,"156");M(2,"164");M(2,"Alfetta");M(2,"Graduate");M(2,"GTV-6");M(2,"Milano");M(2,"Spider");
M(3,"Hummer");
M(5,"DB7");M(5,"DB7 Vantage");M(5,"Lagonda");M(5,"Vantage");
M(6,"100");M(6,"200");M(6,"4000");M(6,"5000");M(6,"80");M(6,"90");M(6,"A3");M(6,"A3");M(6,"A4");M(6,"A6");M(6,"A8");M(6,"Cabriolet");M(6,"GT");M(6,"Quattro Coupe");M(6,"Quattro V8");M(6,"S4");M(6,"S6");M(6,"TT");
M(7,"Arnage");M(7,"Azure");M(7,"Brooklands");M(7,"Continental");M(7,"Mulsanne");M(7,"Turbo R");M(7,"Turbo RT");M(7,"Turbo S");
M(8,"2002");M(8,"316");M(8,"318");M(8,"320");M(8,"323");M(8,"325");M(8,"328");M(8,"518");M(8,"523");M(8,"524");M(8,"525");M(8,"528");M(8,"530");M(8,"533");M(8,"535");M(8,"540");M(8,"633");M(8,"635");M(8,"733");M(8,"735");M(8,"740");M(8,"750");M(8,"840");M(8,"850");M(8,"L6");M(8,"L7");M(8,"M Coupe");M(8,"M Roadster");M(8,"M3");M(8,"M5");M(8,"M6");M(8,"X5");M(8,"Z3");M(8,"Z8");
M(9,"Century");M(9,"Electra");M(9,"Estate");M(9,"LeSabre");M(9,"Park Avenue");M(9,"Reatta");M(9,"Regal");M(9,"Riviera");M(9,"Roadmaster");M(9,"Skyhawk");M(9,"Skylark");M(9,"Somerset");
M(10,"Allante");M(10,"Brougham");M(10,"Catera");M(10,"Cimarron");M(10,"DeVille");M(10,"Eldorado");M(10,"Escalade");M(10,"Fleetwood");M(10,"Seville");M(10,"Sixty Special");
M(11,"1500");M(11,"2500");M(11,"3500");M(11,"Astro");M(11,"Beretta");M(11,"Blazer");M(11,"C10/K10");M(11,"C20/K20");M(11,"C30/K30");M(11,"Camaro");M(11,"Caprice");M(11,"Caprice Classic");M(11,"Cavalier");M(11,"Celebrity");M(11,"Chevelle");M(11,"Chevette");M(11,"Cheyenne");M(11,"Citation");M(11,"Corsica");M(11,"Corvette");M(11,"El Camino");M(11,"Express Van");M(11,"Express Van");M(11,"Impala");M(11,"Lumina");M(11,"Lumina APV");M(11,"Luv");M(11,"Malibu");M(11,"Metro");M(11,"Monte Carlo");M(11,"Nova");M(11,"Pickup (Other)");M(11,"Prizm");M(11,"S-10 Blazer");M(11,"S10/T10");M(11,"Silverado");M(11,"Spectrum");M(11,"Sportvan");M(11,"Sprint");M(11,"Suburban");M(11,"Tahoe");M(11,"Tracker");M(11,"TrailBlazer");M(11,"Van");M(11,"Venture");M(11,"Yukon");
M(12,"300M");M(12,"Cirrus");M(12,"Concorde");M(12,"Conquest");M(12,"Cordoba");M(12,"Fifth Avenue");M(12,"Grand Voyager");M(12,"Imperial");M(12,"Laser");M(12,"LeBaron");M(12,"LHS");M(12,"New Yorker");M(12,"Newport");M(12,"PT Cruiser");M(12,"Sebring");M(12,"TC (Maserati)");M(12,"Town & Country");M(12,"Voyager");
M(13,"AX");M(13,"Xantia");M(13,"Xsara");M(13,"ZX");
M(14,"1310");M(14,"1410");M(14,"Nova");
M(15,"Espero");M(15,"Juliet");M(15,"Lanos");M(15,"Leganza");M(15,"Matiz");M(15,"Nubira");M(15,"Racer");M(15,"Tico");
M(16,"Charade");M(16,"Feroza");M(16,"Mira");M(16,"Rocky");M(16,"Terios");
M(17,"120y");
M(18,"Mangusta");
M(21,"208");M(21,"288");M(21,"308");M(21,"328");M(21,"348");M(21,"360");M(21,"412");M(21,"456");M(21,"550");M(21,"Dino");M(21,"F333");M(21,"F355");M(21,"F40");M(21,"F50");M(21,"F512");M(21,"GTB");M(21,"M");M(21,"Maranello");M(21,"Modena");M(21,"Mondial");M(21,"Testarossa");
M(22,"124");M(22,"125");M(22,"126");M(22,"127");M(22,"128");M(22,"131");M(22,"132");M(22,"2000");M(22,"Argenta");M(22,"Brava");M(22,"Dino");M(22,"Fura");M(22,"Punto");M(22,"Regata");M(22,"Ritmo");M(22,"Siena");M(22,"Spider");M(22,"Strada");M(22,"Super Fura");M(22,"Tempra");M(22,"Tipo");M(22,"Uno");M(22,"X1/9");
M(23,"Aerostar");M(23,"Angelia");M(23,"Aspire");M(23,"Bronco");M(23,"Bronco II");M(23,"Club Wagon");M(23,"Contour");M(23,"Courier");M(23,"Crown Victoria");M(23,"Econoline");M(23,"Ecostar");M(23,"Escape");M(23,"Escort");M(23,"Escort Cosworth");M(23,"Escort ZX2");M(23,"Excursion");M(23,"EXP");M(23,"Expedition");M(23,"Explorer");M(23,"F100");M(23,"F150");M(23,"F250");M(23,"F350");M(23,"Fairmont");M(23,"Festiva");M(23,"Fiesta");M(23,"Focus");M(23,"Granada");M(23,"Ka");M(23,"LTD");M(23,"Mondeo");M(23,"Mustang");M(23,"Pickup (Other)");M(23,"Probe");M(23,"Ranger");M(23,"Taurus");M(23,"Tempo");M(23,"Thunderbird");M(23,"Van");M(23,"Windstar");
M(25,"Metro");M(25,"Prizm");M(25,"Spectrum");M(25,"Storm");M(25,"Tracker");
M(26,"1500");M(26,"2500");M(26,"3500");M(26,"Caballero");M(26,"Envoy");M(26,"Jimmy");M(26,"Jimmy-S15");M(26,"Magnavan");M(26,"Rally");M(26,"S-15 Pickup");M(26,"Safari");M(26,"Savana");M(26,"Sierra");M(26,"Sonoma");M(26,"Suburban");M(26,"Syclone");M(26,"Typhoon");M(26,"Value");M(26,"Vandura");M(26,"Yukon");
M(27,"Accord");M(27,"Civic");M(27,"CR-V");M(27,"CRX");M(27,"del Sol");M(27,"EX");M(27,"Insight");M(27,"Integra");M(27,"Odyssey");M(27,"Passport");M(27,"Prelude");M(27,"S2000");
M(28,"Accent");M(28,"Atos");M(28,"Elantra");M(28,"Excel");M(28,"Scoupe");M(28,"Sonata");M(28,"Tiburon");
M(29,"G20");M(29,"I30");M(29,"J30");M(29,"M30");M(29,"Q45");M(29,"QX4");
M(30,"Amigo");M(30,"Hombre");M(30,"I-Mark");M(30,"Impulse");M(30,"Oasis");M(30,"Pickup");M(30,"Rodeo");M(30,"Stylus");M(30,"Trooper");M(30,"VehiCROSS");
M(31,"S-Type");M(31,"Sovereign");M(31,"Vanden Plas");M(31,"VDP Supercharged");M(31,"XJ12");M(31,"XJ6");M(31,"XJ8");M(31,"XJ8L");M(31,"XJR");M(31,"XJS");M(31,"XK8");M(31,"XKR");
M(32,"Cherokee");M(32,"CJ");M(32,"Cj7");M(32,"Comanche");M(32,"Grand Cherokee");M(32,"Grand Wagoneer");M(32,"J10 Truck");M(32,"J20 Truck");M(32,"M 151");M(32,"Wagoneer");M(32,"Wrangler");
M(33,"Pride");M(33,"Rio");M(33,"Sephia");M(33,"Shuma");M(33,"Spectra");M(33,"Sportage");
M(34,"2105");M(34,"2107");M(34,"Niva");M(34,"Samara");
M(35,"Diablo");
M(36,"Dedra");M(36,"Delta");M(36,"Hedra");
M(37,"Defender 90");M(37,"Discovery");M(37,"Range Rover");
M(38,"ES 250");M(38,"ES 300");M(38,"GS 300");M(38,"GS 400");M(38,"IS 300");M(38,"LS 400");M(38,"LX 450");M(38,"LX 470");M(38,"RX 300");M(38,"SC 300");M(38,"SC 400");M(38,"SLV");
M(39,"Continental");M(39,"LS");M(39,"Mark VII");M(39,"Mark VIII");M(39,"Navigator");M(39,"Town Car");
M(40,"Esprit");M(40,"Esprit V8");
M(42,"121");M(42,"323");M(42,"626");M(42,"929");M(42,"GLC");M(42,"Miata MX-5");M(42,"Millenia");M(42,"MPV");M(42,"MX-3");M(42,"MX-5");M(42,"MX-6");M(42,"Navajo");M(42,"Pickup");M(42,"Protege");M(42,"RX-7");
M(44,"190");M(44,"280");M(44,"300");M(44,"600");M(44,"C-Class");M(44,"CL-Class");M(44,"CLK");M(44,"E-Class");M(44,"M-Class");M(44,"S-Class");M(44,"SL-Class");M(44,"SLK");
M(45,"Brougham");M(45,"Capri");M(45,"Cougar");M(45,"Grand Marquis");M(45,"LN7");M(45,"Lynx");M(45,"Marquis");M(45,"Merkur");M(45,"Mountaineer");M(45,"Mystique");M(45,"Sable");M(45,"Topaz");M(45,"Tracer");M(45,"Villager");M(45,"Zephyr");
M(47,"MGB");M(47,"Midget");
M(48,"3000GT");M(48,"Colt");M(48,"Cordia");M(48,"Diamante");M(48,"Eclipse");M(48,"Eclipse Spyder");M(48,"Expo");M(48,"Galant");M(48,"Lancer");M(48,"Minivan");M(48,"Mirage");M(48,"Montero");M(48,"Montero Sport");M(48,"Pajero");M(48,"Pajero IO");M(48,"Pickup");M(48,"Precis");M(48,"Sigma");M(48,"Starion");M(48,"Tredia");
M(50,"200SX");M(50,"210");M(50,"240SX");M(50,"240Z");M(50,"280ZX");M(50,"300ZX");M(50,"Altima");M(50,"Axxess");M(50,"Frontier");M(50,"March");M(50,"Maxima");M(50,"NX");M(50,"Pathfinder");M(50,"Patrol");M(50,"Pickup");M(50,"Pulsar");M(50,"Quest");M(50,"Sentra");M(50,"Stanza");M(50,"Sunny");M(50,"Van");M(50,"Xterra");M(50,"Z");
M(51,"88 Royale");M(51,"Achieva");M(51,"Alero");M(51,"Aurora");M(51,"Bravada");M(51,"Custom Cruiser");M(51,"Cutlass");M(51,"Eighty-Eight");M(51,"Firenza");M(51,"Intrigue");M(51,"LSS");M(51,"Ninety-Eight");M(51,"Omega");M(51,"Regency");M(51,"Silhouette");M(51,"Toronado");
M(52,"Astra");M(52,"Corsa");M(52,"Kadett");M(52,"Rekord");M(52,"Tigra");M(52,"Vectra");
M(54,"Kancil");
M(55,"104");M(55,"106");M(55,"205");M(55,"206");M(55,"304");M(55,"305");M(55,"309");M(55,"405");M(55,"406");M(55,"504");M(55,"505");M(55,"604");M(55,"605");M(55,"806");M(55,"GLS");M(55,"Liberte");
M(59,"911");M(59,"924");M(59,"928");M(59,"944");M(59,"964");M(59,"968");M(59,"993");M(59,"Boxster");
M(60,"Wira");
M(61,"12");M(61,"14");M(61,"18i");M(61,"21");M(61,"5");M(61,"9");M(61,"Alliance");M(61,"Fuego");M(61,"Le Car");M(61,"Megane");M(61,"Optima");M(61,"R17");M(61,"Scenic");M(61,"Sportwagon");
M(62,"Camargue");M(62,"Corniche");M(62,"Phantom III");M(62,"Silver Dawn");M(62,"Silver Seraph");M(62,"Silver Shadow");M(62,"Silver Spirit");M(62,"Silver Spur");M(62,"Silver Wraith");M(62,"Silver Wrth II");
M(63,"9-3");M(63,"9-5");M(63,"900");M(63,"9000");
M(64,"LS");M(64,"LS1");M(64,"LS2");M(64,"LW");M(64,"LW1");M(64,"LW2");M(64,"SC");M(64,"SC1");M(64,"SC2");M(64,"SL");M(64,"SL1");M(64,"SL2");M(64,"SW1");M(64,"SW2");
M(65,"133");M(65,"Arosa");M(65,"Cordoba");M(65,"Ibiza");M(65,"Toledo");
M(66,"Fabia");M(66,"Favorit");M(66,"Felicia");M(66,"Felicia Combi");M(66,"Octavia");
M(67,"825");M(67,"827");M(67,"Sterling");
M(68,"Brat");M(68,"DL");M(68,"Forester");M(68,"GL");M(68,"GL-10");M(68,"GLF");M(68,"Impreza");M(68,"Justy");M(68,"Legacy");M(68,"Loyale");M(68,"Outback");M(68,"RX");M(68,"STD");M(68,"SVX");M(68,"XT");M(68,"Xt6");
M(69,"Esteem");M(69,"Grand Vitara");M(69,"Samurai");M(69,"Sidekick");M(69,"Swift");M(69,"Vitara");M(69,"X-90");
M(70,"131");M(70,"Dogan");M(70,"Sahin");
M(71,"4Runner");M(71,"Avalon");M(71,"Camry");M(71,"Camry Solara");M(71,"Celica");M(71,"Compact");M(71,"Corolla");M(71,"Corona");M(71,"Cressida");M(71,"Echo");M(71,"Land Cruiser");M(71,"MR2");M(71,"MR2 Spyder");M(71,"Paseo");M(71,"Pickup (Other)");M(71,"Previa");M(71,"Prius");M(71,"RAV4");M(71,"Sienna");M(71,"Starlet");M(71,"Supra");M(71,"T100");M(71,"Tacoma");M(71,"Tercel");M(71,"Tundra");M(71,"Van");
M(72,"Spitfire");M(72,"TR3");M(72,"TR4");M(72,"TR5");M(72,"TR6");M(72,"TR7");M(72,"TR8");
M(75,"Beetle");M(75,"Cabrio");M(75,"Cabriolet");M(75,"Corrado");M(75,"Dasher");M(75,"Eurovan");M(75,"Fox");M(75,"Golf");M(75,"GTI");M(75,"Jetta");M(75,"Karmann Ghia");M(75,"Passat");M(75,"polo");M(75,"Quantum");M(75,"Rabbit");M(75,"Scirocco");M(75,"Vanagon");
M(76,"240");M(76,"244");M(76,"740");M(76,"760");M(76,"780");M(76,"850");M(76,"940");M(76,"960");M(76,"C70");M(76,"Coupe");M(76,"DL");M(76,"GL");M(76,"GLE");M(76,"GLT");M(76,"S40");M(76,"S70");M(76,"S80");M(76,"S90");M(76,"V40");M(76,"V70");M(76,"V90");
M(78,"Cabrio");M(78,"GV");

}











var makesName = new Array();   // used as a cross reference table for name and number
// the following are used as a 2D table for makes and models
var makes = new Array();
var models = new Array();
// load the arrays and construct the selections on the page





// create car make objects and fill arrays
function T(makenumber, make )
{
makesName[make] = new MakesName(make,makenumber);
makes[makenumber] = new Make( make,makenumber );
}





// make name constructor
function MakesName( makeName,makeNumber )
{
this.makeNumber = makeNumber;
}





// make constructor
function Make( makeName,makeNumber )
{
this.makeName = makeName;
this.makeNumber = makeNumber;
// create array associated with makes
this.models = new Array();
}





// create car model objects and fill arrays
function M( makeNumber, model )
{
var modelObj = new Model( model, makeNumber);
makes[makeNumber].models[model] = modelObj;
}




// model constructor
function Model( model,makeNumber )
{
this.VAR_Model = model;
this.makeNumber = makeNumber;
}






// construct model selection on page
function fillModelSelect( makeNbr )
{
document.Form1.VAR_Model.options.selectedIndex = 0;
document.Form1.VAR_Model.options.length = 1; 
var selectedModels;

selectedModels = (makes[makeNbr].models);
var i=0;
//document.Form1.VAR_Model.options[ i ] = new Option( "All" , "All" );
//i++;
for ( aModelIdx in selectedModels )
{
aModel = selectedModels[ aModelIdx ];
document.Form1.VAR_Model.options[ i ] = 
new Option( aModel.VAR_Model, aModel.VAR_Model );
i++;
}

document.Form1.VAR_Model.options[ 0 ].selected = true;
}







// when make selected fill model selection
function selectedMake( aSelectedMake )
{
var selectedIdx = aSelectedMake.selectedIndex;
var selectedMakeName = (aSelectedMake.options[ selectedIdx ]).value;

var i = 0;
for (aIdx in makesName)
{
if (aIdx == selectedMakeName)
i++;
}

if (i == 0)
{
Populate(document.Form1.VAR_Cartype,0);
}		
else
{
var makeNBR = makesName[selectedMakeName].makeNumber;  // use cross reference table to get makeintid
fillModelSelect( makeNBR );	
}
}







function PopulateClient(listBox, prevSelected)
{
var selectedValue = new String(listBox.options[listBox.selectedIndex].value);

with (document.Form1)
{                       
//if(listBox.selectedIndex != listBox.options.length-1)
selectedMake(listBox);
//else
//{
//listBox.options[prevSelected].selected = true;
//selectedMake(listBox);
//}
}
}





// check user selection on model selection list
function validateModel()
{
with (document.Form1)
{
if(VAR_Model.options[VAR_Model.selectedIndex].value == "")
VAR_Model.options[nModelPrevSelected].selected = true;
}
}






function processError()
{
with (document.Form1)
{
if(VAR_Cartype.options[VAR_Cartype.selectedIndex].value != "")
{
Populate(VAR_Cartype,0);
}
else
VAR_Cartype.options[0].selected = true;			 
}
return true;
}






function Populate(listBox, prevSelected)
{
var selectedValue = new String(listBox.options[listBox.selectedIndex].value);
with (document.Form1)
{
if(selectedValue != "")
window.location = "/carsapp/national/?srv=adlocator&act=populate&epc=y&ft=1&tf=quick_usedforsale-default.tmpl&ss=7&VAR_Cartype=" + escape(VAR_Cartype.options[VAR_Cartype.selectedIndex].value) + "&VAR_Model=" + escape(VAR_Model.options[VAR_Model.selectedIndex].value) + "&rd=" + rd.options[rd.selectedIndex].value + "&zc=" + zc.value + "&flt=" + flt.value 
else
listBox.options[prevSelected].selected = true;
}
}






function validateModel()
{
with (document.Form1)
{
if(VAR_Model.options[VAR_Model.selectedIndex].value == "")
VAR_Model.options[nModelPrevSelected].selected = true;
}
}


initCars();