
function gallery(elem) {
	this.srcNodeRef = elem;
	this.imagelist = new Array();
	this.index = 0;
	this.startup = function() {
		var obj = this;
		$('> a.prev', obj.srcNodeRef).fadeOut('fast');
		$('ul', this.srcNodeRef).css('width', (402*$('ul li', this.srcNodeRef).length)+'px');
		/*$(this.srcNodeRef).mouseover(function(){
			if(obj.index != 0)
				$('> a.prev', this).fadeIn('fast');
			if(obj.index != $('ul li', obj.srcNodeRef).length-1)
				$('> a.next', this).fadeIn('fast');
		});*/
		/*$(this.srcNodeRef).mouseleave(function(){
			$('> a', this).fadeOut('fast');
		});*/
		$('a.prev', this.srcNodeRef).click(function() {
			$('ul', obj.srcNodeRef).animate({
				left: '+=402'
			}, 1000);
			obj.index--;
			if(obj.index == $('ul li', obj.srcNodeRef).length-1)
				$('> a.next', obj.srcNodeRef).fadeOut('fast');
			else
				$('> a.next', obj.srcNodeRef).fadeIn('fast');
			if(obj.index == 0)
				$('> a.prev', obj.srcNodeRef).fadeOut('fast');
			else
				$('> a.prev', obj.srcNodeRef).fadeIn('fast');
			//$('> a', obj.srcNodeRef).fadeOut('fast');
		});
		$('a.next', this.srcNodeRef).click(function() {
			$('ul', obj.srcNodeRef).animate({
				left: '-=402'
			}, 1000);
			obj.index++;
			if(obj.index == 0)
				$('> a.prev', obj.srcNodeRef).fadeOut('fast');
			else
				$('> a.prev', obj.srcNodeRef).fadeIn('fast');
			if(obj.index == $('ul li', obj.srcNodeRef).length-1)
				$('> a.next', obj.srcNodeRef).fadeOut('fast');
			else
				$('> a.next', obj.srcNodeRef).fadeIn('fast');
			//$('> a', obj.srcNodeRef).fadeOut('fast');
		});
	}
}
/*
$("div.gallery").each(function(index, elem){
	$(elem).mouseenter(function(){
		$('> a', this).fadeIn('fast');
	});
	$(elem).mouseleave(function(){
		$('> a', this).fadeOut('fast');
	});
});*/

