function toggle(id) { var thisElement=document.getElementById(id); if(thisElement.style.display=='block') thisElement.style.display='none'; else thisElement.style.display='block'; return null; } function element(id) { return document.getElementById(id); } function changecss(theClass,element,value) { var cssRules; if (document.all) { cssRules='rules'; } else if (document.getElementById) { cssRules='cssRules'; } for (var S=0; S < document.styleSheets.length; S++){ for (var R=0; R < document.styleSheets[S][cssRules].length; R++) { if (document.styleSheets[S][cssRules][R].selectorText==theClass) { document.styleSheets[S][cssRules][R].style[element]=value; } } } } function createMarker(lng,lat,title,html) { var point=new GPoint(lng,lat); var marker=new GMarker(point); return marker; } /* AJAXY GOODNESS */ var req; var XMLResultElementId=''; var XMLEditBoxId =''; var redirectLocation =''; try { req=new XMLHttpRequest(); } catch (trymicrosoft) { try { req=new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { req=new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { req=false; } } } function quicklink_toggle(tag,toggle) { loadXMLDoc('/tag/link/' + tag + '/' + toggle,'','quicklink'); setTimeout("loadXMLDoc('/tag/echo_links','','quicktags_list');",1000); if (element('quicktags_list').style.display='none') { element('quicktags_list').style.display='block'; } return null; } function loadPreview(id) { loadXMLDoc('http://filmnorthflorida.com/photos/infowindow/' + id + '/include_title','','previewBox'); element('previewBox').style.display='block'; } function processReqChangeGET() { if (req.readyState==4) { if (req.status) { if (req.status==200) { var result_element=document.getElementById(XMLResultElementId); result_element.innerHTML=req.responseText; } else { alert("There was a problem retrieving the XML data:\n" + req.statusText); } } } return null; } function loadXMLDoc(url,postData,resultElementId,processingEngine) { if (!processingEngine) processingEngine='processReqChangeGET'; XMLResultElementId=resultElementId; if (postData) { var method ='POST'; var contentType='application/x-www-form-urlencoded'; } else { var method ='GET'; var contentType='text/html'; } if (req) { eval("req.onreadystatechange=" + processingEngine + ";"); req.open(method,url,true); req.setRequestHeader('Content-Type',contentType); req.send(postData); } } /* STREET VIEW */ var map; var myPano; var panoClient; var fovMarker; var fovIcon; var iconSize=70; var marker; var overlayInstance=null; var map; var client; var lastMarkerLocation; var mapT; var smallZoomControl; var smallMapControl; function initialize(chosen) { panoClient=new GStreetviewClient(); smallZoomControl =new GSmallZoomControl(); smallMapControl =new GSmallMapControl(); map.addControl(smallZoomControl); map.setCenter(currentLatLng,15); myPano.setLocationAndPOV(currentLatLng,{yaw:currentYaw,pitch:currentPitch}); var guyIcon=new GIcon(G_DEFAULT_ICON); guyIcon.image="http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-0.png"; guyIcon.transparent="http://maps.google.com/intl/en_us/mapfiles/cb/man-pick.png"; guyIcon.imageMap=[ 26,13,30,14,32,28,27,28,28,36,18,35,18,27,16,26, 16,20,16,14,19,13,22,8 ]; guyIcon.iconSize=new GSize(49,52); guyIcon.iconAnchor=new GPoint(25,35); guyIcon.infoWindowAnchor=new GPoint(25,5); marker=new GMarker(currentLatLng,{icon: guyIcon,draggable: true}); map.addOverlay(marker); lastMarkerLocation=currentLatLng; GEvent.addListener(marker,"dragend",onDragEnd); toggleOverlay(); GEvent.addListener(myPano,"yawchanged",handleYawChange); GEvent.addListener(myPano,"pitchchanged",handlePitchChange); GEvent.addListener(myPano,"initialized",handleInitialized); return null; } function _sv_callback(data) { if(data!=null) { myPano.setLocationAndPOV(data,{yaw:currentYaw,pitch:currentPitch}); map.checkResize(); map.setCenter(data,14); } else { map.addControl(mapTypeControl); map.removeControl(smallZoomControl); map.addControl(smallMapControl); element('expandMapLink').style.display='none'; element('map_canvas').style.width='740px'; element('pano').style.display='none'; element('holding_div').style.display='block'; map.checkResize(); map.setCenter(currentLatLng,13); GEvent.addListener(marker,"click",openPanoramaBubble); } } function handleInitialized(location) { currentLatLng=location.latlng; marker.setLatLng(currentLatLng); updateInspector(); return null; } function postPOV(postId,dataId){ loadXMLDoc('/locations/postPOV/' + postId + '/' + element(dataId).innerHTML,'',dataId); } function handleYawChange(yaw){ currentYaw=Math.round(yaw); onYawChange(yaw); updateInspector(); return null; } function updateInspector() { var inspector=element('inspector_data'); inspector.innerHTML=currentLatLng.toUrlValue() + "," + currentYaw + "," + currentPitch; return null; } function handlePitchChange(pitch){ currentPitch=Math.round(pitch); updateInspector(); return null; } function placeFovMarker(){ map.removeOverlay(fovMarker); /* The following line really only needs to be in handleYawChange(),but doing so creates a flicker of the marker * when using Firefox. It may have something to do with the lag between when the initialized event is triggered * and when the Street View image is actually finished loading. Although less than optimal,I've found that * reloading the image for each placement avoids the problem. */ fovIcon.image="http://filmnorthflorida.com/gravity/scripts/arc.php?color=green&yaw="+currentYaw; fovMarker=new GMarker(currentLatLng,{icon: fovIcon,clickable: false}); map.addOverlay(fovMarker); return null; } function openPanoramaBubble() { var contentNode=document.createElement('div'); contentNode.style.textAlign='center'; contentNode.style.width='97%'; contentNode.style.height='350px'; contentNode.innerHTML='Loading myPano'; var smallNode=document.createElement('div'); smallNode.style.width='300px'; smallNode.style.height='200px'; smallNode.id='pano'; marker.openInfoWindow(smallNode,{maxContent: contentNode,maxTitle: "Expanded View"}); myPano=new GStreetviewPanorama(smallNode); myPano.setLocationAndPOV(marker.getLatLng(),{ yaw:150 }); GEvent.addListener(myPano,"newpano",onNewLocation); GEvent.addListener(myPano,"yawchanged",onYawChange); var iw=map.getInfoWindow(); GEvent.addListener(iw,"maximizeend",function() { myPano.setContainer(contentNode); window.setTimeout("myPano.checkResize()",5); }); GEvent.addListener(iw,"closeclick",function() { myPano.remove(); }); } function toggleOverlay() { if (!overlayInstance) { overlayInstance=new GStreetviewOverlay(); map.addOverlay(overlayInstance); } else { map.removeOverlay(overlayInstance); overlayInstance=null; } } function onYawChange(newYaw) { var GUY_NUM_ICONS=16; var GUY_ANGULAR_RES=360/GUY_NUM_ICONS; if (newYaw < 0) { newYaw +=360; } guyImageNum=Math.round(newYaw/GUY_ANGULAR_RES) % GUY_NUM_ICONS; guyImageUrl="http://maps.google.com/intl/en_us/mapfiles/cb/man_arrow-" + guyImageNum + ".png"; marker.setImage(guyImageUrl); } function onNewLocation(lat,lng) { var latlng=new GLatLng(lat,lng); marker.setLatLng(latlng); } function onDragEnd() { var latlng=marker.getLatLng(); updateInspector(); if (myPano) { panoClient.getNearestPanorama(latlng,onResponse); } } function onResponse(response) { if (response.code !=200) { marker.setLatLng(lastMarkerLocation); } else { var latlng=new GLatLng(response.Location.lat,response.Location.lng); marker.setLatLng(latlng); lastMarkerLocation=latlng; myPano.setLocationAndPOV(latlng,null); } } function expandMap() { map.addControl(mapTypeControl); map.addControl(smallMapControl); map.removeControl(smallZoomControl); element('map_canvas').style.height='500px'; element('holding_div').style.height='500px'; element('pano').style.height='500px'; element('map_canvas').style.width='600px'; element('pano').style.marginLeft='610px'; element('pano').style.width='140px'; window.setTimeout("map.checkResize();",5); window.setTimeout("myPano.checkResize();",5); element("expandMapLink").style.display='none'; if(element('pano').offsetWidth > 0) element("contractMapLink").style.display='block'; } function contractMap() { map.removeControl(mapTypeControl); map.removeControl(smallMapControl); map.addControl(smallZoomControl); element('map_canvas').style.height='300px'; element('holding_div').style.height='300px'; element('pano').style.height='300px'; element('map_canvas').style.width='145px'; element('pano').style.marginLeft='150px'; element('pano').style.width='600px'; window.setTimeout("map.checkResize();",5); window.setTimeout("myPano.checkResize();",5); toggle("expandMapLink"); toggle("contractMapLink"); } 