var theInt=null,$crosslink,$navthumb,curclicked=0,loadedImagesCount=0,imageSliderIsStarted=false,imagesCounter=0,imagesIds=new Array(7);
theInterval=function(a){clearInterval(theInt);if(typeof a!="undefined")curclicked=a;$crosslink.removeClass("active-thumb");$navthumb.eq(curclicked).parent().addClass("active-thumb");$(".stripNav ul li a").eq(curclicked).trigger("click");theInt=setInterval(function(){$crosslink.removeClass("active-thumb");$navthumb.eq(curclicked).parent().addClass("active-thumb");$(".stripNav ul li a").eq(curclicked).trigger("click");curclicked++;if(7==curclicked)curclicked=0},3E3)};
function startThumbNavigation(){imageSliderIsStarted=true;$("#main-photo-slider").codaSlider();$(".panel").css("display","block");$navthumb=$(".nav-thumb");$crosslink=$(".cross-link");$navthumb.click(function(){var a=$(this);theInterval(a.parent().attr("href").slice(1)-1);return false});theInterval()}function startThumbNavigatorWhenAllImagesAreLoaded(){loadedImagesCount>10&&imageSliderIsStarted==false&&startThumbNavigation()}function addImageId(a){imagesIds[imagesCounter]=a;imagesCounter++}
function loadFullscreenImages(){for(var a=0;a<7;a++){var b=$("#fullscreenimage"+a);$(b).load(function(){$(this).hide();$(this).fadeIn();loadedImagesCount++;startThumbNavigatorWhenAllImagesAreLoaded()}).error(function(){}).attr("src","GetImage.ashx?photoId="+imagesIds[a]+"&width=341&height=251&number=1")}}
$(document).ready(function(){for(var a=0;a<7;a++){var b=$("#slideimage"+a);$(b).load(function(){$(this).hide();$(this).fadeIn();loadedImagesCount++;startThumbNavigatorWhenAllImagesAreLoaded()}).error(function(){}).attr("src","GetImage.ashx?photoId="+imagesIds[a]+"&width=341&height=251&number=1")}setTimeout(loadFullscreenImages,500)});
