// JavaScript Document
$(document).ready(function() {
	// Add First Letter and First Sentence classes
	$("#content .item").find("p:first").addClass("intro");	
	$("#content").each(function () {
		$(this).find(".item").each(function () {
			$(this).find("p").eq(0).addClass("intro");
		});
	});
	// Add Heading 2 Formatting
	$("h2").each(function () {
		var bt = $(this);
      bt.html( bt.text().replace(/(^\w+)/,'<span>$1</span>') );
	});
	// Add Mailing List drop-down section
	$('#contact-button').click(function() {
		$('#contact-area').slideToggle();
	});
	// CMailing List Drop Down effect
	$("#contact-button").hover(
      function () {
        $(this).addClass("hover");
      }, 
      function () {
        $(this).removeClass("hover");
      }
    );
	// Coming Events scroller
	$('#widget').newsScroll({
		speed: 2000,
		delay: 5000
	});
	// Item Hovering effect
	$(".item").hover(
      function () {
        $(this).addClass("hover");
      }, 
      function () {
        $(this).removeClass("hover");
      }
    );
	// Highlist Announcement
	$('#announcement').seekAttention({
	    paddingTop: 0,
   	 paddingBottom: 0,
	    paddingLeft: 0,
   	 paddingRight: 0
	});
	// Activate pretty photo effects
	$("a[rel^='prettyPhoto']").prettyPhoto();
	// Image Links
	$('a img').each(function() {
		$(this).hover(function() {
			$(this).stop().animate({ opacity: 1.0 }, 500);
		},
		function() {
			$(this).stop().animate({ opacity: 0.5 }, 500);
		});
	});
	//Hide (Collapse) the toggle containers on load
	$("#open_toggle").click(function() {
		if ($("#open_toggle").html()== 'Hide all answers') {
			$("#open_toggle").html('Reveal all answers');
			$(".toggle_container").slideUp("slow");
		} else {
			$("#open_toggle").html('Hide all answers');
			$(".toggle_container").slideDown("slow");
		}
	});
	$(".toggle_container").hide(); 
	$('.trigger').each(function() {
		$(this).hover(function() {
			$(this).stop().animate({ opacity: 1.0 }, 0);
		},
		function() {
			$(this).stop().animate({ opacity: 0.6 }, 0);
		});
	});
	//Slide up and down on click
	$(".trigger").click(function(){
		$(this).next(".toggle_container").slideToggle("slow");
	});

});