﻿jQuery(document).ready(function($){$('#wrapper').addClass("je");$('#play-slideshow').text("Loading...");pagination();Gallery();FirstImage();NextImage();PrevImage();SlideShow()});function SlideShow(play){var Slideshow=function(){if($('.selected').parent('li').hasClass('last')){$('img#current-slideshow-image').fadeOut();$('#current-image-caption').html("Your At The End!");SlideShow(false)}else{if($('.selected').parent('li').hasClass('middle')){var nxt=$('li.other-first').find('a.thumb');$('.selected').removeClass('selected');$('.page-2').trigger('click');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();Sliding(imgSrc,imgCap)}else{var nxt=$('.selected').parent('li').next('li').find('a.thumb');$('.selected').removeClass('selected');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();var imgHolder=$('img#current-slideshow-image');var capHolder=$('#current-image-caption');capHolder.html("Loading..");imgHolder.attr('src',imgSrc);imgHolder.load(function(){capHolder.html(imgCap);imgHolder.attr('alt',imgCap)});imgHolder.fadeIn('slow');imgHolder.error(function(){capHolder.html("error finding image, please try another.")})}}return false;};var StartSlideShow=function(){if($('#play-slideshow').text()=="Loading...")$('#play-slideshow').text("Please Wait...");else{$('#next-image').trigger('click.next');IntervalKey=setInterval(Slideshow,3000);$("#play-slideshow").text("Pause Slideshow");$("#play-slideshow").unbind("click");$("#play-slideshow").bind("click",StopSlideShow)}return false;};var StopSlideShow=function(){clearInterval(IntervalKey);$("#play-slideshow").text("Play Slideshow");$("#play-slideshow").unbind("click");$("#play-slideshow").bind("click",StartSlideShow);return false;};if(play==true){if($('#play-slideshow').text()=="Loading...")$('#play-slideshow').text("Please Wait...");else{$('#next-image').trigger('click.next');IntervalKey=setInterval(Slideshow,3000);$("#play-slideshow").text("Pause Slideshow");$("#play-slideshow").unbind("click");$("#play-slideshow").bind("click",StopSlideShow)}return false;}else if(play==false){clearInterval(IntervalKey);$("#play-slideshow").text("Play Slideshow");$("#play-slideshow").unbind("click");$("#play-slideshow").bind("click",StartSlideShow);return false;}else{$("#play-slideshow").bind("click",StartSlideShow)}}function FirstImage(){var first=$('ul#thumb-selection1').children('li').eq(0).find('a.thumb');$('.selected').removeClass('selected');first.addClass('selected');var imgSrc=first.attr('href');var imgCap=first.parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}function NextImage(){$('#next-image').bind('click.next',function(){if($("#play-slideshow").text()=="Pause Slideshow"){SlideShow(false)}else{if($('.selected').parent('li').hasClass('last')){$('img#current-slideshow-image').slideUp();$('#current-image-caption').html("Your At The End!")}else{if($('.selected').parent('li').hasClass('middle')){var nxt=$('li.other-first').find('a.thumb');$('.selected').removeClass('selected');$('.page-2').trigger('click');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}else{var nxt=$('.selected').parent('li').next('li').find('a.thumb');$('.selected').removeClass('selected');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}}}return false;})}function PrevImage(){$('#previous-image').bind('click.prev',function(){if($("#play-slideshow").text()=="Pause Slideshow"){SlideShow(false)}else{if($('.selected').parent('li').hasClass('first')){$('img#current-slideshow-image').slideUp();$('#current-image-caption').html("Your At the Start!")}else{if($('.selected').parent('li').hasClass('other-first')){var nxt=$('li.middle').find('a.thumb');$('.selected').removeClass('selected');$('.page-1').trigger('click');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}else{var nxt=$('.selected').parent('li').prev('li').find('a.thumb');$('.selected').removeClass('selected');nxt.addClass('selected');var imgSrc=nxt.attr('href');var imgCap=nxt.parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}}}return false})}function Gallery(){$('a.thumb').bind('click.gallery',function(){if($("#play-slideshow").text()=="Pause Slideshow"){SlideShow(false)}else{$('.selected').removeClass('selected');$(this).addClass('selected');var imgSrc=$(this).attr('href');var imgCap=$('a.selected').parent('li').find('.image-title').html();ShowImage(imgSrc,imgCap)}return false})}function ShowImage(imgSrc,imgCap){$('img#current-slideshow-image').slideUp();$('#current-image-caption').html("Loading...");$('img#current-slideshow-image').attr('src',imgSrc);$('img#current-slideshow-image').load(function(){$('#current-image-caption').html(imgCap);$('img#current-slideshow-image').attr('alt',imgCap);$('img#current-slideshow-image').slideDown();if($('#play-slideshow').text()=="Loading..."||$('#play-slideshow').text()=="Please Wait..."){$('#play-slideshow').text("Play Slideshow")}});$('img#current-slideshow-image').error(function(){$('#current-image-caption').html("error finding image, please try another.")})}function Sliding(imgSrc,imgCap){var imgHolder=$('img#current-slideshow-image');var capHolder=$('#current-image-caption');imgHolder.fadeOut();capHolder.html("Loading...");imgHolder.attr('src',imgSrc);imgHolder.load(function(){capHolder.html(imgCap);imgHolder.attr('alt',imgCap);imgHolder.fadeIn('slow')});imgHolder.error(function(){capHolder.html("error finding image, please try another.")})}function pagination(){$('.pagination a').bind('click', function() { if ($(this).hasClass('page-1')) { $('a.active-page').removeClass('active-page'); $('ul#thumb-selection2').hide(); $('ul#thumb-selection1').show(); $('a.page-1').addClass('active-page'); return false } else if ($(this).hasClass('page-2')) { $('a.active-page').removeClass('active-page'); $('ul#thumb-selection1').hide(); $('ul#thumb-selection2').show(); $('a.page-2').addClass('active-page'); return false; } })}