$(function(){
  $('#header_visitors_guide').wiggler();
  $('#footer_media li').wiggler();
  
  $('.gallery .thumb a, .collection .thumb a')
    .each(function(){
      $(this).find('img')
				.css({ opacity: 0.75 })
				.mouseenter(function(){
		      $(this).animate({ opacity: 1 }, { duration: 250, queue: false })
		    })
		    .mouseleave(function(){
		      $(this).animate({ opacity: 0.75 }, { duration: 250, queue: false })
		    })
    });
    
  $('.feature .image')
    .twister({
      scale: 1.1
    });

	$('.twister .thumb, .twister .smallThumb')
    .twister({ 
			degrees: 360, 
			overflown: true,
			scale: 1.1
		});
});

function initializeGoogleMap(canvas_id, name, address){
	var geocoder = new google.maps.Geocoder();
	
	geocoder.geocode({ 'address': address }, function(results, status){
		if(status == google.maps.GeocoderStatus.OK){
			$('#map_and_driving_directions').fadeIn();
			var map = new google.maps.Map(document.getElementById(canvas_id), {
				zoom: 10,
				center: results[0].geometry.location,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				mapTypeControl: false
			});
			var infowindow = new google.maps.InfoWindow({
					content: '<h4>' + name + '</h4>' + 
					         '<p>' + address + '</p>' +
									 '<p><a href="http://maps.google.com/maps?saddr=' + escape(address) + '" target="_blank">Get Driving Directions</a></p>'
			});
			var marker = new google.maps.Marker({
				title: name,
				map: map,
				position: results[0].geometry.location
			});
			infowindow.open(map,marker);
		}
	});
}