$(document).ready(function() {
	$("a.fancybox").attr('rel', 'gallery').fancybox();
	  if ($('#sponsorscroller').length>0) {

    
	$('#sponsorscroller').jcarousel({ scroll: 1,auto:2,wrap:"circular"});
	
	
  }

	if ($('#countdown').length>0) {
	    //var newYear = new Date();
	    //newYear = new Date(newYear.getFullYear() + 1, 1 - 1, 1);
	    //$('#countdown').countdown({until: newYear,compact: true});
	    //$('#countdown').countdown({until: new Date(2012, 6 - 1, 1, 0, 0, 0),compact: true});
	    //$('#countdown').countdown({until: new Date("June 1, 2012 08:00:00"),compact: true});
	    $('#countdown').countdown({until: new Date("June 1, 2012 08:00:00"),compact: true, alwaysExpire:true, onExpiry: GreenLight});
	    
	/* This is basic fancybox- uses default settings */

	$("a#single_image").fancybox();

	/* Using custom settings */

	$("a#inline").fancybox({
		'hideOnContentClick': true
	});

	/* Apply fancybox to multiple items */

	$("a.group").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600,
		'speedOut'		:	200,
		'overlayShow'	:	false
	});


}




  if ($('#schedule').length>0) {

    $('#schedule-list li').children('ul').slideUp('fast');
	$('#schedule-list li.list1').children('ul').slideDown('fast');
	$('#schedule-list li.list1 a.item').addClass('active');
  }



$('#schedule-list a.item').click(function () {
if(!$(this).hasClass('active') ){
			elem = $('this');
			if (elem.hasClass ("active")) {
			   // whatever
			   Alert(" @ ");
			}

			$('#schedule-list li').children('ul').slideUp('fast');

			$('#schedule-list a.item').each(function () {
			$(this).removeClass('active');
			});

			$(this).addClass('active');
			$(this).siblings('ul').slideDown('fast');
}

	return false;
  });


  if ($('ul#news-tabs').length>0) {

   // Loop Through each tab and activate slideshow
   $('ul#news-tabs li a').each(function(index) {
           var link = $(this).attr('href');
            $(function(){
			$(link).slides({
				play: 3000,
				pause: 500,
				generateNextPrev: false,
				hoverPause: false
			});
          });
   });


 }


 if ($('#logos').length>0) {
   $(function(){
			$('#logos').slides({
				play: 5000,
				pause: 2500,
				generateNextPrev: false,
				pagination: false,
				hoverPause: true
			});
          });

  }

 if ($('#twitter').length>0) {

 $("#twitter").tweet({
          avatar_size: 54,
          count: 3,
          username: ["detroitgp","detroitgp"],
          loading_text: "searching twitter...",
          refresh_interval: 10
        });
 }

  if ($('#featured-videos').length>0) {

   $("#featured-videos ul.playlist").ytplaylist({addThumbs:true, autoPlay: false, holderId: 'video',playerHeight:285,playerWidth:473});


 }


  // lightbox for photos in gallery
   $(".featured-photos li a,ul.ep-list li a").fancybox();


  // lightbox for photos in gallery
  $("a.play-video").click(function() {
	$.fancybox({
			'padding'		: 10,
			'autoScale'		: true,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'		   : 600,
			'height'		: 450,
			'href'			: this.href.replace(new RegExp("watch\\?v=", "i"), 'v/'),
			'type'			: 'swf',
			'swf'			: {
			   	 'wmode'		: 'transparent',
				'allowfullscreen'	: 'true'
			}
		});

	return false;
   });

});

function GreenLight() {
		    //alert(' must have forgotten to eat his “Cheerios” before the start!');
		    $('#countdown').slideUp('slow', function() { });
	    }

function mycarousel_initCallback(carousel)
{
        carousel.clip.hover(function() {
                carousel.stopAuto();
        }, function() {
                carousel.startAuto();
        }
		);
};
