$(document).ready(function () {
	
	//gallery(".gallery");
	
});
	
	
function gallery(element){
	
	var element = $(element);
	var slide = element.find(".galSlide");
	
	//hides all slides except one with class selected
	slide.hide("").end("").find(".galSlide:first").show("");
	
	//gives all items with class slide an id
	slide.attr("id", function (number) {
          return "slide" + number;
    });
	
	//gives all items with class selector an id
	$(".selector").attr("id", function (number) {
		return "selector" + number;		  
	});
		
	//on click of selector hides all slides then shows one with same id
	$(".selector").click(function(event){
									
		var id = this.id.replace("selector" , 'slide');
		slide.fadeOut("slow");
		$("#" + id).fadeIn("slow");
		$(this).addClass("active");
		
		//alert(this.id);
			
	});	
			
}





	
