
$(function() {
	
	jQuery(function() {Shadowbox.init();})

	
	if($('#homeheader').length > 0){
		$('#homeheader').cycle({ 
			fx:     'fade', 
			speed:  1000, 
			timeout: 7000, 
			pause: 1 // killed b/c of conflict with play/pause button

		});
	}   
	
	
	if($('#rotatingimgholder').length > 0){
		$('#rotatingimgholder').cycle({ 
			fx:     'fade', 
			speed:  1000, 
			timeout: 7000, 
			pause: 1 // killed b/c of conflict with play/pause button

		});
	}   
	
	
	if($('#titleRotate').length > 0){
		$('#titleRotate').cycle({ 
			fx:     'fade', 
			speed:  1000, 
			timeout: 7000, 
			pause: 1 // killed b/c of conflict with play/pause button

		});
	}   
	
	if($('#map_canvas').length > 0){
		var geocoder;
		var map;
		var name = 'Myrtle Beach';
		var address = 'Myrtle Beach, SC';
		initializeMap();
	}
	
	$('.locationLink').live('click', function(){
		name = $(this).text();
		address = $(this).attr('href');
		initializeMap();
		return false;
	})
	
	function initializeMap()
	{
		directionsDisplay = new google.maps.DirectionsRenderer();
		geocoder = new google.maps.Geocoder();
		geocoder.geocode( { 'address': address}, function(results, status)
		{
			if (status == google.maps.GeocoderStatus.OK)
			{
				var latlng = results[0].geometry.location;
				var myOptions =
				{
				  zoom: 9,
				  center: latlng,
				  mapTypeId: google.maps.MapTypeId.ROADMAP
				}
				
				map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
				
				//marker
				var marker = new google.maps.Marker
				({
					  map: map, 
					  position: results[0].geometry.location,
					  title: name
				});
				
				
		
			} else {
			  alert("Geocode was not successful for the following reason: " + status);
			}
		});
	}
	
	
	
})

