$(document).ready(function () {	
	$('#nav a').anchorScroll();
	
	$('#slideshow').slideshow({
      duration: 1600,
      delay: 5000,
      selector: '> img',
      transition: 'crossFade'
    });
        
    (function(){
        var locations = {
            provo : {
                location: new google.maps.LatLng(40.26355, -111.66843),
                title: "Provo Wingshak",
                content: new google.maps.InfoWindow({
                    content: '<h2>Provo Wingshak</h2><br><p><strong>Hours: </strong> 9AM-10PM<br><strong>Phone: </strong>(801) 377-4010</p>'
                })
            },
            af : {
                location: new google.maps.LatLng(40.37339, -111.78661),
                title: "American Fork Wingshak",
                content: new google.maps.InfoWindow({
                  content: '<h2>American Fork Wingshak</h2><br><p><strong>Hours: </strong> 9AM-10PM<br><strong>Phone: </strong>(801) 756-2667</p>'  
                })
            }
        }, place, marker, map;
        
        map = new google.maps.Map(document.getElementById("map"), {
            zoom: 11,
            center: new google.maps.LatLng(40.31847, -111.72752),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });
        
        for(place in locations){
            if(locations.hasOwnProperty(place)){
                locations[place]['marker'] = new google.maps.Marker({
                    map: map,
                    draggable: false,
                    animation: google.maps.Animation.DROP,
                    position: locations[place].location,
                    title: locations[place].title,
                    icon: '/assets/images/marker.png'
                });
                
						
                
                google.maps.event.addListener(locations[place]['marker'], 'click', (function(_place){
	                return function(){
										_place.content.open(map, _place.marker);
										map.panTo(_place.location)
	                }
                }(locations[place])));
        		}
        }
        
        
    }());
    
});
