google.load("search", "1"); function loading() { var b = document.getElementById("aga2").value; putmap(b); onpostback(); CreateHiddenRadio() } function TransformSearchwell() { var b = document.getElementById("results"); var c = document.getElementById("empty"); b.style.height = "610px"; b.className = "searchwelltransform"; c.innerHTML = "" } var themarkericon; var themarkerclass; var ref; var isclick = true; var manIcon = new google.maps.MarkerImage("man.png", new google.maps.Size(45, 55), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var WeatherIcon = new google.maps.MarkerImage("../Images/icons/cloudsun.png", new google.maps.Size(58, 58), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var gYellowIcon = new google.maps.MarkerImage("../Images/icons/cluster3.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var ClinicIcon = new google.maps.MarkerImage("../Images/icons/doctor.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var HotelIcon = new google.maps.MarkerImage("hotel.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var FoodIcon = new google.maps.MarkerImage("../Images/icons/restaurant.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var BarsIcon = new google.maps.MarkerImage("../Images/icons/bar.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var BookIcon = new google.maps.MarkerImage("../Images/icons/bookstore.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var WifiIcon = new google.maps.MarkerImage("../Images/icons/wifi.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var WifiIcon = new google.maps.MarkerImage("../Images/icons/wifi.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var CarIcon = new google.maps.MarkerImage("../Images/icons/car.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var MallIcon = new google.maps.MarkerImage("../Images/icons/shoppingmall.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var ParkIcon = new google.maps.MarkerImage("../Images/icons/park.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var ApartmentIcon = new google.maps.MarkerImage("../Images/icons/apartment.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var RealtyIcon = new google.maps.MarkerImage("../Images/icons/realestate.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var ParkingIcon = new google.maps.MarkerImage("../Images/icons/parking.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var MovieIcon = new google.maps.MarkerImage("../Images/icons/cinema.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var HospitalIcon = new google.maps.MarkerImage("../Images/icons/hospital.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var CoffeeIcon = new google.maps.MarkerImage("../Images/icons/coffee.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var BankIcon = new google.maps.MarkerImage("../Images/icons/bank.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var AtmIcon = new google.maps.MarkerImage("../Images/icons/atm.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var AirportIcon = new google.maps.MarkerImage("../Images/icons/airport.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var SchoolIcon = new google.maps.MarkerImage("../Images/icons/school.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var UniversityIcon = new google.maps.MarkerImage("../Images/icons/university.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); var GymIcon = new google.maps.MarkerImage("../Images/icons/gym.png", new google.maps.Size(38, 38), new google.maps.Point(0, 0), new google.maps.Point(6, 20)); 
function ExecuteRadioSearch(b) { $("#Rdio input").click(function() { if (b == map.getCenter()) { TransformSearchwell(); var h = $("#cj").val(); var m = document.getElementById("love"); var k = $("#RadioDiv input:radio:checked").val(); if (k != "" && k != undefined) { var d = $("#" + k).text(); ChooseNearPoint(d); var g = k; var j = g.indexOf("-"); while (j != -1) { g = g.replace("-", " "); j = g.indexOf("-") } GetNearbyPlaces(b, g); loadJSON(b.lat(), b.lng()); var l = document.getElementById("notify1"); l.innerHTML = CountResult(d); m.style.display = ""; TransformSearchwell() } else { if (k == undefined && h.length == 0) { return } else { if (h.length != 0) { ChooseNearPoint(k); GetNearbyPlaces(b, h); loadJSON(b.lat(), b.lng()); var l = document.getElementById("notify1"); l.innerHTML = CustomResult(b); m.style.display = ""; TransformSearchwell() } else { var f = document.getElementById("results"); var i = document.getElementById("empty"); f.className = "searchwellinvisible"; m.style.display = "none"; i.innerHTML = "<br />Ooops, I can't recognize what you're searching."; return } } } } else { return } }) } 
function ChooseNearPoint(b) { switch (b) { case "Clinics": themarkerclass = "clinicresult"; themarkericon = ClinicIcon; break; case "Hotels": themarkerclass = "hotelresult"; themarkericon = HotelIcon; break; case "Foods": themarkerclass = "foodresult"; themarkericon = FoodIcon; break; case "Bars": themarkerclass = "barresult"; themarkericon = BarsIcon; break; case "Books": themarkerclass = "bookresult"; themarkericon = BookIcon; break; case "Wifis": themarkerclass = "wifiresult"; themarkericon = WifiIcon; break; case "Cars": themarkerclass = "carresult"; themarkericon = CarIcon; break; case "Malls": themarkerclass = "mallresult"; themarkericon = MallIcon; break; case "Parks": themarkerclass = "parkresult"; themarkericon = ParkIcon; break; case "Apartments": themarkerclass = "apartmentresult"; themarkericon = ApartmentIcon; break; case "Realty": themarkerclass = "realtyresult"; themarkericon = RealtyIcon; break; case "Parking": themarkerclass = "parkingresult"; themarkericon = ParkingIcon; break; case "Movies": themarkerclass = "movieresult"; themarkericon = MovieIcon; break; case "Hospitals": themarkerclass = "hospitalresult"; themarkericon = HospitalIcon; break; case "Coffee": themarkerclass = "coffeeresult"; themarkericon = CoffeeIcon; break; case "Banks": themarkerclass = "bankresult"; themarkericon = BankIcon; break; case "ATMS": themarkerclass = "atmresult"; themarkericon = AtmIcon; break; case "Airports": themarkerclass = "airportresult"; themarkericon = AirportIcon; break; case "Schools": themarkerclass = "schoolresult"; themarkericon = SchoolIcon; break; case "Universities": themarkerclass = "universityresult"; themarkericon = UniversityIcon; break; case "Gym": themarkerclass = "gymresult"; themarkericon = GymIcon; break; case "": themarkerclass = "customresult"; themarkericon = gYellowIcon; break } } function ExecuteRadioSearcher(b) { $("#Rdio input").click(function() { if (ref == 0) { ref = 1; TransformSearchwell(); var h = $("#cj").val(); var m = document.getElementById("love"); var k = $("#RadioDiv input:radio:checked").val(); if (k != "" && k != undefined) { var d = $("#" + k).text(); ChooseNearPoint(d); var g = k; var j = g.indexOf("-"); while (j != -1) { g = g.replace("-", " "); j = g.indexOf("-") } GetNearbyPlaces(b, g); loadJSON(b.lat(), b.lng()); var l = document.getElementById("notify1"); l.innerHTML = CountResult(d); m.style.display = ""; TransformSearchwell() } else { if (k == undefined && h.length == 0) { return } else { if (h.length != 0) { ChooseNearPoint(k); GetNearbyPlaces(b, h); loadJSON(b.lat(), b.lng()); var l = document.getElementById("notify1"); l.innerHTML = CustomResult(b); m.style.display = ""; TransformSearchwell() } else { var f = document.getElementById("results"); var i = document.getElementById("empty"); f.className = "searchwellinvisible"; m.style.display = "none"; i.innerHTML = "<br />Ooops, I can't recognize what you're searching."; return } } } } else { return } }) } function CustomResult() { return '<b>"Result"</b> near ' } function SearchWhileMoving(l) { var h = $("#cj").val(); var n = document.getElementById("love"); var k = $("#RadioDiv input:radio:checked").val(); if (k != undefined && k != "") { var d = $("#" + k).text(); ChooseNearPoint(d); var g = k; var j = g.indexOf("-"); while (j != -1) { g = g.replace("-", " "); j = g.indexOf("-") } if (isclick == true) { GetNearbyPlaces(l, g) } loadJSON(l.lat(), l.lng()); var m = document.getElementById("notify1"); m.innerHTML = CountResult(d); n.style.display = ""; TransformSearchwell() } else { if (k == "" && h.length != 0) { ChooseNearPoint(k); if (isclick == true) { GetNearbyPlaces(l, h) } loadJSON(l.lat(), l.lng()); var m = document.getElementById("notify1"); m.innerHTML = CustomResult(); n.style.display = ""; TransformSearchwell() } else { n.style.display = "none"; var f = document.getElementById("results"); var i = document.getElementById("empty"); f.className = "searchwellinvisible"; i.innerHTML = ""; return } } } function GetNearbyPlaces(c, d) { gLocalSearch.setCenterPoint(c); gLocalSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET); gLocalSearch.execute(d) } function hideloading() { var b = document.getElementById("divLoading"); b.style.display = "none" } function showloading() { var b = document.getElementById("divLoading"); b.style.display = "block" } function loading2() { return false; var b = document.getElementById("Button1"); putmap2(); CreateHiddenRadio(); b.onclick = function(j) { var l = document.getElementById("emptymessage"); var f = document.getElementById("Label1"); var g = document.getElementById("aga2"); var k = document.getElementById("Joel").value; if (k.length == 0) { l.innerHTML = "<p class='lwrong'>Please specify a location.</p>"; l.style.display = ""; f.style.display = "none"; document.getElementById("Joel").focus(); return false } g.value = k } } var timer; var directionDisplay; var oXHR = null; var blnRequestsEnabled = true; var blnRequestsEnabled1 = true; var publisher_id = "ca-pub-9364973640152668"; var geocoder; var map; var gLocalSearch; var gSelectedResults = []; var gCurrentResults = []; var gInfoWindow; var infowindow; var marker; var ref1; var locale; var infowindow1; 

function GetWeather2(c) { if (suggestion) { var f = suggestion.match(/\w\d{4,7}/); if (f != null) { var i = "<Iframe src=' WeatherSearchFramer1.aspx?Joel=" + f + "&zip=" + c.lat().toString() + "," + c.lng().toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />";  return } var b = suggestion.split(","); if (b.length > 2) { var e = b[0] + "," + b[b.length - 1]; var i = "<Iframe src=' WeatherSearchFramer2.aspx?Joel=" + e + "&zip=" + c.lat().toString() + "," + c.lng().toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />" } else { var i = "<Iframe src=' WeatherSearchFramer3.aspx?Joel=" + suggestion + "&zip=" + c.lat().toString() + "," + c.lng().toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />" }  } else { var h = c.lat(); var d = c.lng(); var j = new google.maps.LatLng(h, d); geocoder.geocode({ latLng: j }, function(o, m) { if (m == google.maps.GeocoderStatus.OK) { if (o[1]) { var l = o[1].formatted_address; var g = l.split(","); var n = g.length; var q = $("#Joel").val(); if (n == 1) { if (q.indexOf(",") == -1) { var k = g[0] } else { var k = q } var p = "<Iframe src=' WeatherSearchFrame4r.aspx?Joel=" + k + "&zip=" + h.toString() + "," + d.toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />"; infowindow1 = new google.maps.InfoWindow({ content: p }); infowindow1.open(map, weathermarker) } else { if (q.indexOf(",") == -1) { var k = q + "," + g[n - 1] } else { var k = q } var p = "<Iframe src=' WeatherSearchFramer777.aspx?Joel=" + k + "&zip=" + h.toString() + "," + d.toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />"; infowindow1 = new google.maps.InfoWindow({ content: p });  } } else { var p = "<Iframe src=' WeatherSearchFramer33.aspx?Joel=1234567&zip=" + h.toString() + "," + d.toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />";  } } else { var p = "<Iframe src=' WeatherSearchFramer55.aspx?Joel=1234567&zip=" + h.toString() + "," + d.toString() + "' id='weatherIframe' scrolling='no' frameborder='0' />";  } }) } } var weathermarker; 

function GetWeather(d, c) { var e = c.lat().toString() + "," + c.lng().toString(); var f = "dd "; infowindow1 = new google.maps.InfoWindow({ content: f }); 
var adUnitDiv = document.createElement('div');
// Note: replace the publisher ID noted here with your own
 // publisher ID.
 var adUnitOptions = {
   format: google.maps.adsense.AdFormat.SKYSCRAPER,
   position: google.maps.ControlPosition.RIGHT_CENTER,
   publisherId: 'ca-pub-9364973640152668',
   map: map,
   visible: true
 };
 var adUnit = new google.maps.adsense.AdUnit(adUnitDiv, adUnitOptions);

weathermarker = new google.maps.Marker({ position: c, map: map, icon: WeatherIcon, title: "Latest Weather Condition" }); infowindow1.close(map, weathermarker); google.maps.event.addListener(weathermarker, "click", function() { infowindow1.open(map, weathermarker) }) } 

function CreateCenterMarkerWithWeather(c) { if (infowindow) { infowindow.close() } if (marker) { marker.setMap(null) } if (weathermarker) { weathermarker.setMap(null) } marker = new google.maps.Marker({ icon: manIcon, position: c, map: map }); if (suggestion) { if ($("#Joel").val() == "") { var d = "<p>You're in <b style='color:blue'>" + suggestion + "</b>." } else { var d = "<p>You're in <b style='color:blue'>" + suggestion + "</b>.<br/>Press <b>[enter]</b> or <b>[submit]</b> to view <b>hotels in this area</b>.</p>" } infowindow = new google.maps.InfoWindow({ content: d }); infowindow.open(map, marker) } weathermarker = new google.maps.Marker({ position: c, map: map, icon: WeatherIcon, title: "Latest Weather Condition" }); google.maps.event.addListener(weathermarker, "click", function() { GetWeather2(c) }) } 
function CreateCenterMarker(c) { if (infowindow) { infowindow.close() } if (marker) { marker.setMap(null) } marker = new google.maps.Marker({ icon: manIcon, position: c, map: map }); google.maps.event.addListener(marker, "mouseover", function() { if (infowindow) { infowindow.close() } if (locale == null || !locale) { loadJSONer(c.lat(), c.lng()) } else { infowindow = new google.maps.InfoWindow({ content: locale }); infowindow.open(map, marker) } }) } 

function loadsearch() { gLocalSearch = new GlocalSearch(); gLocalSearch.setSearchCompleteCallback(null, OnLocalSearch) } 
function loadJSONer(c, i) { if (blnRequestsEnabled1) { try { if (!oXHR) { oXHR = zXmlHttp.createRequest() } else { if (oXHR.readyState != 0) { oXHR.abort() } } var h = { lat: c, lon: i }; oXHR.open("post", "/1samplenewsticker/GetLocation.aspx", true); oXHR.onreadystatechange = function() { if (oXHR.readyState == 4) { var j = oXHR.responseText; var k = YAHOO.lang.JSON.parse(j); if (k.length != 0) { var m = "<p>You're located @<span style='color:red'> " + k + ".</span><br />Double-click or drag the map to change your location.</p>"; infowindow = new google.maps.InfoWindow({ content: m }); locale = m; infowindow.open(map, marker) } else { var l = "Point(" + c + "," + i + ")<br />Double-click or drag the map to change your location."; var m = "<p>" + l + "</p>"; infowindow = new google.maps.InfoWindow({ content: m }); locale = m; infowindow.open(map, marker) } } }; var b = YAHOO.lang.JSON.stringify(h); oXHR.send(b) } catch (d) { blnRequestsEnabled1 = false } } else { var f = "Point(" + c + "," + i + ")<br />Double-click or drag the map to change your location."; var g = "<p>" + f + "</p>"; infowindow = new google.maps.InfoWindow({ content: g }); locale = g; infowindow.open(map, marker) } } function loadJSON(c, f) { if (blnRequestsEnabled) { try { if (!oXHR) { oXHR = zXmlHttp.createRequest() } else { if (oXHR.readyState != 0) { oXHR.abort() } } var e = { lat: c, lon: f }; oXHR.open("post", "/1samplenewsticker/GetLocation.aspx", true); oXHR.onreadystatechange = function() { if (oXHR.readyState == 4) { var h = oXHR.responseText; var i = YAHOO.lang.JSON.parse(h); var g = document.getElementById("notify2"); if (i.length != 0) { g.innerHTML = i } else { g.innerHTML = "Point(" + c + "," + f + ")<br />" } } }; var b = YAHOO.lang.JSON.stringify(e); oXHR.send(b) } catch (d) { blnRequestsEnabled = false } } else { a.innerHTML = "Point(" + c + "," + f + ")<br />" } } function putmap(b) { showloading(); geocoder = new google.maps.Geocoder(); addToMap(b) } function addToMap(c) { var b = c; ref1 = 0; geocoder.geocode({ address: b }, function(g, f) { if (f == google.maps.GeocoderStatus.OK) { var d = g[0].geometry.location; directionDisplay = new google.maps.DirectionsRenderer(); var e = { zoom: 13, center: d, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("Map"), e); directionDisplay.setMap(map); $("#Joel").focus(); $("#Joel").keyup(primaryFunction); $("#Joel").submit(primaryFunction); ExecuteRadioSearch(map.getCenter()); CreateCenterMarker(map.getCenter()); google.maps.event.addListener(map, "idle", function() { locale = null; var h = map.getCenter(); ExecuteRadioSearch(h); SearchWhileMoving(h) }); google.maps.event.addListener(map, "center_changed", function() { locale = null; var h = map.getCenter(); CreateCenterMarker(h); ref1 = 1 }); google.maps.event.addListener(map, "dblclick", function() { isclick = true; locale = null; var h = map.getCenter(); SearchWhileMoving(h) }); google.maps.event.addListener(map, "dragend", function() { isclick = true; locale = null; var h = map.getCenter(); SearchWhileMoving(h) }); openInfoWindow(); GetWeather(b, d); loadsearch(); hideloading() } else { addToMap("Chico,Ca") } }) } function openInfoWindow() { gInfoWindow = new google.maps.InfoWindow; google.maps.event.addListener(gInfoWindow, "closeclick", function() { unselectMarkers() }) } function doSearch(b) { gLocalSearch.setCenterPoint(b); gLocalSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET); gLocalSearch.execute($("#RadioDiv input:radio:checked").val()) } function ClearSearch() { var b = document.getElementById("searchwell"); b.innerHTML = "" } function CountResult(c) { return '<b>"' + c + '"</b>  near ' } function OnLocalSearch() { isclick = true; if (!gLocalSearch.results) { return } var f = document.getElementById("searchwell"); f.innerHTML = ""; for (var d = 0; d < gCurrentResults.length; d++) { gCurrentResults[d].marker().setMap(null) } gCurrentResults = []; for (var d = 0; d < gLocalSearch.results.length; d++) { gCurrentResults.push(new LocalResult(gLocalSearch.results[d])) } var e = gLocalSearch.getAttribution(); if (e) { document.getElementById("searchwell").appendChild(e) } } function unselectMarkers() { for (var b = 0; b < gCurrentResults.length; b++) { gCurrentResults[b].unselect() } } function LocalResult(b) { var d = this; d.result_ = b; d.resultNode_ = d.node(); google.maps.event.addDomListener(d.resultNode_, "click", function() { isclick = false; d.select() }); document.getElementById("searchwell").appendChild(d.resultNode_); d.marker_ = d.marker(); if (themarkerclass) { d.resultNode_.className = themarkerclass } else { var e = $("#RadioDiv input:radio:checked").val(); ChooseNearPoint(e); d.resultNode_.className = themarkerclass } } LocalResult.prototype.node = function() { if (this.resultNode_) { return this.resultNode_ } return this.html() }; LocalResult.prototype.marker = function() { var d = this; var b; if (d.marker_) { return d.marker_ } if (themarkericon) { var e = themarkericon; b = d.marker_ = new google.maps.Marker({ position: new google.maps.LatLng(parseFloat(d.result_.lat), parseFloat(d.result_.lng)), icon: e, map: map }); google.maps.event.addListener(b, "click", function() { isclick = false; d.select() }) } else { var f = $("#RadioDiv input:radio:checked").val(); ChooseNearPoint(f); var e = themarkericon; b = d.marker_ = new google.maps.Marker({ position: new google.maps.LatLng(parseFloat(d.result_.lat), parseFloat(d.result_.lng)), icon: e, map: map }); google.maps.event.addListener(b, "click", function() { isclick = false; d.select() }) } return b }; LocalResult.prototype.select = function() { unselectMarkers(); this.selected_ = true; gInfoWindow.setContent(this.html(true)); gInfoWindow.open(map, this.marker()) }; LocalResult.prototype.isSelected = function() { return this.selected_ }; LocalResult.prototype.unselect = function() { this.selected_ = false }; LocalResult.prototype.html = function() { var c = this; var b = document.createElement("div"); b.className = "unselected"; b.appendChild(c.result_.html.cloneNode(true)); return b }; LocalResult.prototype.highlight = function(b) { this.marker().setOptions({ icon: b ? gRedIcon : gYellowIcon }); this.node().className = "unselected" + (b ? " red" : "") }; function showLayerbox() { document.getElementById("box").style.display = "block" } function onpostback() { CheckHiddenRadio() } function CheckHiddenRadio() { $("#Rdio input:radio").click(function() { var c = document.getElementById("more_innerer"); var b = $("#box input:radio:checked").val(); if (b != undefined) { c.className = "highlight" } else { c.className = "" } }) } function setClose() { var b = document.getElementById("box"); b.style.display = "none"; return false } function CreateHiddenRadio() { var c = document.getElementById("outer_more"); var d = document.getElementById("CloseLink"); c.onclick = showLayerbox; d.onclick = setClose } function checkChecked() { var c = document.getElementsByName("mark"); for (var b = 0; b < c.length; b++) { if (c[b].checked) { return true } } return false } var suggestion; var suggestion2; var sugdat; var sugdat2; var directions; var directionsService = new google.maps.DirectionsService(); var markersArray = []; var DIR1now; var DIR1b4; var DIR2now; var DIR2b4; var ne; var sw; var tabkey; var regex1; $("#Joel").live("keydown", function(c) { isclick = true; var b = c.keyCode || c.which; if (b == 13) { if ($("#Joel").val().length != 0) { if (suggestion) { $("#Joel").val(suggestion); GetWeather2(map.getCenter()) } else { return } } else { return } } }); function calcRoute() { var d = suggestion; var b = suggestion2; var c = { origin: d, destination: b, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(c, function(f, e) { if (e == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(f) } }) } function primaryFunction() { if ($("#Joel").val() == "") { updateHTML("suggestion", ""); if (infowindow) { infowindow.close() } if (suggestion) { var b = "<p>You're in <b style='color:blue'>" + suggestion + "</b>.</p>"; if (b == "<p>You're in <b style='color:blue'>[object HTMLElement]</b>.</p>") { return false } infowindow = new google.maps.InfoWindow({ content: b }); infowindow.open(map, marker) } return } var c = $("#Joel").val(); directions = null; directions = c.match(/ to /ig); if (directions) { directions = c.split(/ to /ig); directions0 = directions[0]; directions1 = directions[1]; $.ajax({ type: "GET", url: "http://maps-api-ssl.google.com/maps/suggest?hl=en&gl=us&v=2&json=b&src=1,2&num=5&numps=5&callback=handleResponse&q=" + directions0 + "&cp=" + directions0.length, dataType: "script", queue: "DIR1", cancelExisting: true }); $.ajax({ type: "GET", url: "http://maps-api-ssl.google.com/maps/suggest?hl=en&gl=us&v=2&json=b&src=1,2&num=5&numps=5&callback=handleResponse2&q=" + directions1 + "&cp=" + directions1.length, dataType: "script", queue: "DIR2", cancelExisting: true }) } else { $.ajax({ type: "GET", url: "http://maps-api-ssl.google.com/maps/suggest?hl=en&gl=us&v=2&json=b&src=1,2&num=5&numps=5&callback=handleResponse&q=" + $("#Joel").val() + "&cp=" + $("#Joel").val().length, dataType: "script", queue: "SUG1", cancelExisting: true }) } } handleResponse = {}; handleResponse2 = {}; handleResponse = function(b) { DIR1b4 = suggestion; suggestion = parse(b); DIR1now = suggestion; if (DIR1b4 != DIR1now) { updateHTML("suggestion", suggestion); codeAddress(suggestion) } }; handleResponse2 = function(b) { DIR2b4 = suggestion2; suggestion2 = parse(b); DIR2now = suggestion2; if (DIR2b4 != DIR2now) { updateHTML("suggestion2", suggestion2); codeAddress(suggestion2) } calcRoute() }; function ReturnRandom() { var b = new Array(); b[0] = ' Hint: Click <img src="../Images/icons/cloudsun.png" /> for current weather on a location.'; b[1] = " Hint: You should see the map updates as soon as you start typing."; b[2] = "Hint: Scroll the map to update nearest points."; b[3] = "Hint: Double-click the map to update nearest points."; b[4] = "Hint: You can drag the list for nearest points to your preferred position."; b[5] = "Hint: Hover your mouse on the man icon for the location of the center of the map."; b[6] = "Hint: The man icon on the map is the base for the nearest points of interest."; b[7] = 'Hint: Enter your own customized nearest point category by clicking the "more choices...".'; b[8] = "Hint: Nearest points update as soon as you start typing."; b[9] = "Hint: The map suggests to you a location as soon as you start typing."; b[10] = "Hint: Press enter to auto-finish what you're typing."; b[11] = "Hint: Press enter to see the current weather on a location."; b[12] = "Hint: Click the icon on the list for nearest points to show on the map."; b[13] = "Hint: The man icon on the map represents you and your location."; b[14] = "Hint: The map updates as soon as you start typing."; var c = Math.floor(Math.random() * b.length); return b[c] } function updateHTML(b, c) { if (c != undefined) { document.getElementById(b).innerHTML = c + ' <span style="color:red;float:right">' + ReturnRandom() + "</span>" } else { document.getElementById(b).innerHTML = "<p>Ooops, can't find this location.</p>" } } function parse(b) { try { if (b.suggestion[0]["query"]) { return b.suggestion[0]["query"] } else { return null } } catch (c) { } } function codeAddress(c) { var b = c; geocoder.geocode({ address: b }, function(h, e) { if (e == google.maps.GeocoderStatus.OK) { var i = h[0].geometry.viewport.getNorthEast(); var d = h[0].geometry.viewport.getSouthWest(); map.fitBounds(h[0].geometry.viewport); var g = [i, new google.maps.LatLng(i.lat(), d.lng()), d, new google.maps.LatLng(d.lat(), i.lng()), i]; var f = new google.maps.Polyline({ path: g, strokeColor: "#FF0000", strokeOpacity: 0, strokeWeight: 0 }); f.setMap(map); CreateCenterMarkerWithWeather(h[0].geometry.location); if (infowindow1) { infowindow1.close() } } else { } }) } function PanoramioLayerCallback(f, b) { this.panoLayer = b; for (var e = 0; e < f.photos.length; e++) { var d = f.photos[e]; if (!b.ids[d.photo_id]) { var c = this.createMarker(d, b.markerIcon, b.map); b.mgr.addMarker(c, 0); b.ids[d.photo_id] = "exists"; b.mgr.addMarker(c, b.map.getZoom()) } } } PanoramioLayerCallback.prototype.formImgUrl = function(b, c) { return "http://www.panoramio.com/photos/" + c + "/" + b + ".jpg" }; PanoramioLayerCallback.prototype.formPageUrl = function(b) { return "http://www.panoramio.com/photo/" + b }; PanoramioLayerCallback.prototype.createMarker = function(e, i, d) { var g = this; var h = this.formImgUrl(e.photo_id, "mini_square"); if (h || h != null) { i = new google.maps.MarkerImage(h, new google.maps.Size(24, 24), new google.maps.Point(9, 9), new google.maps.Point(9, 0)) } var b = i; var c = new google.maps.Marker({ position: new google.maps.LatLng(parseFloat(e.latitude), parseFloat(e.longitude)), icon: b, map: d }); if (e.photo_title.length > 33) { e.photo_title = e.photo_title.substring(0, 33) + "&#8230;" } var f = "<div id='infowin' style='height:320px; width:240px;'><p><a href='http://www.panoramio.com/' target='_blank'><img src='http://www.panoramio.com/img/logo-small.gif' border='0' width='119px' height='25px' alt='Panoramio logo' /></a></p><a id='photo_infowin' target='_blank' href='" + e.photo_url + "'><img border='0' width='" + e.width + "' height='" + e.height + "' src='" + e.photo_file_url + "'/></a><div style='overflow: hidden; width: 240px;'><p><a target='_blank' class='photo_title' href='" + e.photo_url + "'><strong>" + e.photo_title + "</strong></a></p><p>Posted by <a target='_blank' href='" + e.owner_url + "'>" + e.owner_name + "</a></p></div></div>"; google.maps.event.addListener(c, "click", function() { var j = new google.maps.InfoWindow({ content: f }); j.open(d, c) }); return c }; function PanoramioLayer(d, e) { var c = this; c.map = d; c.ids = {}; c.mgr = new MarkerManager(d, { maxZoom: 19 }); var b = new google.maps.MarkerImage("http://www.panoramio.com/img/panoramio-marker.png", new google.maps.Size(24, 24), new google.maps.Point(9, 9), new google.maps.Point(9, 0)); c.markerIcon = b; c.enabled = false; google.maps.event.addListener(d, "dragend", function() { if (c.enabled) { var h = d.getBounds(); var g = h.getSouthWest(); var f = h.getNorthEast(); c.load(c, { maxy: f.lat(), miny: g.lat(), maxx: f.lng(), minx: g.lng() }) } }) } PanoramioLayer.prototype.enable = function() { this.enabled = true; var d = this.map.getBounds(); var c = d.getSouthWest(); var b = d.getNorthEast(); this.load(this, { maxy: b.lat(), miny: c.lat(), maxx: b.lng(), minx: c.lng() }) }; PanoramioLayer.prototype.disable = function() { this.enabled = false; this.mgr.clearMarkers(); this.ids = {} }; PanoramioLayer.prototype.getEnabled = function() { return this.enabled }; PanoramioLayer.prototype.load = function(panoLayer, userOptions) { var options = { order: "popularity", set: "public", from: "0", to: "10", minx: "-180", miny: "-90", maxx: "180", maxy: "90", size: "small" }; for (optionName in userOptions) { if (userOptions.hasOwnProperty(optionName)) { options[optionName] = userOptions[optionName] } } var url = "http://www.panoramio.com/map/get_panoramas.php?"; var uniqueID = ""; for (optionName in options) { if (options.hasOwnProperty(optionName)) { var optionVal = "" + options[optionName] + ""; url += optionName + "=" + optionVal + "&"; uniqueID += optionVal.replace(/[^\w]+/g, "") } } var callbackName = "PanoramioLayerCallback.loader" + uniqueID; eval(callbackName + " = function(json) { var pa = new PanoramioLayerCallback(json, panoLayer);}"); var script = document.createElement("script"); script.setAttribute("src", url + "callback=" + callbackName); script.setAttribute("id", "jsonScript"); script.setAttribute("type", "text/javascript"); document.documentElement.firstChild.appendChild(script) }; function moveMap(b) { google.maps.event.addDomListener(document.getElementById("photo"), "click", function() { var c = $(".mLink").text(); var e = document.getElementById("photo"); if (b) { if (c == "Hide Photos") { b.disable(); $(".mLink").text("Show Photos"); e.setAttribute("title", "Display or show photos on the map.") } else { b.enable(); $(".mLink").text("Hide Photos"); e.setAttribute("title", "Hide photos on the map.") } } else { b = new PanoramioLayer(map); if (c == "Hide Photos") { b.disable(); $(".mLink").text("Show Photos"); e.setAttribute("title", "Display or show photos on the map.") } else { b.enable(); $(".mLink").text("Hide Photos"); e.setAttribute("title", "Hide photos on the map.") } } return false }) } function InitializePano(b) { var c = this; c.panoLayer = new PanoramioLayer(b); moveMap(c.panoLayer) };
