$(document).ready(function(){slideShow(4500);});function slideShow(speed){$('ul.slideshow').append('<li id="slideshow-caption" class="caption"><div class="slideshow-caption-container"><h3></h3><p></p></div></li>');$('ul.slideshow li').css({opacity:0.0});$('ul.slideshow li:first').css({opacity:1.0});$('#slideshow-caption h3').html($('ul.slideshow a:first').find('img').attr('title'));$('#slideshow-caption p').html($('ul.slideshow a:first').find('img').attr('alt'));$('#slideshow-caption').css({opacity:0.7,bottom:0});var timer=setInterval('gallery()',speed);$('ul.slideshow').hover(function(){clearInterval(timer);},function(){timer=setInterval('gallery()',speed);});}
function gallery(){var current=($('ul.slideshow li.show')?$('ul.slideshow li.show'):$('#ul.slideshow li:first'));var next=((current.next().length)?((current.next().attr('id')=='slideshow-caption')?$('ul.slideshow li:first'):current.next()):$('ul.slideshow li:first'));var title=next.find('img').attr('title');var desc=next.find('img').attr('alt');next.css({opacity:0.0}).addClass('show').animate({opacity:1.0},1000);$('#slideshow-caption').animate({bottom:-70},300,function(){$('#slideshow-caption h3').html(title);$('#slideshow-caption p').html(desc);$('#slideshow-caption').animate({bottom:0},500);});current.animate({opacity:0.0},1000).removeClass('show');}
$(document).ready(function(){var speed=5000;$('#mask-gallery, #gallery li').width($('#slider').width());$('#gallery').width($('#slider').width()*$('#gallery li').length);$('#mask-gallery, #gallery li, #mask-excerpt').height($('#slider').height());var run=setInterval('newsscoller(0)',speed);$('#gallery li:first, #excerpt li:first').addClass('selected');$('#mask-excerpt').css('marginTop',$('#gallery li').height()-$('#excerpt li:first').height());$('#btn-pause').click(function(){clearInterval(run);return false;});$('#btn-play').click(function(){run=setInterval('newsscoller(0)',speed);return false;});$('#btn-next').click(function(){newsscoller(0);return false;});$('#btn-prev').click(function(){newsscoller(1);return false;});$('#slider, #sliderbuttons').hover(function(){clearInterval(run);},function(){run=setInterval('newsscoller(0)',speed);});});function newsscoller(prev){var current_image=$('#gallery li.selected').length?$('#gallery li.selected'):$('#gallery li:first');var current_excerpt=$('#excerpt li.selected').length?$('#excerpt li.selected'):$('#excerpt li:first');if(prev){var next_image=(current_image.prev().length)?current_image.prev():$('#gallery li:last');var next_excerpt=(current_excerpt.prev().length)?current_excerpt.prev():$('#excerpt li:last');}else{var next_image=(current_image.next().length)?current_image.next():$('#gallery li:first');var next_excerpt=(current_excerpt.next().length)?current_excerpt.next():$('#excerpt li:first');}
$('#mask-excerpt').animate({marginTop:$('#gallery li').height()-next_excerpt.height()},100,0,function(){$('#excerpt li, #gallery li').removeClass('selected');next_image.addClass('selected');next_excerpt.addClass('selected');$('#mask-excerpt').scrollTo(next_excerpt,800);$('#mask-gallery').scrollTo(next_image,800);});}
