var plan_key = ''; var meet_loc_url = '/philadelphia/meet-location'; // handy images var img_zipmarker, img_youarehere, img_nomatch, img_expanded, img_unknown; img_youarehere = "/images/zipmarker-youarehere.png"; img_nomatch = "/images/zipmarker-reserved.png"; img_expanded = "/images/zipmarker-viewing.png"; img_zipmarker = "/images/zipmarker.png"; img_unknown = "/images/zipmarker-unknown.png"; img_shadow = "/images/zipshadow.png"; // create a data structure for all the locations var locs = [ [68890474,'10th%2fSouth',39.942922361951176,-75.15874743461609],[68893002,'10th%2fWalnut',39.94856079983906,-75.15700936317444],[78778372,'11th%2fChristian',39.939706064532736,-75.16116678714752],[68893961,'11th%2fPine',39.945525724718436,-75.15989542007446],[68891697,'12th%2fCallowhill',39.959342863842416,-75.15873670578003],[68890467,'13th%2fKater',39.94310743840448,-75.16374707221985],[136868079,'13th%2fWalnut',39.949168415570846,-75.16144037246704],[213852827,'13th%2fWaverly',39.94505276728234,-75.16324281692505],[209179149,'15th%2fCecil+B%2e+Moore+at+The+Edge',39.978057345122686,-75.15949845314026],[68894164,'15th%2fPine',39.94599456625412,-75.16748607158661],[168646483,'15th%2fSouth',39.94405337690286,-75.16688525676727],[68893322,'15th%2fSpring+Garden',39.96283988448919,-75.16289949417114],[68890161,'15th%2fSpruce',39.94742574685719,-75.16648292541504],[181958191,'15th%2fTasker',39.93086252388762,-75.17037749290466],[230278981,'16th%2fArch+%28The+Phoenix%29',39.954813,-75.16636],[223103782,'16th%2fCherry',39.955526980605896,-75.16569435596466],[68890563,'17th%2fChancellor',39.949305154069385,-75.16884326934814],[136878988,'17th%2fPine',39.94632768855066,-75.1697713136673],[68891682,'18th%2fChancellor',39.94953750607921,-75.1701682806015],[132721593,'18th%2fCypress',39.94748332246186,-75.17197072505951],[166988526,'18th%2fLombard',39.945673780287336,-75.17251253128052],[68890352,'18th%2fMarket+Inside',39.952780070789636,-75.16907930374145],[68892502,'18th%2fMarket+Outside',39.953105,-75.169358],[68892235,'18th%2fSpring+Garden+',39.9620771750716,-75.16821026802063],[68891647,'19th%2fArch',39.95583949628957,-75.17118215560913],[95222513,'19th%2fJFK',39.95410008164172,-75.17200827598572],[68891499,'20th%2fArch',39.95565856633095,-75.17220675945282],[68892019,'20th%2fRittenhouse',39.948953,-75.175572],[188105638,'20th%2fWalnut',39.95019754597862,-75.17352104187012],[111019428,'21st%2fChestnut',39.952097438361584,-75.17533957958221],[128044087,'21st%2fGreen',39.96560900322338,-75.17267346382141],[231573625,'21st%2fMoravian',39.95106730845658,-75.17517060041428],[68890241,'21st%2fSansom',39.951406574509896,-75.17599940299988],[183818031,'21st%2fWebster',39.94172552213355,-75.17736196517944],[131056197,'22nd%2fChancellor',39.950514198373796,-75.1768134534359],[68893198,'22nd%2fCherry',39.957365045770565,-75.17627567052841],[166960292,'22nd%2fFairmount',39.96758247150943,-75.17431497573853],[165336260,'22nd%2fPennsylvania+Avenue',39.96319142693576,-75.17444372177124],[68891286,'22nd%2fSouth',39.945313922444775,-75.17806738615036],[68891149,'25th%2fLocust',39.95009062405962,-75.18112242221832],[70889169,'25th%2fPoplar',39.972676223206875,-75.17846703529358],[115372444,'2nd%2fFilbert',39.95097478105908,-75.14336228370666],[68891654,'2nd%2fLombard',39.94238975025333,-75.1462671160698],[68892050,'2nd%2fMarket',39.94920439941275,-75.1435661315918],[69118433,'30th+St+Stn',39.955004747263175,-75.1825761795044],[68892540,'39th%2fMarket',39.957097768670764,-75.1998120546341],[85823292,'3rd%2fArch',39.9516286386518,-75.14420986175537],[78819555,'3rd%2fBainbridge',39.94014409858528,-75.14802128076553],[68894108,'3rd%2fGreen',39.961645448988826,-75.14348030090332],[115378389,'40th%2fBaltimore',39.95000426392609,-75.20416796207428],[68891787,'40th%2fPowelton',39.95926062722457,-75.20255863666534],[68893225,'41st%2fChester',39.948149550934296,-75.20617961883545],[68890293,'41st%2fSpruce',39.952724555756326,-75.2050369977951],[127598058,'42nd%2fDelancey',39.95173967045239,-75.20689845085144],[68890279,'43rd%2fLocust',39.95387391336661,-75.20943313837051],[128053186,'45th%2fOsage',39.95117011652922,-75.21286904811859],[142335334,'45th%2fWalnut',39.955551652948614,-75.2129602432251],[166992322,'47th%2fWoodland',39.94392999436212,-75.21068572998047],[68891870,'49th%2fChestnut',39.95759737040098,-75.21941363811493],[181968290,'49th%2fSpruce',39.953487369492244,-75.21995544433594],[68893276,'4th%2fBainbridge',39.940966690167734,-75.15004634857178],[68890296,'4th%2fRace',39.95434269768722,-75.14674186706543],[187530706,'52nd%2fChestnut',39.958865890082194,-75.22632837295532],[177809847,'52nd%2fSpruce',39.954408491720685,-75.22559881210327],[68892277,'5th%2fSouth',39.941811892718185,-75.15156716108322],[68892330,'7th%2fBainbridge',39.94152193389558,-75.15421986579895],[120610788,'8th%2fChristian',39.9385215076987,-75.15680015087127],[68891521,'8th%2fLocust',39.94751622278565,-75.15542149543762],[68894418,'8th%2fMarket',39.950789725888576,-75.15380680561065],[136883854,'9th%2fArch',39.95333110645487,-75.15548586845398],[73354536,'9th%2fEllsworth',39.93560527172861,-75.15937507152557],[231562459,'9th%2fFilbert',39.95320157235061,-75.15454441308975],[68893139,'Broad%2fArch',39.95399110974798,-75.16252130270004],[70889172,'Broad%2fDiamond',39.98443685817328,-75.15714883804321],[68894046,'Broad%2fFederal',39.93607829446918,-75.16616106033325],[70889185,'Broad%2fLehigh',39.99347896173187,-75.15493869781494],[181164648,'Broad%2fSansom',39.950142,-75.164336],[177230119,'Cira+Centre+30th%2fArch',39.95769811269452,-75.18173933029175],[177809265,'Frankford%2fGirard',39.96925987476063,-75.13498306274414],[166985227,'Front%2fChristian',39.93534202287433,-75.14493942260742],[177753290,'Girard%2fBerks',39.97210478812662,-75.12577772140503],[131073828,'Lombard%2fHutchinson',39.944106842601414,-75.157470703125],[225821679,'Mole%2fChristian',39.94070140546272,-75.16899347305298],[166977039,'Shunk%2fMoyamensing',39.91778432963564,-75.1695728302002],[69118440,'Spruce%2fJuniper',39.947129642982006,-75.16344666481018],[120407305,'Walnut%2fSydenham',39.94895559646166,-75.16705691814422]]; // create a data structure for all the location groups var loc_grps = [ [69118358, 39.94258069520178422222222222222222222222, -75.16003668308258, 15],[68890038, 39.94879273441299782352941176470588235294, -75.16467460191367588235294117647058823529, 15],[68890048, 39.9541312756568904, -75.15701901912689, 15],[68890056, 39.96726478121886125, -75.17497479915619, 15],[69118356, 39.9433044137465722, -75.17213648557663, 15],[69879897, 39.985768153427278, -75.1572185754776, 15],[68890054, 39.96767003729202533333333333333333333333, -75.13474702835083, 15],[68890045, 39.9515376292027125, -75.144470036029815, 15],[69118357, 39.94985260484526333333333333333333333333, -75.17363696033859333333333333333333333333, 15],[68890057, 39.93341428783240228571428571428571428571, -75.16119897365569857142857142857142857143, 15],[68890051, 39.94233604283111544444444444444444444444, -75.15521913766861, 15],[68890055, 39.962458529780395, -75.165554881095885, 15],[68890052, 39.953785255989049875, -75.207888353615999375, 15],[68890053, 39.94751622278565, -75.15542149543762, 15]]; // even though we have vehicle_id, it is not relevant at this stage since it will just be used for // counting up how many vehicles match said criteria. we will leave it out of the array. // make, model, location, amenity list var vehicles = [ [4264850,68894815,111019428,[485650,49167247,'']],[94564,3398752,111019428,[49167247,'']],[94564,3398752,68893139,[49167247,'']],[94564,1362812,68890352,['']],[94564,1362812,68890352,['']],[94563,94567,70889169,[49167247,'']],[94563,94567,166988526,[49167247,'']],[94563,94567,68891654,[49167247,'']],[94563,94567,136868079,[49167247,'']],[2968515,1014543,68894164,['']],[2968515,1014543,111019428,['']],[2968515,1014543,95222513,['']],[2968515,1014543,68890161,[49167247,'']],[94564,3398752,132721593,[49167247,'']],[94564,742432,127598058,['']],[94564,742432,70889169,['']],[94564,3398752,68893002,[49167247,'']],[94564,3398752,177809847,[49167247,'']],[94564,742432,68890474,['']],[94564,742432,136883854,['']],[94564,742432,68891697,['']],[94564,3398752,120407305,[49167247,'']],[94564,3398752,68892235,[49167247,'']],[94563,94567,85823292,[49167247,'']],[94563,94567,166985227,[49167247,'']],[94563,94567,68892019,[49167247,'']],[94563,94567,78778372,[49167247,'']],[94563,33798998,68893322,['']],[94563,33798998,136878988,['']],[4264850,4264865,209179149,[49167247,'']],[94564,3398752,68893225,[49167247,'']],[94564,3398752,85823292,[49167247,'']],[94564,3398752,68891647,[49167247,'']],[94564,742432,68891149,['']],[2968515,1014543,68891682,['']],[2968515,1014543,69118440,[49167247,'']],[2968515,1014543,68892502,[49167247,'']],[2968515,1014543,68892050,['']],[32061749,68438186,68890352,['']],[32061749,82734503,187530706,['']],[32061749,68438186,223103782,['']],[32061749,82734503,68890563,['']],[94564,742432,68892019,['']],[4264850,4264865,78819555,[49167247,'']],[2190563,9876627,68890241,[49167247,'']],[2190563,9876627,68893276,[49167247,'']],[2190563,6869299,165336260,[49167247,'']],[2190563,6869299,68890296,[49167247,'']],[2190563,6869299,131073828,[49167247,'']],[94564,2870368,68890563,['']],[4264850,4264865,70889185,[49167247,'']],[94564,1362743,68890241,['']],[4264850,55604681,131056197,[49167247,'']],[4264850,55604681,213852827,[49167247,'']],[4264850,55604681,128044087,[49167247,'']],[4264850,4264865,68890352,[49167247,'']],[5240856,5240857,68891499,[49167247,'']],[5240856,5240857,136878988,[49167247,'']],[5240856,5240857,166960292,[49167247,'']],[5240856,5240857,136883854,[485650,49167247,'']],[5240856,5240857,85823292,[49167247,'']],[94563,64790058,68894418,['']],[94563,64790058,69118433,[49167247,'']],[94563,64790058,142335334,[49167247,'']],[94563,64790058,68891286,[49167247,'']],[94563,64790058,68893002,[49167247,'']],[94563,64790058,166960292,[49167247,'']],[94563,94567,131056197,[49167247,'']],[3140121,32144640,68893225,[49167247,'']],[3140121,32144640,181164648,[49167247,'']],[32061749,32062060,68894418,['']],[32061749,32062060,69118433,[49167247,'']],[32061749,32062060,68893961,[49167247,'']],[32061749,32062060,95222513,[49167247,'']],[5240856,5240857,111019428,[49167247,'']],[5240856,5240857,142335334,[49167247,'']],[5240856,5240857,69118433,[49167247,'']],[5240856,5240857,70889172,[49167247,'']],[4264850,4264865,68890293,[49167247,'']],[4264850,4264865,136868079,[49167247,'']],[4264850,4264865,68891499,[49167247,'']],[4264850,4264865,213852827,[49167247,'']],[94563,94567,68892330,[49167247,'']],[94563,94567,230278981,[49167247,'']],[94563,94567,68892235,[49167247,'']],[94563,94567,68892050,[49167247,'']],[94563,94567,166977039,[49167247,'']],[5240856,5240857,68890352,[49167247,'']],[5240856,5240857,68893276,[49167247,'']],[5240856,5240857,177230119,[49167247,'']],[94563,94567,68892330,[49167247,'']],[94563,94567,120610788,[49167247,'']],[94563,94567,68894108,[49167247,'']],[94563,94567,68891697,[49167247,'']],[94563,94567,166992322,['']],[94563,64790058,165336260,[49167247,'']],[4264850,4264865,168646483,[49167247,'']],[4264850,4264865,177753290,[49167247,'']],[4264850,4264865,68890467,[49167247,'']],[4264850,4264865,115372444,[49167247,'']],[94564,1362743,111019428,[49167247,'']],[94564,742432,68891521,[49167247,'']],[94564,742432,73354536,[49167247,'']],[94564,3398752,166988526,[49167247,'']],[94564,3398752,68891521,[49167247,'']],[94564,3398752,68893198,[49167247,'']],[94564,3398752,168646483,[49167247,'']],[2968515,9878842,111019428,[49167247,'']],[2190563,6869299,69118440,[49167247,'']],[2190563,6869299,68893322,[49167247,'']],[2190563,6869299,128053186,[49167247,'']],[2190563,6869299,213852827,[49167247,'']],[2190563,6869299,181958191,[49167247,'']],[2190563,9876627,183818031,[49167247,'']],[2190563,9876627,181968290,[49167247,'']],[2190563,9876627,136883854,[49167247,'']],[2190563,9876627,68894046,[49167247,'']],[29744489,155320179,68891286,[49167247,'']],[29744489,155320179,111019428,[49167247,'']],[29744489,155320179,69118440,[49167247,'']],[94563,94567,68893276,[49167247,'']],[94563,94567,131073828,[49167247,'']],[94563,94567,68891870,[49167247,'']],[94563,163026706,188105638,[49167247,'']],[94563,163026706,68891286,[49167247,'']],[3140121,32144640,111019428,[49167247,'']],[94564,742432,223103782,[49167247,'']],[94564,742432,70889172,[49167247,'']],[94564,742432,68894108,[49167247,'']],[94564,742432,68892235,[49167247,'']],[94564,742432,68891787,[49167247,'']],[4264850,4264865,69118440,[49167247,'']],[94564,742432,78819555,[49167247,'']],[4264850,4264865,177809265,[49167247,'']],[4264850,4264865,68891870,[49167247,'']],[4264850,4264865,181968290,[49167247,'']],[94563,94567,68890474,[49167247,'']],[94563,94567,68892277,[49167247,'']],[94563,94567,115378389,[49167247,'']],[94563,94567,68890161,[49167247,'']],[94563,64790058,136868079,[49167247,'']],[94563,64790058,225821679,[49167247,'']],[94563,64790058,68891521,[49167247,'']],[94563,64790058,68893276,[49167247,'']],[2190563,6869299,73354536,[49167247,'']],[2190563,6869299,68891286,[49167247,'']],[2190563,6869299,68890467,['']],[2190563,6869299,120610788,[49167247,'']],[2190563,6869299,231562459,[49167247,'']],[2190563,6869299,70889172,[49167247,'']],[2190563,9876627,68892540,[49167247,'']],[2190563,9876627,131056197,[49167247,'']],[2190563,9876627,68890279,[49167247,'']],[94564,742432,231573625,[49167247,'']],[94564,742432,136878988,[49167247,'']],[94564,742432,127598058,[49167247,'']],[94563,94567,68894164,[49167247,'']],[94563,94567,68890352,['']],[94563,94567,68894046,[49167247,'']],[94563,94567,136878988,['']] ]; // local array of makes and models so we can tell which is which var mks_mos = [[3140121,1],[32144640,0],[2968515,1],[1014543,0],[9878842,0],[94563,1],[94567,0],[64790058,0],[33798998,0],[163026706,0],[2190563,1],[6869299,0],[9876627,0],[29744489,1],[155320179,0],[4264850,1],[68894815,0],[4264865,0],[55604681,0],[32061749,1],[82734503,0],[68438186,0],[32062060,0],[94564,1],[1362812,0],[742432,0],[3398752,0],[1362743,0],[2870368,0],[5240856,1],[5240857,0]]; // get a local set of ids for the amenities (we dont really need the description, unless // we want to get really fancy and have the form adjust itself based on selections made // (only show relevant body styles / amenities / neighborhoods based on the chosen make/model) var amenities = [49167247,485650]; // get a local set of ids for the styles so we can easily figure out what styles are needed var styles = [8577467,8577468,142802904,8586495,8577469,8577471,8577470,8577472,8577473]; // get a local mapping of locations to location groups. this allows us to trim accordion // results by neighborhood. var lgmap = [[68890467,69118356],[68891286,69118356],[166988526,69118356],[183818031,69118356],[225821679,69118356],[68891682,69118357],[68892019,69118357],[231573625,69118357],[68890467,69118358],[68890474,69118358],[68892330,69118358],[68893961,69118358],[68894164,69118358],[78778372,69118358],[166985227,69118358],[168646483,69118358],[213852827,69118358],[70889185,69879897],[209179149,69879897],[68890161,68890038],[68890241,68890038],[68890563,68890038],[68891521,68890038],[68893002,68890038],[68893139,68890038],[68894164,68890038],[69118440,68890038],[120407305,68890038],[131073828,68890038],[136868079,68890038],[136878988,68890038],[168646483,68890038],[181164648,68890038],[213852827,68890038],[223103782,68890038],[230278981,68890038],[68890296,68890045],[68892050,68890045],[85823292,68890045],[115372444,68890045],[68891697,68890048],[68893139,68890048],[68894418,68890048],[136883854,68890048],[231562459,68890048],[68890467,68890051],[68890474,68890051],[68891654,68890051],[68892277,68890051],[68892330,68890051],[68893276,68890051],[78819555,68890051],[131073828,68890051],[168646483,68890051],[68890279,68890052],[68890293,68890052],[68891787,68890052],[68891870,68890052],[68892540,68890052],[68893225,68890052],[69118433,68890052],[115378389,68890052],[127598058,68890052],[128053186,68890052],[142335334,68890052],[166992322,68890052],[177230119,68890052],[177809847,68890052],[181968290,68890052],[187530706,68890052],[68891521,68890053],[68894108,68890054],[177753290,68890054],[177809265,68890054],[68892235,68890055],[68893322,68890055],[70889169,68890056],[128044087,68890056],[165336260,68890056],[166960292,68890056],[68894046,68890057],[73354536,68890057],[78778372,68890057],[120610788,68890057],[166977039,68890057],[166985227,68890057],[181958191,68890057]]; // get a local mapping of models to styles. this allows us to trim accordion results by style var stylemap = [[94567,8577471],[742432,8577473],[1014543,8577468],[1362743,8577469],[1362812,8577471],[2870368,8577472],[3398752,8586495],[4264865,8577473],[5240857,8577471],[6869299,8577471],[9876627,142802904],[9878842,8577467],[9878842,8577468],[32062060,8577470],[32062060,8577473],[32144640,8577471],[33798998,8577470],[64790058,8577470],[82734503,8577471],[155320179,8577471],[155320179,8586495],[163026706,8586495],[163026706,142802904]]; // globals for finding your local address in the search box var closestaddr = new Object(); var firstaddr = new Object(); var addrstr; // TODO: right now, this just returns the coords for one address, // we should expand this to support multiple address geocoding function refreshCarsByAddress() { var addr = document.getElementById('gmaps-address').value; addrstr = addr; var new_addr; if (addr.match(/[ ]*/) != null && addr != "enter some or all of an address") { geocode(addrstr, function (p) { // see if this address is closer to the current fleet of a modified address is closer if (p) { firstaddr.lat = p.lat(); firstaddr.lng = p.lng(); } else { // this is kinda lame, but at least it is in the ocean firstaddr.lat = 0; firstaddr.lng = 0; } geocode(addrstr + ', Pennsylvania', function (s) { var old_dist, new_dist, e; if (!s && (firstaddr.lat == 0 && firstaddr.lng == 0)) { closestaddr.lat = 0; closestaddr.lng = 0; } else if (!s) { closestaddr.lat = firstaddr.lat; closestaddr.lng = firstaddr.lng; } else if (firstaddr.lat == 0 && firstaddr.lng == 0) { closestaddr.lat = s.lat(); closestaddr.lng = s.lng(); } else { old_dist = Math.sqrt(Math.pow(firstaddr.lat - 39.95163151, 2) + Math.pow(firstaddr.lng - -75.17116977, 2)); new_dist = Math.sqrt(Math.pow(s.lat() - 39.95163151, 2) + Math.pow(s.lng() - -75.17116977, 2)); if (old_dist >= new_dist) { closestaddr.lat = s.lat(); closestaddr.lng = s.lng(); } else { closestaddr.lat = firstaddr.lat; closestaddr.lng = firstaddr.lng; } } if (!(closestaddr.lat == 0 && closestaddr.lng == 0)) { find_loc.in_progress = 1; find_loc.retry = 1; place_home(closestaddr.lat, closestaddr.lng); recenter(eval(find_loc.map), closestaddr.lat, closestaddr.lng, 16, 0); e = document.getElementById('location_group_id'); if (e) { e.selectedIndex = 0; } $('#new-type-filter').hide(); find_loc.in_progress = 0; refreshAccordion(find_loc); } else { alert("sorry, we couldn't find that address"); } }); }); } }