var photonum;
function initGallery(){
		photonum = $("div.teamgallery > div.slider").find("div.imgbox").length;
		$(window).bind('resize load',function(){
			if($("body").find("div.content.current div.teamgallery").length>0){
			//$("div.teamgallery").width($("div.content > div.container").width()-500);
			var gallerypos = $("div.teamgallery").offset();
			//alert(gallerypos);
			$("div.teamgallery").width($(window).width()-gallerypos.left-25);
			$("div.teamgallery > div.slider").width(photonum*485);
			}
		});	
		//$("div.teamgallery").width($("div.content > div.container").width()-500);
			//$("div.teamgallery > div.slider").width(photonum*475);
		var gallerypos = $("div.teamgallery").offset();
		$("div.teamgallery").width($(window).width()-gallerypos.left-25);
		$("div.teamgallery > div.slider").width(photonum*485);
		$("a.next").click(function(){
			$("div.teamgallery > div.slider").animate({left: "-"+((parseInt($(this).attr("relimagenum"))+1)*485)+"px"});
			return false;
		});
		$("a.previous").click(function(){
			$("div.teamgallery > div.slider").animate({left : "-"+((parseInt($(this).attr("relimagenum"))-1)*485)+"px"});
			return false;
		});
		
		$("a.close").click(function(){
			$(this).parents("div.boxinfo").hide();
			return false;
		});
		
		$("div.imgbox").click(function(){
			$(this).find("div.boxinfo").show();
		});
		
		$("div.teamgallery > div.slider > div.imgbox").mouseover(function(){
			$(this).find("a.previous[relimagenum!=0]").show();
			$(this).find("a.next[relimagenum!="+(photonum-1)+"]").show();
		});
		$("div.teamgallery > div.slider > div.imgbox").mouseout(function(){
			$(this).find("a.previous, a.next").hide();
		});
}
