var plan_key = ''; var meet_loc_url = '/pittsburgh/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 = [ [103818032,'20th+Street%2fSidney+Lot',40.429357953384454,-79.97742176055908],[103817442,'23rd+Street%2fEast+Carson+Street',40.42816558189375,-79.97321605682373],[116032966,'44+Street%2fPenn+Ave',40.46596816313191,-79.95270252227783],[93706905,'Beacon%2fBartlett+Lot',40.43527049692572,-79.92409944534302],[90529155,'Bluff+St+Lot+between+Towers+and+St+Martin+Hall',40.43520516779331,-79.98771071434021],[116032265,'Butler+Street%2fFisk+Street',40.469151426877744,-79.96145725250244],[106591548,'Carnegie+Mellon+University+East+Campus+Garage++++',40.44428530840773,-79.94203805923462],[68891531,'Centre+Avenue+and+South+Euclid+Avenue',40.458866492629575,-79.92916345596313],[68890373,'Centre+Avenue+and+South+Graham',40.456678700341165,-79.93637323379516],[68891839,'Centre+Avenue+and+South+Negley',40.45669502741314,-79.9364161491394],[103818491,'City+Theatre+Lot+14th+Street%2fMuriel+Street',40.42999496510597,-79.98437404632568],[68891901,'Court+Place+%26+Grant+Street',40.437034359507315,-79.99787092208862],[68892636,'Diamond+Street+and+Forbes+Avenue',40.43812858433286,-79.995596408844],[68893997,'Eighth+Street%2fPenn+Avenue+Lot',40.44374641343403,-79.99909400939941],[69118369,'Ellsworth+Ave+%26+Maryland+Ave',40.455917,-79.93102],[68891664,'Fifth+Avenue%2fUniversity+Place',40.443926045571985,-79.95572805404663],[68892387,'Forbes+Avenue+in+front+of+the+Pitt+Student+Union',40.4426522800454,-79.95519161224365],[68891528,'Forbes+Avenue%2fAtwood+Street',40.44100288112949,-79.95789527893066],[68892172,'Forbes+Avenue%2fWood+Street',40.440055683260994,-80.00113248825073],[68890821,'Fort+Duquesne+Boulevard%2fGateway+Towers+Entrance',40.4426522800454,-80.00714063644409],[68890152,'Fourth+Avenue+and+Smithfield+Street',40.43865119289088,-79.99945878982544],[194018867,'Fourth+Avenue%2fGrant+Street',40.438210242187836,-79.99799966812134],[68891669,'Gateway+Center+Garage+Ramp',40.441413,-80.004534],[90527980,'Locust+St%2fMcAnulty+St',40.436993529878116,-79.9925172328949],[68894554,'Margeret+Morrison%2fForbes+Avenue',40.44258695808571,-79.93791818618774],[68890192,'Phillips+Avenue+and+Murray+Avenue',40.43259195044884,-79.92274761199951],[117693366,'Sampsonia+Way+%28Mattress+Factory%29',40.456678700341165,-80.01222610473633],[68893543,'ShureSave+Parking+Lot',40.463486745213984,-79.95177984237671],[68893745,'Sixth+Ave%2e+%26+William+Penn+Place',40.44114,-79.996799],[68891218,'South+Highland+Avenue',40.45849098110742,-79.92506504058838],[68893340,'Theatre+Square+Garage',40.443273,-80.000301],[68890748,'William+Penn+Place%2fFifth+Avenue',40.439729060211896,-79.9975061416626],[77883618,'William+Penn+Place%2fStrawberry+Way',40.44170510541712,-79.996497631073]]; // create a data structure for all the location groups var loc_grps = [ [68890003, 40.46620211174121266666666666666666666667, -79.95531320571899333333333333333333333333, 15],[58890465, 40.44343613324672, -79.93997812271118, 15],[68890000, 40.44047824344069425, -79.99949422464243583333333333333333333333, 15],[68890001, 40.44254204120814625, -79.95168328285217, 15],[90532149, 40.436099348835713, -79.990113973617555, 15],[116971430, 40.456678700341165, -80.01222610473633, 15],[68890004, 40.45732964029826, -79.931607575897214, 15],[104044459, 40.42917283346139133333333333333333333333, -79.97833728790283, 15],[68890002, 40.43393122368728, -79.923423528671265, 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 = [ [94564,22394846,68891531,[49167247,'']],[94564,22394846,68891528,[49167247,'']],[94563,68894811,68893745,['']],[94563,94567,90529155,[49167247,'']],[94563,94567,68894554,[49167247,'']],[94563,94567,116032265,[49167247,'']],[94563,94567,68891218,[49167247,'']],[2968515,1014543,194018867,[49167247,'']],[2968515,1014543,68893997,[49167247,'']],[94564,2870368,68890152,['']],[94564,2870368,68891664,['']],[94563,94567,103817442,[49167247,'']],[94563,94567,68891901,[49167247,'']],[94563,45910234,69118369,[49167247,'']],[4264850,55604681,68892636,[49167247,'']],[94563,33798998,68892172,['']],[94563,45910234,68890192,[49167247,'']],[94563,45910234,68893543,[49167247,'']],[2190563,6869299,69118369,[49167247,'']],[2190563,6869299,106591548,[49167247,'']],[32061749,68438186,68893340,['']],[32061749,68438186,103818032,['']],[32061749,68438186,68890192,['']],[32061749,68438186,68891839,['']],[32061749,68438186,68892387,['']],[94564,3398752,90527980,[49167247,'']],[94564,3398752,68890373,[49167247,'']],[5240856,5240857,93706905,[485650,'']],[5240856,5240857,68891669,[485650,'']],[94564,3398752,106591548,[49167247,'']],[2190563,6869299,68890821,[49167247,'']],[2190563,6869299,116032966,[49167247,'']],[3140121,32144640,68890748,[485650,49167247,'']],[94563,3636051,77883618,['']],[2190563,6869299,103818491,[49167247,'']],[2190563,6869299,117693366,[49167247,'']],[2190563,6869299,68893997,[49167247,'']] ]; // local array of makes and models so we can tell which is which var mks_mos = [[3140121,1],[32144640,0],[2968515,1],[1014543,0],[94563,1],[3636051,0],[94567,0],[45910234,0],[33798998,0],[68894811,0],[2190563,1],[6869299,0],[4264850,1],[55604681,0],[32061749,1],[68438186,0],[94564,1],[3398752,0],[2870368,0],[22394846,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 = [8577468,8586495,8577469,8577471,8577470,8577472]; // get a local mapping of locations to location groups. this allows us to trim accordion // results by neighborhood. var lgmap = [[68894554,58890465],[106591548,58890465],[68890152,68890000],[68890748,68890000],[68890821,68890000],[68891669,68890000],[68891901,68890000],[68892172,68890000],[68892636,68890000],[68893340,68890000],[68893745,68890000],[68893997,68890000],[77883618,68890000],[194018867,68890000],[68891528,68890001],[68891664,68890001],[68892387,68890001],[68894554,68890001],[68890192,68890002],[93706905,68890002],[68893543,68890003],[116032265,68890003],[116032966,68890003],[68890373,68890004],[68891218,68890004],[68891531,68890004],[68891839,68890004],[69118369,68890004],[90527980,90532149],[90529155,90532149],[103817442,104044459],[103818032,104044459],[103818491,104044459],[117693366,116971430]]; // get a local mapping of models to styles. this allows us to trim accordion results by style var stylemap = [[94567,8577471],[1014543,8577468],[2870368,8577472],[3398752,8586495],[3636051,8577471],[5240857,8577471],[6869299,8577471],[22394846,8577471],[32144640,8577471],[33798998,8577470],[45910234,8577471],[45910234,8586495],[68894811,8577469]]; // 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 - 40.44453652, 2) + Math.pow(firstaddr.lng - -79.97093916, 2)); new_dist = Math.sqrt(Math.pow(s.lat() - 40.44453652, 2) + Math.pow(s.lng() - -79.97093916, 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"); } }); }); } }