function initialize() {
    var latlng = new google.maps.LatLng(38.907931, -77.042017);
    var myOptions = {
      zoom: 15,
      center: latlng,
	  mapTypeControl: false,
	  navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
	var marker = new google.maps.Marker({
	      position: latlng, 
	      map: map, 
	      title:"Yola",
		  clickable: true,
		  icon: 'images/marker.png',
		  shadow: 'images/marker_shadow.png',
	  });
	
  }

$(function () {
	var scroll_timer;
	var displayed = false;
	var $message = $('#to_top');
	var $window = $(window);
	var top = $(document.body).children(0).position().top;
	$window.scroll(function () {
		window.clearTimeout(scroll_timer);
		scroll_timer = window.setTimeout(function () {
			if($window.scrollTop() <= top)
			{
				displayed = false;
				$message.fadeOut(200);
			}
			else if(displayed == false)
			{
				displayed = true;
				$message.stop(true, true).fadeIn(200).click(function () { $message.fadeOut(200); });
			}
		}, 100);
	});
});

jQuery.preLoadImages("img");

$(document).ready(function() {
	Cufon.replace('#nav li, #aux_nav li p, #aux_nav li, #menu_board h2, #menu_board h3, #menu_board p, a.dairy, #press_board h2, #press_board a, #press_board em');
	
	$(window).scroll(function()
	{
		if ($(window).scrollTop() > 3900)
	    {
			$('#tab_home, #tab_about, #tab_menu, #tab_catering, #tab_press, #tab_locations').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_contact').stop(true).delay(1200).animate({left: "0px"}, 600);
	    }
		else if ($(window).scrollTop() > 3450)
	    {
			$('#tab_home, #tab_about, #tab_menu, #tab_catering, #tab_press, #tab_contact').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_locations').stop(true).delay(1200).animate({left: "0px"}, 600);
	    }
		else if ($(window).scrollTop() > 2800)
		  {
			$('#tab_home, #tab_about, #tab_menu, #tab_catering, #tab_press, #tab_locations, #tab_contact').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_press').stop(true).delay(1200).animate({left: "0px"}, 600);
		  }
		else if ($(window).scrollTop() > 2000)
	    {
			$('#tab_home, #tab_about, #tab_menu, #tab_press, #tab_locations, #tab_contact').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_catering').stop(true).delay(1200).animate({left: "0px"}, 600);
	    }
	    else if ($(window).scrollTop() > 1300)
	    {
			$('#tab_home, #tab_about, #tab_catering, #tab_press, #tab_locations, #tab_contact').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_menu').stop(true).delay(1200).animate({left: "0px"}, 600);
	    }
		else if ($(window).scrollTop() > 500)
	    {
			$('#tab_home, #tab_menu, #tab_catering, #tab_press, #tab_locations, #tab_contact').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_about').stop(true).delay(1200).animate({left: "0px"}, 600);
	    }
	    else
	    {
			$('.section_tab').stop(true).delay(800).animate({left: "-61px"}, 300);
			$('#tab_home').stop(true).delay(1200).animate({left: "0"}, 600);
	    }
	});
	
	$("#logo, #to_top, #logo_footer").click(
		function(){
			$('html, body').animate({scrollTop: $("body").offset().top }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_about, #cow, #farmer, #next_bird_about").click(
		function(){
			$('html, body').animate({scrollTop: $("#about").offset().top - 150 }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_menu, #berries, #coffee_cup, #next_bird_menu").click(
		function(){
			$('html, body').animate({scrollTop: $("#menu").offset().top - 200 }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_catering, #bag, #next_bird_catering").click(
		function(){
			$('html, body').animate({scrollTop: $("#catering").offset().top - 200 }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_press, #next_bird_press").click(
		function(){
			$('html, body').animate({scrollTop: $("#press").offset().top - 225 }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_locations, #hours_top, #next_bird_locations").click(
		function(){
			$('html, body').animate({scrollTop: $("#locations").offset().top - 150 }, {easing: "easeOutBack", duration: 800});
	});
	$(".nav_contact, #bird_home, #next_bird_contact").click(
		function(){
			$('html, body').animate({scrollTop: $("#contact").offset().top - 150 }, {easing: "easeOutBack", duration: 800});
	});
	
	$("#home img, #logo, #nav li, #aux_nav li, #decals img").hover(
		function(){
			$(this).stop(true, true).addClass("active")},
		function(){
			$(this).removeClass("active");
	});
	
	$("#nutrition_facts").hover(
		function(){
			$(this).stop(true, true).animate({left: "694px"}, 200)},
		function(){
			$(this).animate({left: "684px"}, 200);
	});
	
	$('#menu_slider')
		.cycle({
			fx:     'scrollHorz',
			timeout: 0,
			speed:   600,
			next:   '#menu_next', 
			prev:   '#menu_prev'
    });

	$('#glossary')
		.cycle({
			fx:     'scrollHorz',
			timeout: 0,
			speed:   800,
			next:   '#glossary_next', 
			prev:   '#glossary_prev',
			pagerAnchorBuilder: function(idx, slide) { 
				return '#glossary li:eq(' + idx + ')'; 
			}
			
    });

	$("#producer_links a").hover(
		function(){
			$(this).next().fadeIn(200)},
		function(){
			$(this).next().fadeOut(200);
	});
				
});
