var map = null; var geocoder = null; function addAddressToMap(response) { if (!response || response.Status.code != 200) { } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(place.address + '
' + 'Country code: ' + place.AddressDetails.Country.CountryNameCode); } } function showLocation(address) { geocoder.getLocations(address, addAddressToMap); } function showAddress(lat, lng, message,theIcon){ var latnew = plotCoordinates[0][0] / 10000; var lngnew = plotCoordinates[0][1] / 10000; map.setCenter(new GLatLng(latnew, lngnew), 10); latnew = lat / 10000; lngnew = lng / 10000; markerOptions = { icon:theIcon }; var marker = new GMarker(new GLatLng(latnew, lngnew), markerOptions); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(message); }); map.addOverlay(marker); } var plotCoordinates = []; function loadab() { if (GBrowserIsCompatible()){ map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); geocoder = new GClientGeocoder(); var icon = new GIcon(); icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; icon.iconSize = new GSize(12, 20); icon.shadowSize = new GSize(22, 20); icon.iconAnchor = new GPoint(6, 20); icon.infoWindowAnchor = new GPoint(5, 1); for(var i = 0; i < plotCoordinates.length; i++){ var theicon = new GIcon(); if(plotCoordinates[i][3] == "Restaurants"){ theicon.shadow = "/Media/MediaManager/OhioMagRedesign/dining2s.png"; theicon.image = "/Media/MediaManager/OhioMagRedesign/dining2.png"; theicon.iconSize = new GSize(30, 30); theicon.shadowSize = new GSize(30, 30); theicon.iconAnchor = new GPoint(12, 27); theicon.infoWindowAnchor = new GPoint(9, 2); theicon.infoShadowAnchor = new GPoint(18, 25); }else if(plotCoordinates[i][3] == "Lodging"){ theicon.shadow = "/Media/MediaManager/OhioMagRedesign/hotel2s.png"; theicon.image = "/Media/MediaManager/OhioMagRedesign/hotel2.png"; theicon.iconSize = new GSize(30, 30); theicon.shadowSize = new GSize(30, 30); theicon.iconAnchor = new GPoint(12, 27); theicon.infoWindowAnchor = new GPoint(9, 2); theicon.infoShadowAnchor = new GPoint(18, 25); }else if(plotCoordinates[i][3] == "Events"){ theicon.shadow = "/Media/MediaManager/OhioMagRedesign/event2s.png"; theicon.image = "/Media/MediaManager/OhioMagRedesign/event2.png"; theicon.iconSize = new GSize(30, 30); theicon.shadowSize = new GSize(30, 30); theicon.iconAnchor = new GPoint(12, 27); theicon.infoWindowAnchor = new GPoint(9, 2); theicon.infoShadowAnchor = new GPoint(18, 25); }else{ theicon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png"; theicon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png"; theicon.iconSize = new GSize(12, 20); theicon.shadowSize = new GSize(22, 20); theicon.iconAnchor = new GPoint(6, 20); theicon.infoWindowAnchor = new GPoint(5, 1); } showAddress(plotCoordinates[i][0],plotCoordinates[i][1],plotCoordinates[i][2],theicon); } } } function addAddressToMap(response) { if (!response || response.Status.code != 200) { } else { place = response.Placemark[0]; point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); marker = new GMarker(point); map.addOverlay(marker); marker.openInfoWindowHtml(place.address + '
' + 'Country code: ' + place.AddressDetails.Country.CountryNameCode); } } function showLocation(address) { geocoder.getLocations(address, addAddressToMap); } var counter = 0; function runOnLoad(f){ if(runOnLoad.loaded) f(); else runOnLoad.funcs.push(f); } runOnLoad.funcs = []; runOnLoad.loaded = false; runOnLoad.run = function(){ if(runOnLoad.loaded) return; for(var i = 0; i < runOnLoad.funcs.length; i++){ try { runOnLoad.funcs[i](); } catch (e) { /* Don't stop onload if a function fails */ } } }; if(window.addEventListener) window.addEventListener("load", runOnLoad.run, false); else if(window.attachEvent) window.attachEvent("onload", runOnLoad.run); else window.onload = runOnLoad.run; function unique(theArr) { var temp = []; var tempb; for(i=0;i < theArr.length ;i++){ tempb = theArr[i][1]; if(!contains(tempb, temp)){ temp.push(theArr[i]); } } return temp; } function contains(tempb, temp) { for(j=0;j < temp.length;j++)if(temp[j][1]==tempb)return true; return false; } function showNearBy(transport,type,tempLat,tempLng){ if(transport.responseText.length != 0){ var ajaxResponse = []; var response = ""; var eventsArray = []; var toShowArray = []; if (type=="Story"){var descriptionArray = [];} if (type=="Story"){var issueArray = [];} var top = 0; var strResponseText = transport.responseText.substring(0,(transport.responseText.length - 2)); var expandBeyond20 if (type=="Story"){ expandBeyond20 = strResponseText.split("||||")[1]; ajaxResponse = strResponseText.split("||||")[0].split("||"); }else{ ajaxResponse = strResponseText.split("||"); } for(var i=0; i< ajaxResponse.length; i++){ eventsArray.push(ajaxResponse[i].split("|")); } //Do this for each event we get... for(var i=0; i < eventsArray.length; i++){ //Determine all events within a 20 mile radius of the event from the 40x40 mile square. var lat1=tempLat/10000,lon1=tempLng/10000,lat2=eventsArray[i][3]/10000;lon2=eventsArray[i][2]/10000; //Convert Latitude to decimal format from integer format //alert("Latitude1" + i + "- " + lat1 + " ///Longitude1" + i + "- " + lon1 + "\nLatitude2" + i + "- " + lat2 + " ///Longitude2" + i + "- " + lon2); var R = 6371; // circumference of the world in km //Start distance formula var dLat = (lat2-lat1) * Math.PI/214; var dLon = (lon2-lon1) * Math.PI/214; var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1 * Math.PI/214) * Math.cos((lat2 * Math.PI/214)) * Math.sin(dLon/2) * Math.sin(dLon/2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); var d = R * c; //Convert distance from km to miles d = d * 0.621369949495; //Add event to toShowArray if the distance between it and event is less than 20 miles. if(type=="Story" && expandBeyond20 == "Y" || d < 20){ toShowArray[top] = new Array(); toShowArray[top][0] = d; toShowArray[top][1] = eventsArray[i][1]; toShowArray[top][2] = eventsArray[i][0]; if(typeof(eventsArray[i][4]) == "string") toShowArray[top][3] = eventsArray[i][4]; else toShowArray[top][3] = '' if (type=="Story"){toShowArray[top][3] = eventsArray[i][4];toShowArray[top][4] = eventsArray[i][5];} //description / issue toShowArray[top][5] = eventsArray[i][3]; //lng toShowArray[top][6] = eventsArray[i][2]; //lat if(type != "Story" && eventsArray[i][5]){toShowArray[top][7] = eventsArray[i][5];} else{toShowArray[top][7] = "NOIMAGE";} top++; } } toShowArray.sort(function(a,b){if(a[7] != "NOIMAGE" && b[7] != "NOIMAGE"){ return a[0] - b[0];}else if(a[7] != "NOIMAGE" && b[7] == "NOIMAGE"){ return -1;}else if(a[7] == "NOIMAGE" && b[7] != "NOIMAGE"){ return 1;} else return a[0]-b[0];}); var uniqueToShowArray; if(type == "Story"){ uniqueToShowArray = unique(toShowArray); toShowArray = []; for(i=0; i < uniqueToShowArray.length; i++){ toShowArray.push(uniqueToShowArray[i]); } top = toShowArray.length; } if(top > 5 ){ top = 5; } if(top == 0 && type == "Events") response = '
 No Events within 20 miles...
'; if(top == 0 && type == "Restaurants") response = '
 No restaurants within 20 miles...
'; if(top == 0 && type == "Lodging") response = '
 No Lodging within 20 miles...
'; if(top == 0 && type == "Story") response = '
 No Stories within 20 miles...
'; for(var i=0; i < top; i++){ if(type != "Story" && toShowArray[i][7] != "NOIMAGE"){ if(type == "Events") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(type == "Restaurants") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(type == "Lodging") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(whenyougoLog(toShowArray[i][2])); }else{ if(type == "Events") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(type == "Restaurants") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(type == "Lodging") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + (parseInt(toShowArray[i][0])+1) + ' mi. from event

'; if(type == "Story") response = response + '
' + (i + 1) + '. ' + toShowArray[i][1] + '
 ' + toShowArray[i][3] + '
 ' + toShowArray[i][4] + "

"; } if(type == "Restaurants" || type == "Lodging") plotCoordinates.push(new Array(toShowArray[i][5],toShowArray[i][6],toShowArray[i][1],type) ); } } else { if(type == "Events") response = '
 No Events within 20 miles...
'; if(type == "Restaurants") response = '
 No Restaurants within 20 miles...
'; if(type == "Lodging") response = '
 No Lodging within 20 miles...
'; if(type == "Story") response = '
 No Stories within 20 miles...
'; } if(type == "Events") response = response + '
 
Find More>>
'; if(type == "Restaurants") response = response + '
 
Find More>>
'; if(type == "Lodging") response = response + '
 
Find More>>
'; if(type == "Story") response = response + '
 
Find More>>
'; return response; } function changeBackgroundShades(){ $('tdNE').style.background = "url('/Media/MediaManager/OhioMagRedesign/tdBlueBack.gif')"; $('tdNW').style.background = "url('/Media/MediaManager/OhioMagRedesign/tdBlueBack.gif')"; $('tdCE').style.background = "url('/Media/MediaManager/OhioMagRedesign/tdBlueBack.gif')"; $('tdSW').style.background = "url('/Media/MediaManager/OhioMagRedesign/tdBlueBack.gif')"; $('tdSE').style.background = "url('/Media/MediaManager/OhioMagRedesign/tdBlueBack.gif')"; } function generateEditorsPicks(Region){ $('lodgingContainer').style.display = 'none'; $('restaurantsContainer').style.display = 'none'; $('eventsContainer').style.display = 'none'; $('storyContainer').style.display = 'none'; var enhancedNE = false, enhancedNW = false, enhancedCE = false, enhancedSW = false, enhancedSE = false; if(Region == "NE" ) var strResponseText = 'British Invasion|The British invade the Rock and Roll Hall of Fame and Museum in Cleveland during the photography exhibit “Mike McCartney’s Liverpool Life,” chronicling the unforgettable music of the 1960s, through Sept. 21. |Cleveland|415072|-816932|A345968F0FC3477A9EB10118A85408C3|/Media/DirectoriesFeaturedEvents/liverpool-life.jpg|July 15 - July 22: Ohiomag.com Northeast Featured Event - Liverpool Life|Rock and Roll Hall of Fame and Museum|1100 Rock and Roll Blvd.|Cleveland, OH 44114'; if(Region == "NW" ) var strResponseText = 'Green Christmas|Santa comes to town a little bit early — by riverboat rather than by sleigh — during Vermilion’s Christmas in July, which features holiday movies, shopping and light displays throughout the town, July 24–27. |Vermilion|414092|-822389|94C21C27DCFC404184A2F7C941F80A8E|/Media/DirectoriesFeaturedEvents/christmas-in-july.jpg|July 15 - July 22: Ohiomag.com Northwest Featured Event - Christmas in July|Downtown||Vermilion, OH 44001'; if(Region == "CE" ) var strResponseText = 'Autumnal Tribute|A massive mound of handmade leaves inscribed with the names of fallen American soldiers in Iraq are displayed in “Jane Hammond: Fallen,” at the Wexner Center for the Arts in Columbus, through Aug. 3. |Columbus|400008|-830101|A65905B19D26416CACB489734AEF7147|/Media/DirectoriesFeaturedEvents/jane-hammond-fallen.jpg|July 15 - July 22: Ohiomag.com Central Featured Event - Jane Hammond: Fallen|Wexner Center for the Arts, The Ohio State University|Bldg. 386, 1850 College Rd.|Columbus, OH 43210'; if(Region == "SW" ) var strResponseText = 'Reel Photography|Art meets the movies in Gregory Crewdson: Beneath the Roses, a series of photographs inspired by Hollywood thrillers and shot on an actual sound stage, at the Cincinnati Art Museum, through Oct. 5. |Cincinnati|391144|-844968|C6FBB32D6D8F4A2E987130B4EE9E2283|/Media/DirectoriesFeaturedEvents/beneath-the-roses.jpg| July 15 - July 22: Ohiomag.com Southwest Featured Event - Gregory Crewdson: Beneath the Roses|Cincinnati Art Museum|953 Eden Park Dr.|Cincinnati, OH 45202'; if(Region == "SE" ) var strResponseText = 'Back in Time|Listen to live music, see quilting demonstrations and browse the quaint shops in historic Harmar Village in Marietta during the 25th Annual Harmar Days festival on Maple Street, July 26–27. |Marietta|394113|-814591|A17B176304DE43A09E7B74A2B8749D6A|/Media/DirectoriesFeaturedEvents/harmar-days.jpg|July 15 - July 22: Ohiomag.com Southeast Featured Event - Harmar Days|Harmar Village|Maple St.|Marietta, OH 45750'; var eventArray = strResponseText.split("|"); $('EventTitle').innerHTML = eventArray[0]; $('EventDescription').innerHTML = eventArray[1]; $('City').innerHTML = ' ' + eventArray[2] + ' '; $('City543').innerHTML = ' ' + eventArray[2] + ' '; $('City432').innerHTML = ' ' + eventArray[2] + ' '; $('EventLink').href = "/events/dirmod.asp?sid=30BF81B411F74328A39BF1BA0337CD19&nm=Ohio+Events&type=MyModule&mod=Directories%3A%3AEventsCalendar&mid=972281777D9545958362A298D6D74713&tier=3&ModuleSID="+eventArray[5]; $('imageLink').href = "/events/dirmod.asp?sid=30BF81B411F74328A39BF1BA0337CD19&nm=Ohio+Events&type=MyModule&mod=Directories%3A%3AEventsCalendar&mid=972281777D9545958362A298D6D74713&tier=3&ModuleSID="+eventArray[5]; $('EventImage').src = eventArray[6]; $('EventImage').alt = eventArray[7]; if(Region == "NE") $('changingRegion').innerHTML = "Northeast"; else if(Region == "NW") $('changingRegion').innerHTML = "Northwest"; else if(Region == "CE") $('changingRegion').innerHTML = "Central"; else if(Region == "SW") $('changingRegion').innerHTML = "Southwest"; else if(Region == "SE") $('changingRegion').innerHTML = "Southeast"; plotCoordinates.push(new Array(eventArray[3],eventArray[4],eventArray[0],"Events")); var strLocation = ""; if(eventArray.length > 7){ for(var i = 8; i < eventArray.length; i++){ strLocation = strLocation + eventArray[i] + "
"; } } else { strLocation = "No Location Found"; } $('EventLocation').innerHTML = strLocation; getLodging(eventArray[3],eventArray[4]); getRestaurants(eventArray[3],eventArray[4]); getStories(eventArray[3],eventArray[4]); Effect.Parallel([Effect.Appear('eventsContainer', {duration:3.0}, {fps:50}), Effect.Appear('lodgingContainer', {duration:3.0}, {fps:50}), Effect.Appear('restaurantsContainer', {duration:3.0}, {fps:50}), Effect.Appear('storyContainer', {duration:3.0}, {fps:50})]); } function getNE(){ changeBackgroundShades(); changeThisToRed($('tdNE')); $('menu_block1').style.display = 'none'; $('openMap').style.display = 'block'; plotCoordinates = []; $('mapImage').src = "/Media/MediaManager/OhioMagRedesign/RegionMapNE.gif"; generateEditorsPicks("NE"); } function getNW(){ changeBackgroundShades(); changeThisToRed($('tdNW')); $('menu_block1').style.display = 'none'; $('openMap').style.display = 'block'; plotCoordinates = []; $('mapImage').src = "/Media/MediaManager/OhioMagRedesign/RegionMapNW.gif"; generateEditorsPicks("NW"); } function getCE(){ changeBackgroundShades(); changeThisToRed($('tdCE')); $('menu_block1').style.display = 'none'; $('openMap').style.display = 'block'; plotCoordinates = []; $('mapImage').src = "/Media/MediaManager/OhioMagRedesign/RegionMapCE.gif"; generateEditorsPicks("CE"); } function getSW(){ changeBackgroundShades(); changeThisToRed($('tdSW')); $('menu_block1').style.display = 'none'; $('openMap').style.display = 'block'; plotCoordinates = []; $('mapImage').src = "/Media/MediaManager/OhioMagRedesign/RegionMapSW.gif"; generateEditorsPicks("SW"); } function getSE(){ changeBackgroundShades(); changeThisToRed($('tdSE')); $('menu_block1').style.display = 'none'; $('openMap').style.display = 'block'; plotCoordinates = []; $('mapImage').src = "/Media/MediaManager/OhioMagRedesign/RegionMapSE.gif"; generateEditorsPicks("SE"); } function getRestaurants(lat,lng){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/whenyougoDining.asp?Lat="+lat+"&Long="+lng+"&time="+timestamp, { method: 'get', onSuccess: function(transport) { var response = showNearBy(transport,"Restaurants",lat,lng); $("Restaurants").innerHTML = response; }, onFailure: function(transport) { $("Restaurants").innerHTML = '
 No Restaurants within 20 miles...
 
Find More>>
' }}); } function getEventCount(){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/eventsCount.asp", { method: 'get', onSuccess: function(transport) { $("EventCount").innerHTML = "1 of " + transport.responseText + " events "; }, onFailure: function(transport) { $("Restaurants").innerHTML = '
 No Restaurants within 20 miles...
 
Find More>>
' }}); } function featuredLog(id){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/featuredLog.asp?id=" + id + "&time=" + timestamp, { method: 'get', onSuccess: function(transport) { }}); return true; } function whenyougoLog(id){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/whenyougoLog.asp?id=" + id + "&time=" + timestamp, { method: 'get', onSuccess: function(transport) { }}); return true; } function getLodging(lat,lng){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/whenyougoLodging.asp?Lat="+lat+"&Long="+lng+"&time="+timestamp, { method: 'get', onSuccess: function(transport) { var response = showNearBy(transport,"Lodging",lat,lng); $("Lodging").innerHTML = response; }, onFailure: function(transport) { $("Lodging").innerHTML = '
 No Lodging within 20 miles...
 
Find More>>
' }}); } function getStories(lat,lng){ var date = new Date(); var timestamp = date.getTime(); new Ajax.Request("/WhenYouGoScripts/whenyougoStoryServerScript2.asp?Lat="+lat+"&Long="+lng+"&time="+timestamp, { method: 'get', onSuccess: function(transport) { var response = showNearBy(transport,"Story",lat,lng); $("Story").innerHTML = response; }, onFailure: function(transport) { $("Story").innerHTML = '
 No Stories within 20 miles...
 
Find More>>
' }}); } getEventCount(); function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function chooseRegion(){ var theRandFeature = Math.floor(Math.random()*5); var startFeature = readCookie('OME_Feature') if (startFeature == null){ switch(theRandFeature){ case 0: getNE();break; case 1: getNW();break; case 2: getCE();break; case 3: getSW();break; case 4: getSE();break; default : getNE(); } } else { //otherwise, select starting feature based on cookie switch(startFeature){ case 'NE': getNE();break; case 'NW': getNW();break; case 'CE': getCE();break; case 'SW': getSW();break; case 'SE': getSE();break; default : getNE(); } } } function changeThisToRed(node){ node.style.background = 'url(/Media/MediaManager/OhioMagRedesign/tdRedBack.gif)'; } function openTheMap(){ $('menu_block1').style.display= 'block'; loadab(); $('openMap').style.display= 'none'; } function closeTheMap(){ $('menu_block_container1').style.display= 'block'; new Effect.SlideUp('menu_block1'); $('openMap').style.display = 'block'; } setDateBeforeAndAfter('theweekend'); preLoadFeatureImages();