$(function()
{var anim_duration=APP.anim_duration;var showcase_images=$('.image','#showcase');var showcase_overlay=$('.overlay','#showcase');var showcase_current=0;var showcase_max=showcase_images.length;var showcase_interval_id,showcase_next;$('.image:gt(0)','#showcase').hide();showcaseStep=function(step)
{step=step||1;showcaseResetInterval();if(step>0)
showcase_next=(showcase_current+step)%showcase_max;else
showcase_next=((showcase_current+step)+showcase_max)%showcase_max;$(showcase_images[showcase_next]).fadeIn(anim_duration+200);$(showcase_images[showcase_current]).fadeOut(anim_duration+200);showcase_current=showcase_next;showcaseUpdateLink();}
showcaseUpdateLink=function()
{var caption=$('img:first',showcase_images[showcase_current]).attr('alt');var caption_split=caption.split('-');if(caption_split.length==2)
{caption='<h2>'+caption_split[0]+'</h2><h3> - '+caption_split[1]+'</h3>';}else{caption='<h2>'+caption+'</h2>';}
$('.overlay_text','#showcase').html(caption);Cufon.refresh('#showcase h2');Cufon.refresh('#showcase h3');$('a:first','#showcase .overlay').attr('href',$('a:first',showcase_images[showcase_current]).attr('href'));$('a:first','#showcase .overlay').html($('img',showcase_images[showcase_current]).attr('alt'));}
showcaseResetInterval=function()
{clearInterval(showcase_interval_id);showcase_interval_id=setInterval('showcaseStep()',5000);}
$('.controller','#showcase').mouseenter(function(event)
{showcase_overlay.trigger('mouseenter');});showcase_overlay.hover(function()
{var controller=$('.controller','#showcase');showcaseResetInterval();$('.overlay_text','#showcase').animate({top:'0'},{queue:false,duration:anim_duration,easing:'easeOutCubic'});controller.is(':animated')&&controller.stop(true,false);controller.fadeTo(APP.anim_duration,1);},function()
{$('.overlay_text','#showcase').animate({top:-$('.overlay_text','#showcase').height()},{queue:false,duration:anim_duration,easing:'easeOutCubic'});$('.controller','#showcase').fadeTo(APP.anim_duration,0);});$('#showcase').delegate('.controller_prev','click',function()
{showcaseStep(-1);return false;});$('#showcase').delegate('.controller_next','click',function()
{showcaseStep();return false;});showcaseResetInterval();showcaseUpdateLink();});
