$(function() {
	var galleries = $('.ad-gallery').adGallery();
	$('#switch-effect').change(
	  function() {
		galleries[0].settings.effect = $(this).val();
		return false;
	  }
	);
	$('#toggle-slideshow').click(
	  function() {
		galleries[0].slideshow.toggle();
		return false;
	  }
	);
	$('#toggle-description').click(
	  function() {
		if(!galleries[0].settings.description_wrapper) {
		  galleries[0].settings.description_wrapper = $('#descriptions');
		} else {
		  galleries[0].settings.description_wrapper = false;
		}
		return false;
	  }
	);
});

$(document).ready(function(){ 
						   
	$('.small_gallery a').click(function(){		
		href = $(this).attr("rel");
		$('a[rel='+href+']').colorbox();						   
	});

	var first = $("#buttons li:first a");
	first.addClass("selected");
	var href = first.attr("rel");
	$(href).fadeIn("slow");
	
	$('a.button').click(function(){
	  	$('div.def').hide();
		href = $(this).attr("rel");
		$('a.button').removeClass("selected")
		$(this).addClass("selected");
		$(href).fadeIn("slow");
		return false;
    });
	
});
