var plan_key = ''; var meet_loc_url = '/ufl/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 = [ [198000433,'Chemistry+Laboratory+Building',29.651840695768,-82.34457850456238],[197990848,'Health+Science+Center',29.639751572592914,-82.34670281410217],[197994507,'Inner+Road',29.647388449437887,-82.34221816062927],[197992070,'UF+Bookstore',29.644712344849932,-82.3481297492981]]; // create a data structure for all the location groups var loc_grps = [ [68890149, 29.64592326566218325, -82.34540730714798, 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 = [ [94563,45910234,197990848,[49167247,'']],[94563,45910234,197994507,[49167247,'']],[94563,68894811,197990848,['']],[4264850,4264865,198000433,[49167247,'']],[94564,742432,197994507,[49167247,'']],[94564,742432,198000433,[49167247,'']],[94563,163026706,197992070,[49167247,'']],[94563,94567,197992070,[49167247,'']] ]; // local array of makes and models so we can tell which is which var mks_mos = [[94563,1],[94567,0],[45910234,0],[163026706,0],[68894811,0],[4264850,1],[4264865,0],[94564,1],[742432,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]; // get a local set of ids for the styles so we can easily figure out what styles are needed var styles = [142802904,8586495,8577469,8577471,8577473]; // get a local mapping of locations to location groups. this allows us to trim accordion // results by neighborhood. var lgmap = [[197990848,68890149],[197992070,68890149],[197994507,68890149],[198000433,68890149]]; // get a local mapping of models to styles. this allows us to trim accordion results by style var stylemap = [[94567,8577471],[742432,8577473],[4264865,8577473],[45910234,8577471],[45910234,8586495],[68894811,8577469],[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 + ', Florida', 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 - 29.64592327, 2) + Math.pow(firstaddr.lng - -82.34540731, 2)); new_dist = Math.sqrt(Math.pow(s.lat() - 29.64592327, 2) + Math.pow(s.lng() - -82.34540731, 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"); } }); }); } }