var InputPlaceholder=new Class({initialize:function(a,b,c){this.element=null;if(a.getProperty('type')!="text"){return}this.element=a;this.text=b;this.color_off=c;this.color_on=a.style.color;if(this.element.value==''||this.element.value==this.text){this.element.setStyle('color',this.color_off);this.element.value=this.text}a.addEvent('focus',this.onFocus.bind(this));a.addEvent('blur',this.onBlur.bind(this))},updateText:function(a){if(!this.element){return}if(this.element.value==this.text){this.element.value=a}this.text=a},onBlur:function(){if(!this.element){return}if(this.element.value==''){this.element.setStyle('color',this.color_off);this.element.value=this.text}},onFocus:function(){if(!this.element){return}if(this.element.value==this.text){this.element.value='';this.element.setStyle('color',this.color_on)}}});var gmaps_debugging=false;var map;var manager;var directions;var currentLatLng='';var currentAddress='397 Squire Pope Road, Hilton Head Island, SC 29926';var locations=null;var locations_loaded=false;var mapGetDirections=({init:function(b,c){this.element=b;this.working=false;this.element.setStyle('display','block');this.pos_closed=b.getStyle('bottom').toInt();this.pos_open=this.pos_closed-b.getSize().size.y;this.is_open=false;this.fx=new Fx.Style(b.getProperty('id'),'bottom',{duration:500,wait:false});if(c){c.each(function(a){a.addEvent('click',function(e){e=new Event(e).stop();this.toggle()}.bind(this))}.bind(this))}},toggle:function(a){if(this.working){return}this.working=true;if(this.is_open){this.hide(a)}else{this.show(a)}},show:function(a){this.working=true;if(this.is_open){return}this.is_open=true;this.fx.stop().start(this.pos_open).chain(function(){this.working=false;if(a){a()}}.bind(this))},hide:function(a){this.working=true;if(!this.is_open){return}this.is_open=false;this.fx.stop().start(this.pos_closed).chain(function(){this.working=false;if(a){a()}}.bind(this))}});var mapSidebar=({init:function(a,b,c){this.element=a;this.parent_element=c;this.pos_open=a.getStyle('right').toInt();this.pos_closed=0-(this.pos_open+a.getSize().size.x);this.fx=new Fx.Style(a.getProperty('id'),'right',{duration:500,wait:true});this.is_open=true;this.was_directions_open=false;this.restore_element=b;this.restore_pos_open=b.getStyle('right').toInt();this.restore_pos_closed=0-(this.restore_pos_open+b.getSize().size.x);this.restore_fx=new Fx.Style(b.getProperty('id'),'right',{duration:350,wait:false});b.setStyles({'display':'none','right':this.restore_pos_closed+'px'});this.on_show=null;this.on_hide=null},toggle:function(a){if(this.is_open){this.hide(a)}else{this.show(a)}},show:function(a){if(this.is_open){return}this.is_open=true;if(this.on_show){this.on_show(false)}this.restore_fx.start(this.restore_pos_closed).chain(function(){this.restore_element.setStyle('display','none');this.element.setStyle('display','block');this.fx.start(this.pos_open).chain(function(){if(this.on_show){this.on_show(true)}this.parent_element.setStyle('overflow','visible');mapGetDirections.element.setStyle('display','block');if(this.was_directions_open){mapGetDirections.show();this.was_directions_open=false}}.bind(this))}.bind(this))},hide:function(a){if(!this.is_open){return}if(mapGetDirections.is_open){this.was_directions_open=true;mapGetDirections.hide(this.hide.bind(this));return}mapGetDirections.element.setStyle('display','none');if(this.on_hide){this.on_hide(false)}this.parent_element.setStyle('overflow','hidden');this.is_open=false;this.fx.start(this.pos_closed).chain(function(){if(this.on_hide){this.on_hide(true)}this.element.setStyle('display','none');this.restore_element.setStyle('display','block');this.restore_fx.start(this.restore_pos_open)}.bind(this))}});window.addEvent('unload',function(){GUnload()});window.addEvent('domready',gmaps_domready);GDownloadUrl("gmaps/locations.xml",function(a,b){var c=GXml.parse(a);var d=c.documentElement.getElementsByTagName("location");locations=[];for(var i=0;i<d.length;i++){var e=d[i].getElementsByTagName("published")[0].firstChild.nodeValue;if(e.toInt()!=1){continue}var f=d[i].getElementsByTagName("name")[0].firstChild.nodeValue;var g=d[i].getElementsByTagName("address")[0].firstChild.nodeValue;var h=d[i].getElementsByTagName("city")[0].firstChild.nodeValue;var j=d[i].getElementsByTagName("state")[0].firstChild.nodeValue;var k=d[i].getElementsByTagName("zip")[0].firstChild.nodeValue;var l=d[i].getElementsByTagName("phone")[0].firstChild.nodeValue;var m=d[i].getElementsByTagName("image")[0].firstChild.nodeValue;var n=d[i].getElementsByTagName("site")[0].firstChild.nodeValue;var o=d[i].getElementsByTagName("lat")[0].firstChild.nodeValue;var p=d[i].getElementsByTagName("lng")[0].firstChild.nodeValue;locations.push([f,[g,h,j,k,l],o,p,m,n])}locations_loaded=true});function gmaps_domready(){$$('.tattered').each(function(a){a.setStyle('display','block')});if(GBrowserIsCompatible()){if(!locations_loaded){(gmaps_domready).delay(500);return}setupMap();setupMarkers();var c=$('map').getSize();var d=$('map').getPosition();if($('map_sidebar')){if($('directionsI')){var t=new InputPlaceholder($('directionsI'),'Enter Address','#bbbbbb')}if(window.ie6){$$('.get_directions_here').each(function(a){a.removeClass('toggle_directions')})}$('map_sidebar_close').setStyle('display','block');$('close_directions').setStyle('display','block');mapSidebar.init($('map_sidebar'),$('map_sidebar_restore'),$('map_container'));mapGetDirections.init($('map_get_directions'),$$('.toggle_directions'));$('map_sidebar_close').addEvent('click',function(){mapSidebar.toggle()});$('map_sidebar_restore').addEvent('click',function(){mapSidebar.toggle()});updateCurrentMarker(0);$$('div#headbar img').each(function(b){locations.each(function(a,i){if(b.getProperty('alt')&&a[0]==b.getProperty('alt')){b.setStyle('cursor','pointer').addEvent('click',function(){updateCurrentMarker(i)})}})});if(window.ie6){var e=[];$$('#current_marker a, div#map_sidebar_close').each(function(a){var b=a.clone().cloneEvents(a).setText('').setProperty('target',a.getProperty('target')).setStyles({'display':'block','width':a.getSize().size.x,'height':'10px','position':'absolute','left':a.getPosition().x,'top':a.getPosition().y,'cursor':'pointer'}).addEvent('mouseover',function(){a.setStyle('text-decoration','underline')}).addEvent('mouseout',function(){a.setStyle('text-decoration','none')}).injectInside(document.body);e.push([a,b])});function fixIeLinks(b){e.each(function(a){a[1].setStyles({'width':a[0].getSize().size.x,'left':a[0].getPosition().x,'top':a[0].getPosition().y})})}function updateLinks(b){e.each(function(a){a[1].setStyle('display',(b?'block':'none'))})}mapSidebar.on_show=function(a){if(a){updateLinks(true)}};mapSidebar.on_hide=function(a){if(!a){updateLinks(false)}};window.addEvent('resize',fixIeLinks)}}}}function setupMap(){map=new GMap2($('map'));directions=new GDirections(map,$('directions'));GEvent.addListener(directions,"error",handleErrors);GEvent.addListener(directions,"load",function(){(function(){Window.scrollTo(0,$('map_container').getPosition().y)-15}).delay(500)});map.setCenter(new GLatLng(32.19072217578917,-80.68016052246094),11,G_HYBRID_MAP);map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl())}function setupMarkers(){manager=new GMarkerManager(map);var f=[];var g=new GIcon();g.shadow="http://www.google.com/mapfiles/shadow50.png";g.iconSize=new GSize(37,44);g.shadowSize=new GSize(37,34);g.iconAnchor=new GPoint(18,43);g.infoWindowAnchor=new GPoint(31,2);g.infoShadowAnchor=new GPoint(18,25);locations.each(function(a,i){var b=new GIcon(g);if(a[4]=='old_fort.png'){b.iconSize=new GSize(40,44);b.iconAnchor=new GPoint(2,42)}else if(a[4]=='boathouse.png'){b.iconSize=new GSize(40,44);b.iconAnchor=new GPoint(38,42)}b.image='gmaps/icons/'+a[4];var c=new GMarker(new GLatLng(a[2],a[3]),b);c.id=i;var d=false;GEvent.addListener(c,"infowindowopen",function(){d=true});GEvent.addListener(c,"infowindowclose",function(){d=false});var e=10;GEvent.addListener(c,"click",function(){updateCurrentMarker(c.id)});f.push(c)});manager.addMarkers(f,1);manager.refresh()}function updateCurrentMarker(b){$('current_marker_title').setText(locations[b][0]);$('current_marker_address').setText(locations[b][1][0]);$('current_marker_csz').setText(locations[b][1][1]+', '+locations[b][1][2]+' '+locations[b][1][3]);$('current_marker_phone').setText(locations[b][1][4]);$('current_marker_link').setProperty('href','http://'+locations[b][5]);$('current_marker_link').setText(locations[b][5]);$('current_marker_logo').setProperty('alt',locations[b][0]);if(!window.ie6){$('current_marker_logo').setProperty('src','gmaps/logos/'+locations[b][4])}else{$('current_marker_logo').setProperty('src','gmaps/spacer.gif');$('current_marker_logo').setStyle('filter','progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src=\'gmaps/logos/'+locations[b][4]+'\', sizingMethod=\'crop\')')}currentAddress=locations[b][1][0]+', '+locations[b][1][1]+', '+locations[b][1][2]+' '+locations[b][1][3];currentLatLng=locations[b][2]+', '+locations[b][3];mapSidebar.show();if(window.ie6){$$('.get_directions_here').each(function(a){a.setProperty('target','_blank').setProperties({'href':'http://maps.google.com/maps?f=d&hl=en&geocode=&saddr=&daddr='+escape(currentAddress)+'&ie=UTF8&z=17&om=1','target':'_blank'})})}}function setDirections(a){directions.load("from: "+a+" to: "+currentAddress+" @"+currentLatLng,{"locale":"en_US"});mapSidebar.hide()}function handleErrors(){if(directions.getStatus().code==G_GEO_UNKNOWN_ADDRESS){alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: "+directions.getStatus().code)}else if(directions.getStatus().code==G_GEO_SERVER_ERROR){alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+directions.getStatus().code)}else if(directions.getStatus().code==G_GEO_MISSING_QUERY){alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+directions.getStatus().code)}else if(directions.getStatus().code==G_GEO_BAD_KEY){alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: "+directions.getStatus().code)}else if(directions.getStatus().code==G_GEO_BAD_REQUEST){alert("A directions request could not be successfully parsed.\n Error code: "+directions.getStatus().code)}else{alert("An unknown error occurred.")}}