(function(A){A.vail_photopager={NEXT:"next",PREVIOUS:"previous",FIRST:"first",_init:function(){A(".photoPager").each(function(){var B=A(this);
B.curIndex=0;
B.images=[];
B.prevElem=A('<div class="prev"></div>');
B.nextElem=A('<div class="next"></div>');
B.prepend(B.prevElem).append(B.nextElem);
B.find("li").each(function(C,D){B.images[C]=A(D).find("img").get(0)
});
B.nextElem.bind("mousedown",function(){A.vail_photopager.diaplayPhoto(B,A.vail_photopager.NEXT)
});
B.prevElem.bind("mousedown",function(){A.vail_photopager.diaplayPhoto(B,A.vail_photopager.PREVIOUS)
});
A.vail_photopager.diaplayPhoto(B,A.vail_photopager.FIRST);
A("div.vailTabs").bind("vail:tabs:activated",function(){A.vail_photopager.alignButtons(B)
})
})
},diaplayPhoto:function(B,C){var D=A.vail_photopager.setCurrentImage(B,C);
B.find("ul").empty().append(D).wrapInner("<li></li>");
A.vail_photopager.alignButtons(B);
B.find("ul").css("display","block")
},alignButtons:function(B){var C=B.images[B.curIndex];
B.prevElem.css("height",C.height+"px");
B.nextElem.css({height:C.height+"px",left:C.width-30+"px"})
},setCurrentImage:function(B,C){if(C==A.vail_photopager.FIRST){B.curIndex=0
}else{if(C==A.vail_photopager.NEXT){B.curIndex=((B.curIndex+1)>(B.images.length-1))?0:++B.curIndex
}else{if(C==A.vail_photopager.PREVIOUS){B.curIndex=((B.curIndex-1)<0)?B.images.length-1:--B.curIndex
}}}return B.images[B.curIndex]
}}
})(jQuery);
jQuery(jQuery.vail_photopager._init);