Cufon.set('fontFamily', 'Gotham Medium').replace('#slides h2')('#content-main h2');
Cufon.set('fontFamily', 'Gotham Bold').replace('#sermon-bar h3')('#events h3')('.col-two h4');
Cufon.set('fontFamily', 'Clarendon Light').replace('#content-sidebar h3#section-title');

$(document).ready(function(){
  
  $("#map-container").jmap('init', {'mapType':G_NORMAL_MAP,'mapZoom':15,'mapCenter':[35.212973, -80.843883]});
  
  // Contact Info & Times/Directions slider animation
  $("#utility-contact").click(function(){
    if ($("#slider-times").is(':visible')) {
      $("#slider-times").hide(); 
      $("#slider-contact").show();
      $("#utility-times").toggleClass("active");
    } else {
      $("#slider-contact").slideToggle("slow");
    } 
    $(this).toggleClass("active");
    return false;
  });
  
  $("#utility-times").click(function(){
    if ($("#slider-contact").is(':visible')) {
      $("#slider-contact").hide(); 
      $("#slider-times").show();
      $("#map-container").jmap('CheckResize');
      $("#map-container").jmap('AddMarker', {'pointLatLng': [35.212973, -80.843883],'centerMap': true});
      $("#utility-contact").toggleClass("active");
    } else {
      $("#slider-times").slideToggle("slow");
      $("#map-container").jmap('CheckResize');
      $("#map-container").jmap('AddMarker', {'pointLatLng': [35.212973, -80.843883],'centerMap': true});
    }
    $(this).toggleClass("active");
    return false;
  });  
  
  // Welcome tabs
  $('#welcome .tabs a').click(function(){
 		var selected_div = $(this).attr('href');
 		$('#welcome .tabs li').removeClass('selected');
 		$(this).parent().addClass('selected');

 		$('.tab-info').removeClass('selected');
 		$(selected_div).addClass('selected');
 		return false;
 	});
  
  // Home page slide animation, have to place afer Fancybox call because of JS error
  $('#slides').cycle({ 
    fx:     'fade',
    timeout:  7000 
  });
  
  // jQuery Tools - Tooltips for Actions
  $("a[rel=#tooltip-nav]").tooltip({ tipClass: "tooltip-action", delay: 100, opacity: 1, relative: true, offset: [-5, 0], position: "bottom center", events: { def: "click mouseover,click mouseout" }});
  
  // Flowplayer
  flowplayer("flowplayer", "/js/flowplayer-3.1.5.swf",  {
  	clip: {
  		// these two configuration variables does the trick
  		autoBuffering: true // <- do not place a comma here  
  	}
  });
  
});
