function PhotoGallery ( target, width, height, photos ) {
	var num = photos.length;
	target.html("<div class='photo_holder' style='width: " +width+ "px; height: "+height+"px'></div><div class='photo_nav'></div>");
	
	var photoArray = photos;
	var galleryName = target.attr('id');
	
	var currentPhoto;
	
	var nav = target.children(".photo_nav");
	var photoTarget = target.children(".photo_holder");
	
	for(var i = 0, l = num; i < l; i++) {
		var buttonID = i;
		nav.append("<a class='num_photo' id='"+buttonID+"'>"+(i+1)+"</a>");
		var button = nav.children("#" + buttonID);
		button.addClass('num_photo_down');
		button.addClass('num_photo_up');
		button.hover(onButtonRollOver,onButtonRollOut);
		button.click(onButtonClick);
		lowlight(button);
	}
	
	function onButtonRollOver ( ) {
		highlight($(this));
	}
	
	function onButtonRollOut ( ) {
		lowlight($(this));
	}
	
	function onButtonClick ( ) {
		load($(this).attr('id'));
	}
	
	function highlight ( button ) {
		button.toggleClass('num_photo_up', true);
		button.toggleClass('num_photo_down', false);
	}
	
	function lowlight ( button ) {
		if(button.attr('id') != currentPhoto) {
			button.toggleClass('num_photo_up', false);
			button.toggleClass('num_photo_down', true);
		}
	}
	
	function load ( id ) {
		var button = nav.children("#" + currentPhoto);
		currentPhoto = id;
		if(button) {
			lowlight(button);
		}
		button = nav.children("#" + currentPhoto).first();
		highlight(button);
		photoTarget.html("<img src='"+photoArray[id]+"'/>");
		
	}
	
	load(0);
	
}


