$(document).ready(function() {
	
	
	$("#clickforvideo img").css({cursor:"pointer"});
	$("#clickforvideo img").click(function() {
	$("#clickforvideo").html('<iframe width="466" height="290" src="http://www.youtube.com/embed/ipAKfqi6o1E?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>');
	});

	$("#clickforsmallvideo img").css({cursor:"pointer"});
	$("#clickforsmallvideo img").click(function() {
	$("#clickforsmallvideo").html('<iframe width="306" height="200" src="http://www.youtube.com/embed/ipAKfqi6o1E?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>');
	});

	
	//hiding and showing .hidden
	
	$('.hidden').hide();
	$("#subscribe").css({cursor: "pointer"}).toggle(function(){
			$('.hidden').show();
		},function(){
			$('.hidden').hide();
	});		
	
/*	$("$('.hidden').h3.reveal").css({cursor: "pointer"});
	$("h3.reveal").hover(
		function () {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
		}
	);
	$("h3.reveal").toggle(function(){
			$(this).addClass("open");
			$(this).next($('.hidden')).slideDown("normal");
		},function(){
			$(this).removeClass("open");
			$(this).next($('.hidden')).slideUp("fast");
	});	
*/
/*	$("a.eventbrite").click(function(){
			$(this).hide("slow");
			var addr = $(this).attr("href");
			//window.location = addr;
			$(this).parent().next('div').load("http://google.com/");
			return false;
	});	*/


// For browsers that don't understand :first-child in native CSS
$('div.gallery dl.gallery-item:first-child').siblings().hide();
//$('div.gallery br').hide();



if ($("#slides").length > 0){
		$(function(){
			// Set starting slide to 1
			var startSlide = 1;
			// Get slide number if it exists
			//if (window.location.hash) {
				//startSlide = window.location.hash.replace('#','');
			//}
			// Initialize Slides
			$('#slides').slides({
				preload: true,
				preloadImage: 'img/loading.gif',
				generatePagination: true,
				play: 5000,
				pause: 5000,
				hoverPause: true,
				// Get the starting slide
				start: startSlide
				//,
				//animationComplete: function(current){
					// Set the slide number as a hash
					//window.location.hash = '#' + current;
				//}
			});
		});

$('#slides .slide img').css("cursor","pointer").click(function () {
		var addr = $(this).parents('.slide').children('.slideinfo').children('h2').children('a').attr("href");
		window.location = addr;
      });


};



if ($("#welcome").length > 0){
		$(function(){
			// Set starting slide to 1
			var startWelcome = 1;
			// Get slide number if it exists
			//if (window.location.hash) {
				//startSlide = window.location.hash.replace('#','');
			//}
			// Initialize Slides
			$('#welcome').slides({
				preload: true,
				//preloadImage: 'img/loading.gif',
				generatePagination: false,
				play: 8000,
				pause: 8000,
				hoverPause: true,
				// Get the starting slide
				start: startWelcome
				//,
				//animationComplete: function(current){
					// Set the slide number as a hash
					//window.location.hash = '#' + current;
				//}
			});
		});
};




if ($("section#sub ul.accordion").length > 0){
	$("section#sub ul.accordion li ul").hide();
	$("section#sub ul.accordion li span.month").css({display: 'block', cursor: 'pointer'});
	$("section#sub ul.accordion li span.month").click(function(){
			if ($(this).hasClass ("open")) {
				$(this).parent().parent().children().children('ul').slideUp("fast");
				$('.open').removeClass("open");
			} else {
				$(this).parent().parent().children().children('ul').slideUp("fast");
				$(this).parent().children('ul').slideDown("fast");
				$('.open').removeClass("open");
				$(this).addClass("open");	
			}
	});
}

	
	
	$("#slideshow ul li a").mouseover(function(){ 
			$('.active').addClass("last-active").removeClass("active");
			$('.open').animate( {width:"190px"}, 200).removeClass("open");
			//$(this).parent('li').animate( {width:"212px"}, 200, function(){$(this).addClass("open");});
			$(this).parent('li').addClass("open");
			var newname = $(this).parent('li').attr("id");
			$('#img-' + newname).addClass("active");
			$('.last-active').removeClass();
	});	
	

	
});

	
	

