$(document).ready(function() {
$('#volunteer').bind('click', function() {
    $('#mailing').removeClass('selected');
	    $('#dvd').removeClass('selected');
 $('#youTube').removeClass('selected');
    $(this).addClass('selected');
  });
$('#dvd').bind('click', function() {
    $('#mailing').removeClass('selected');
	    $('#volunteer').removeClass('selected');
		$('#youTube').removeClass('selected');
    $(this).addClass('selected');
  });
$('#mailing').bind('click', function() {
    $('#volunteer').removeClass('selected');
		    $('#dvd').removeClass('selected');
$('#youTube').removeClass('selected');
    $(this).addClass('selected');
  });
$('#youTube').bind('click', function() {
    $('#volunteer').removeClass('selected');
		    $('#dvd').removeClass('selected');
$('#mailing').removeClass('selected');
    $(this).addClass('selected');
  });
$('.showAndHide').bind('click',function(){
	$('#detail').toggleClass('hidden');});
jQuery('ul.oneAccordion').flexAccordion({
		speed: 'fast',	// see jQuery slideDown function for available options
		activeitem: '3', 	// 'none' to close all sliders or specify the index of the slider you want to open (0,1,2...)
		showheaders: true, 	// Specify if you want to show a slide header (span)
		headerEl: 'a', 	// Specify the element to be the header of each slide
		contentEl: 'div',		// Specify the element to be the container of each slide
		targetdelimiter: ' '	// Specify the digit to separate the target slide index in custom buttons
	});
generateSprites(".nav", "current-", true, 300, "slide");

 // Notice the use of the each method to gain access to each element individually
   $('#links a').each(function()
   {
      // Create image content using websnapr thumbnail service
      var content = '<img src="http://images.websnapr.com/?url=';
      content += $(this).attr('href');
      content += '" alt="Loading thumbnail..." height="152" width="202" />';
      
      // Setup the tooltip with the content
      $(this).qtip(
      {
         content: content,
         position: {
            corner: {
               tooltip: 'rightTop',
               target: 'leftBottom'
            }
         },
         style: {
            tip: true, // Give it a speech bubble tip with automatic corner detection
            name: 'dark'
         }
      });
   });
});
$(document).ready(function()

{
   // Use each method to gain access to all youtube links
   $('a[href*="youtube."]').each(function()
   {
      // Grab video ID from the url
      var videoID = $(this).attr('href').match(/watch\?v=(.+)+/);
      videoID = videoID[1];

      // Create content using url as base
      $(this).qtip(
      {
         // Create content DIV with unique ID for swfObject replacement
         content: '<div id="youtube-embed-'+videoID+'">You need Flash player 8+ to view this video.</div>',
         position: {
            corner: {
               tooltip: 'topRight', // ...and position it center of the screen
               target: 'middleLeft' // ...and position it center of the screen
            }
         },
         show: {
            when: 'click', // Show it on click...
            solo: true // ...and hide all others when its shown
         },
         hide: 'unfocus', // Hide it when inactive...
         style: {
            width: 445,
            height: 364,
            padding: 0,
            tip: false,
            name: 'dark'
         },
         api: {
            onRender: function()
            {
               // Setup video paramters
               var params = { allowScriptAccess: 'always', allowfullScreen: 'false' };
               var attrs = { id: 'youtube-video-'+videoID };

               // Embed the youtube video using SWFObject script
               swfobject.embedSWF('http://www.youtube.com/v/'+videoID+'&enablejsapi=1&playerapiid=youtube-api-'+videoID,
                                 'youtube-embed-'+videoID, '445', '364', '8', null, null, params, attrs);
            },

            onHide: function(){
               // Pause the vide when hidden
               var playerAPI = this.elements.content.find('#youtube-video-'+videoID).get(0);
               if(playerAPI && playerAPI.pauseVideo) playerAPI.pauseVideo();
            }
         }
      }
      ).attr('href', '#');
   });
});
