$(function(){
   	$("ul#gallery").hide();
   	$("div#portfolio").prepend('<img src="/images/portfolio/loading.gif" class="loading" alt="loading..." / >');
});
jQuery.fn.portfolio = function() {
	var polaroid = $(this);
	polaroid.parent().find("img.loading").remove();
	polaroid.show();
	var pictWidth = 580;
	var pictEls = polaroid.find("li").size();
	var galleryWidth = pictWidth*pictEls;
	polaroid.css("width" , galleryWidth);
	polaroid.find('li').css("width" , pictWidth);
	// activate navigation and assign "current" states 	
	$("ul#sequence a").each(function(z) {
		$(this).click(function() {return false});
		$(this).bind("mouseover", function(){
			$(this).addClass("current").parent().parent().find("a").not($(this)).removeClass("current");
			var cnt = - (pictWidth*z);
			$(this).parent().parent().prev().animate({left: cnt}, 500, "easeInOutExpo");
		});
	});
};	
