
(function($){jQuery.fn.wpgallery=function(settings){settings=jQuery.extend({},settings);var eThumbStyle={None:0,Resize:1,ResizeActive:2,ResizeHover:3,Opacity:4,OpacityActive:5,OpacityHover:6};var eThumbPosition={Horizontal:0,Vertical:1};var eTransitStyle={Basic:0,OpaqueFade:1,LeftToRight:2,TopToBottom:3,SquareFade:4,VerticalFlip:5,HorizontalFlip:6};var eControlBarStyle={InternalTop:0,InternalTopAnimated:1,InternalBottom:2,InternalBottomAnimated:3,ExternalBottom:4};var eNavbarAlignment={Centre:0,Left:1,Right:2};var eBrowser={Msie:0,Mozilla:1,Safari:2,Opera:3,Chrome:4};var eImageData={ImageSrc:0,ImageWidth:1,ImageHeight:2,ImageCaption:3,ThumbSrc:4};var $mainDiv=this;var $frameDiv=null;var $controlDiv=null;var $imageDiv=null;var $captionDiv=null;var $thumbDiv=null;var $thumb1Div=null;var $thumb2Div=null;var $navBarDiv=null;var $rewindButton=null;var $previousButton=null;var $playButton=null;var $nextButton=null;var $forwardButton=null;var $rewindMap=null;var $previousMap=null;var $playMap=null;var $nextMap=null;var $forwardMap=null;var $thumbRewindButton=null;var $thumbRewindMap=null;var $thumbForwardButton=null;var $thumbForwardMap=null;var nCurrentImage=0;var nPreviousImage=0;var bPlaying=false;var bPrevious=false;var bGoToImage=false;var bJumpToImage=false;var bJumpForward=true;var bFirstThumbDiv=true;var nThumbFirstImg=0;var bMouseOverThumbs=false;var bScrollingThumbs=false;var nThumbHoverBoundary=20;var nThumbMinorHoverBoundary=10;var nThumbDivBoundary=100;var nThumbActiveResize=10;var strZoomId=settings.imageArray+'_zoom';var strRewindMapId=settings.imageArray+'_RewindMapId';var strPreviousMapId=settings.imageArray+'_PreviousMapId';var strPlayMapId=settings.imageArray+'_PlayMapId';var strNextMapId=settings.imageArray+'_NextMapId';var strForwardMapId=settings.imageArray+'_ForwardMapId';var strThumbRewindMapId=settings.imageArray+'_ThumbRewindMapId';var strThumbForwardMapId=settings.imageArray+'_ThumbForwardMapId';var nGalleryLeft=settings.nGalleryLeft+(settings.bPageCentred?(($(document).width()-settings.nPageWidth)/2):0);var bShowNavFwrdNReverse=(settings.nTotalImages>settings.nTotalThumbs);var nNavBarWidth=((settings.bShowThumbnails&&bShowNavFwrdNReverse)?settings.nNavBarIconWidth*5:settings.nNavBarIconWidth*3);settings.nTotalThumbs=Math.min(settings.nTotalThumbs,settings.nTotalImages);settings.bShowThumbnailArrows=(settings.bShowThumbnailArrows&&bShowNavFwrdNReverse);var nThumbDivHeight=0;var nThumbDivTop=0;var nThumbDivWidth=0;var nThumbDivLeft=0;var nBorderWidth=settings.bThumbBorder?settings.nColBorderWidth:0;if(settings.nThumbPosition===eThumbPosition.Horizontal){nThumbDivHeight=(settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive||settings.nThumbStyle===eThumbStyle.ResizeHover)?(settings.nThumbSize+nBorderWidth)*2:settings.nThumbSize+nBorderWidth*2;nThumbDivTop=settings.nThumbTop-nBorderWidth*2;nThumbDivWidth=(settings.nThumbSize*settings.nTotalThumbs)+(settings.nThumbSpacing*(settings.nTotalThumbs-1))+nThumbDivBoundary;nThumbDivLeft=((settings.nGalleryWidth-nThumbDivWidth)/2);}else
{nThumbDivWidth=(settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive||settings.nThumbStyle===eThumbStyle.ResizeHover)?(settings.nThumbSize+nBorderWidth)*2:settings.nThumbSize+nBorderWidth*2;nThumbDivLeft=settings.nThumbLeft+nBorderWidth*2;nThumbDivHeight=(settings.nThumbSize*settings.nTotalThumbs)+(settings.nThumbSpacing*(settings.nTotalThumbs-1))+nThumbDivBoundary;nThumbDivTop=((settings.nGalleryHeight-nThumbDivHeight)/2);}function getImageData(nImage,nData){var bValidImage=(settings.imageArray[nImage]!==null&&settings.imageArray[nImage].wp_image!==null);switch(nData){case eImageData.ImageSrc:if(bValidImage){return settings.imageArray[nImage].wp_image.imgsrc;}else
{return"";}break;case eImageData.ImageWidth:if(bValidImage){return settings.imageArray[nImage].wp_image.width;}else
{return 200;}break;case eImageData.ImageHeight:if(bValidImage){return settings.imageArray[nImage].wp_image.height;}else
{return 200;}break;case eImageData.ImageCaption:if(bValidImage){return settings.imageArray[nImage].wp_image.caption;}else
{return"";}break;case eImageData.ThumbSrc:if(bValidImage){return settings.imageArray[nImage].wp_image.thumbSrc;}else
{return"";}break;}}function loadImage(div,strImageSrc,nPos,bThumb){var image=new Image();image.onload=function(){if(bThumb){$(div).attr({'src':strImageSrc});}else
{var nWidth=Math.min(settings.nImageDivWidth,getImageData(nPos,eImageData.ImageWidth));var nHeight=Math.min(settings.nImageDivHeight,getImageData(nPos,eImageData.ImageHeight));var nLeft=(settings.nImageDivWidth-nWidth)/2;var nTop=(settings.nImageDivHeight-nHeight)/2;$(div).attr({'src':strImageSrc});$(div).css({'left':nLeft,'top':nTop,'width':nWidth,'height':nHeight});}};image.src=strImageSrc;}function showCaptionCount(){if(settings.bCaptionCount){return(' '+(nCurrentImage+1)+'/'+settings.nTotalImages+' ');}else
{return('');}}function stopTimer(){$imageDiv.stopTime();if(settings.bShowNavBar)$playButton.attr({'src':settings.playButtonSrc,'title':settings.strPlayToolTip});bPlaying=false;}function resetThumbSize(bFrontDiv){var $thumbDiv;var i;if(bFrontDiv){$thumbDiv=bFirstThumbDiv?$thumb1Div:$thumb2Div;}else
{$thumbDiv=bFirstThumbDiv?$thumb2Div:$thumb1Div;}if(settings.nThumbPosition===eThumbPosition.Horizontal){for(i=0;i<settings.nTotalThumbs;++i){var nImgLeft=(i*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);$thumbDiv.find('img:eq('+i+')').css({'top':0,'left':nImgLeft,'width':settings.nThumbSize,'height':settings.nThumbSize});}}else
{for(i=0;i<settings.nTotalThumbs;++i){var nImgTop=(i*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);$thumbDiv.find('img:eq('+i+')').css({'top':nImgTop,'width':settings.nThumbSize,'height':settings.nThumbSize});}}}function preloadDivImages(bForward){var i;var thumb;if(bForward){var nFirstThumbInNextDiv=nThumbFirstImg+settings.nTotalThumbs;var nLastThumbInNextDiv=Math.min(nFirstThumbInNextDiv+settings.nTotalThumbs,settings.nTotalImages);if(nFirstThumbInNextDiv<settings.nTotalImages){for(i=nFirstThumbInNextDiv;i<nLastThumbInNextDiv;++i){loadImage($imageDiv.find('img:eq('+i+')'),getImageData(i,eImageData.ImageSrc),i,false);thumb=new Image();thumb.src=getImageData(i,eImageData.ThumbSrc);}}}else
{var nFirstThumbInPrevDiv=(nThumbFirstImg-settings.nTotalThumbs<0)?(settings.nTotalImages-settings.nTotalThumbs):(nThumbFirstImg-settings.nTotalThumbs);var nLastThumbInPrevDiv=Math.min(nFirstThumbInPrevDiv+settings.nTotalThumbs,settings.nTotalImages);if(nFirstThumbInPrevDiv>0){for(i=nFirstThumbInPrevDiv;i<nLastThumbInPrevDiv;++i){loadImage($imageDiv.find('img:eq('+i+')'),getImageData(i,eImageData.ImageSrc),i,false);thumb=new Image();thumb.src=getImageData(i,eImageData.ThumbSrc);}}}}function scrollThumbs(bForward){if(settings.bShowThumbnails&&bShowNavFwrdNReverse){bScrollingThumbs=true;var nDirection=bForward?1:-1;var $frontThumbDiv=bFirstThumbDiv?$thumb1Div:$thumb2Div;var $backThumbDiv=bFirstThumbDiv?$thumb2Div:$thumb1Div;nThumbFirstImg+=nDirection*settings.nTotalThumbs;if(nThumbFirstImg>=settings.nTotalImages){nThumbFirstImg=0;}else if(nThumbFirstImg<0){nThumbFirstImg=settings.nTotalImages-(settings.nTotalImages%settings.nTotalThumbs>0?settings.nTotalImages%settings.nTotalThumbs:settings.nTotalThumbs);}if(settings.nThumbPosition===eThumbPosition.Horizontal){$backThumbDiv.css({left:(nDirection*settings.nGalleryWidth)});}else
{$backThumbDiv.css({top:(nDirection*settings.nGalleryHeight)});}resetThumbSize(false);bFirstThumbDiv=!bFirstThumbDiv;var nValidThumbs=Math.min(settings.nTotalImages-nThumbFirstImg,settings.nTotalThumbs);for(var i=0;i<settings.nTotalThumbs;++i){if(i<nValidThumbs){$backThumbDiv.find('img:eq('+i+')').attr({'src':settings.loadingButtonSrc,'title':getImageData(nThumbFirstImg+i,eImageData.ImageCaption)});$backThumbDiv.find('img:eq('+i+')').css({'visibility':'visible'});loadImage($backThumbDiv.find('img:eq('+i+')'),getImageData(nThumbFirstImg+i,eImageData.ThumbSrc),i,true);}else
{$backThumbDiv.find('img:eq('+i+')').css({'visibility':'hidden'});}}if(settings.nThumbPosition===eThumbPosition.Horizontal){$backThumbDiv.animate({left:0},settings.nTransitTime);$frontThumbDiv.animate({left:(nDirection*-settings.nGalleryWidth)},settings.nTransitTime,function(){preloadDivImages(bForward);bScrollingThumbs=false;});}else
{$backThumbDiv.animate({top:0},settings.nTransitTime);$frontThumbDiv.animate({top:(nDirection*-settings.nGalleryHeight)},settings.nTransitTime,function(){preloadDivImages(bForward);bScrollingThumbs=false;});}}}function getZoom(){return(window.innerHeight/document.getElementById(strZoomId).offsetHeight);}function switchSlide(){var $nextImg;var $activeImg;if(bJumpToImage){$activeImg=$imageDiv.find('img:eq('+nPreviousImage+')');$nextImg=$imageDiv.find('img:eq('+nCurrentImage+')');scrollThumbs(bJumpForward);}else if(bGoToImage){$activeImg=$imageDiv.find('img:eq('+nPreviousImage+')');$nextImg=$imageDiv.find('img:eq('+nCurrentImage+')');if($nextImg.length===0){$nextImg=$imageDiv.find('img:first');nCurrentImage=0;}}else if(bPrevious){$activeImg=$imageDiv.find('img:eq('+nCurrentImage+')');$nextImg=$activeImg.prev('img');nPreviousImage=nCurrentImage--;if(nCurrentImage<0||$nextImg.length===0){$nextImg=$imageDiv.find('img:last');nCurrentImage=settings.nTotalImages-1;scrollThumbs(false);}else
{if((nCurrentImage+1)%settings.nTotalThumbs===0){scrollThumbs(false);}}}else
{$activeImg=$imageDiv.find('img:eq('+nCurrentImage+')');$nextImg=$activeImg.next('img');nPreviousImage=nCurrentImage++;if(nCurrentImage<0||$nextImg.length===0){$nextImg=$imageDiv.find('img:first');nCurrentImage=0;scrollThumbs(true);}else
{if(nCurrentImage%settings.nTotalThumbs===0){scrollThumbs(true);}}}if($activeImg.length===0){$activeImg=$imageDiv.find('img:last');}$nextImg.css({visibility:'hidden',opacity:1.0});loadImage($nextImg,getImageData(nCurrentImage,eImageData.ImageSrc),nCurrentImage,false);if(settings.bShowCaption){var strCaption=showCaptionCount()+$nextImg.attr('title');$captionDiv.text(strCaption);}var bForceNormalTransit=false;if(nCurrentImage===0&&nPreviousImage===(settings.nTotalImages-1)){bForceNormalTransit=true;}else if(bJumpToImage&&bJumpForward){bForceNormalTransit=true;}var nActiveImgLeft;var nNextImgLeft;var nActiveImgTop;var nNextImgTop;var nNextImgWidth;var nNextImgHeight;switch(settings.nTransitionStyle){case eTransitStyle.Basic:$nextImg.css({opacity:1.0,'z-index':(settings.nZIndex+2),visibility:'visible'});$activeImg.css({opacity:1.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});break;case eTransitStyle.OpaqueFade:$activeImg.animate({opacity:0.0},settings.nTransitTime);$nextImg.css({opacity:0.0,'z-index':(settings.nZIndex+2),visibility:'visible'});$nextImg.animate({opacity:1.0},settings.nTransitTime,function(){$activeImg.css({opacity:0.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});});break;case eTransitStyle.LeftToRight:nActiveImgLeft=(settings.nImageDivWidth-Math.min(settings.nImageDivWidth,getImageData(nPreviousImage,eImageData.ImageWidth)))/2;nNextImgLeft=(settings.nImageDivWidth-Math.min(settings.nImageDivWidth,getImageData(nCurrentImage,eImageData.ImageWidth)))/2;if(!bForceNormalTransit&&(bPrevious||nPreviousImage>nCurrentImage||(bJumpToImage&&!bJumpForward&&nCurrentImage===(settings.nTotalImages-1)))){$nextImg.animate({left:(-settings.nImageDivWidth+nNextImgLeft)},1,function(){$nextImg.css({visibility:'visible'});});$activeImg.animate({left:(settings.nImageDivWidth+nActiveImgLeft)},settings.nTransitTime);$nextImg.animate({left:nNextImgLeft},settings.nTransitTime,function(){$activeImg.css({opacity:1.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});});}else
{$nextImg.animate({left:(settings.nImageDivWidth+nNextImgLeft)},1,function(){$nextImg.css({visibility:'visible'});});$activeImg.animate({left:(-settings.nImageDivWidth+nActiveImgLeft)},settings.nTransitTime);$nextImg.animate({left:nNextImgLeft},settings.nTransitTime,function(){$activeImg.css({opacity:1.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});});}break;case eTransitStyle.TopToBottom:nActiveImgTop=(settings.nImageDivHeight-Math.min(settings.nImageDivHeight,getImageData(nPreviousImage,eImageData.ImageHeight)))/2;nNextImgTop=(settings.nImageDivHeight-Math.min(settings.nImageDivHeight,getImageData(nCurrentImage,eImageData.ImageHeight)))/2;if(!bForceNormalTransit&&(bPrevious||nPreviousImage>nCurrentImage||(bJumpToImage&&!bJumpForward&&nCurrentImage===(settings.nTotalImages-1)))){$nextImg.animate({top:-settings.nImageDivHeight+nNextImgTop},1,function(){$nextImg.css({visibility:'visible'});});$activeImg.animate({top:(settings.nImageDivHeight+nActiveImgTop)},settings.nTransitTime);$nextImg.animate({top:nNextImgTop},settings.nTransitTime,function(){$activeImg.css({opacity:1.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});});}else
{$nextImg.animate({top:settings.nImageDivHeight+nNextImgTop},1,function(){$nextImg.css({visibility:'visible'});});$activeImg.animate({top:(-settings.nImageDivHeight+nActiveImgTop)},settings.nTransitTime);$nextImg.animate({top:nNextImgTop},settings.nTransitTime,function(){$activeImg.css({opacity:1.0,'z-index':(settings.nZIndex+1),visibility:'hidden'});});}break;case eTransitStyle.SquareFade:nNextImgWidth=Math.min(settings.nImageDivWidth,getImageData(nCurrentImage,eImageData.ImageWidth));nNextImgHeight=Math.min(settings.nImageDivHeight,getImageData(nCurrentImage,eImageData.ImageHeight));nNextImgLeft=((settings.nImageDivWidth-nNextImgWidth)/2);nNextImgTop=((settings.nImageDivHeight-nNextImgHeight)/2);$nextImg.animate({width:'0',height:'0',left:(settings.nImageDivWidth/2),top:(settings.nImageDivHeight/2)},1);$activeImg.animate({width:'0',height:'0',left:(settings.nImageDivWidth/2),top:(settings.nImageDivHeight/2)},(settings.nTransitTime/2),function(){$nextImg.css({visibility:'visible'});$activeImg.css({visibility:'hidden'});$nextImg.animate({width:nNextImgWidth,height:nNextImgHeight,left:nNextImgLeft,top:nNextImgTop},(settings.nTransitTime/2));});break;case eTransitStyle.VerticalFlip:nNextImgWidth=Math.min(settings.nImageDivWidth,getImageData(nCurrentImage,eImageData.ImageWidth));nNextImgLeft=((settings.nImageDivWidth-nNextImgWidth)/2);$nextImg.animate({width:'0',left:(settings.nImageDivWidth/2)},1);$activeImg.animate({width:'0',left:(settings.nImageDivWidth/2)},(settings.nTransitTime/2),function(){$nextImg.css({visibility:'visible'});$activeImg.css({visibility:'hidden'});$nextImg.animate({width:nNextImgWidth,left:nNextImgLeft},(settings.nTransitTime/2));});break;case eTransitStyle.HorizontalFlip:nNextImgHeight=Math.min(settings.nImageDivHeight,getImageData(nCurrentImage,eImageData.ImageHeight));nNextImgTop=((settings.nImageDivHeight-nNextImgHeight)/2);$nextImg.animate({height:'0',top:(settings.nImageDivHeight/2)},1);$activeImg.animate({height:'0',top:(settings.nImageDivHeight/2)},(settings.nTransitTime/2),function(){$nextImg.css({visibility:'visible'});$activeImg.css({visibility:'hidden'});$nextImg.animate({height:nNextImgHeight,top:nNextImgTop},(settings.nTransitTime/2));});break;}if(settings.bShowThumbnails){if(settings.bThumbBorder||settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive||settings.nThumbStyle===eThumbStyle.Opacity||settings.nThumbStyle===eThumbStyle.OpacityActive){var $frontThumbDiv=bFirstThumbDiv?$thumb1Div:$thumb2Div;var $thumbDiv=$frontThumbDiv.find('img:eq('+(nCurrentImage-nThumbFirstImg)+')');var nThumbOffset=((nCurrentImage%settings.nTotalThumbs)*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);if(settings.bThumbBorder){$thumbDiv.css({'border-color':settings.strThumbBorderActiveColour});}if((settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive)&&!bMouseOverThumbs){if(settings.nThumbPosition===eThumbPosition.Horizontal){$thumbDiv.css({'left':(nThumbOffset/getZoom())});$thumbDiv.animate({'left':(nThumbOffset-(nThumbActiveResize/2)),'top':-nThumbActiveResize,'width':settings.nThumbSize+nThumbActiveResize,'height':settings.nThumbSize+nThumbActiveResize},100);}else
{$thumbDiv.css({'top':(nThumbOffset/getZoom())});$thumbDiv.animate({'top':(nThumbOffset-(nThumbActiveResize/2)),'width':settings.nThumbSize+nThumbActiveResize,'height':settings.nThumbSize+nThumbActiveResize},100);}}else if(settings.nThumbStyle===eThumbStyle.Opacity||settings.nThumbStyle===eThumbStyle.OpacityActive){$thumbDiv.animate({'opacity':1.0,'-moz-opacity':1.0,'filter:alpha:opacity':100},200);}if(nPreviousImage<nThumbFirstImg||nPreviousImage>=nThumbFirstImg+settings.nTotalThumbs){$frontThumbDiv=bFirstThumbDiv?$thumb2Div:$thumb1Div;}$thumbDiv=$frontThumbDiv.find('img:eq('+(nPreviousImage%settings.nTotalThumbs)+')');if(settings.bThumbBorder){$thumbDiv.css({'border-color':settings.strThumbBorderColour});}nThumbOffset=((nPreviousImage%settings.nTotalThumbs)*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);if((settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive)&&!bMouseOverThumbs){if(settings.nThumbPosition===eThumbPosition.Horizontal){$thumbDiv.css({'left':(nThumbOffset/getZoom())});$thumbDiv.animate({'left':nThumbOffset,'top':0,'width':settings.nThumbSize,'height':settings.nThumbSize},100);}else
{$thumbDiv.css({'top':(nThumbOffset/getZoom())});$thumbDiv.animate({'left':0,'top':nThumbOffset,'width':settings.nThumbSize,'height':settings.nThumbSize},100);}}else if(settings.nThumbStyle===eThumbStyle.Opacity||settings.nThumbStyle===eThumbStyle.OpacityActive){$thumbDiv.animate({'opacity':settings.nThumbOpacity,'-moz-opacity':settings.nThumbOpacity,'filter:alpha:opacity':(settings.nThumbOpacity*100)},200);}}}}function goToImage(nThumb,bJump){var nImage;if(bScrollingThumbs){return;}if(bJump){nImage=nThumb;bScrollingThumbs=true;}else
{nImage=nThumbFirstImg+nThumb;}if(nImage!==nCurrentImage){stopTimer();nPreviousImage=nCurrentImage;nCurrentImage=nImage;if(bJump){bJumpToImage=true;}else{bGoToImage=true;}switchSlide();if(bJump){bJumpToImage=false;}else{bGoToImage=false;}}}function initialise(){var i;$mainDiv.append('<div id="'+strZoomId+'" style="position:fixed; top:0px; left:-100px; width:1px; height:100%;"></div>');if(settings.bShowThumbnails){$mainDiv.append('<div style="position:absolute; top:'+nThumbDivTop+'px; left:'+nThumbDivLeft+'px; width:'+nThumbDivWidth+'px; height:'+nThumbDivHeight+'px; z-index:'+(settings.nZIndex+5)+'; overflow: hidden;"></div>');$thumbDiv=$mainDiv.find('div:last');}$mainDiv.append('<div style="position:absolute; top:'+settings.nImageDivTop+'px; left:'+settings.nImageDivLeft+'px; width:'+settings.nImageDivWidth+'px; height:'+settings.nImageDivHeight+'px; overflow:hidden"></div>');$frameDiv=$mainDiv.find('div:last');var nImageWidth=Math.min(settings.nImageDivWidth,getImageData(0,eImageData.ImageWidth));var nImageHeight=Math.min(settings.nImageDivHeight,getImageData(0,eImageData.ImageHeight));var nImageLeft=(settings.nImageDivWidth-nImageWidth)/2;var nImageTop=(settings.nImageDivHeight-nImageHeight)/2;$frameDiv.append('<div style="position:absolute; top:0px; left:0px; width:'+settings.nImageDivWidth+'px; height:'+settings.nImageDivHeight+'px"><img src='+getImageData(0,eImageData.ImageSrc)+' style="position:absolute; top:'+nImageTop+'px; left:'+nImageLeft+'px; width:'+nImageWidth+'px; height:'+nImageHeight+'px; z-index:'+(settings.nZIndex+1)+'; opacity:1.0; visibility:visible;"  title="'+getImageData(0,eImageData.ImageCaption)+'"/></div>');$imageDiv=$frameDiv.find('div:first');if(settings.bShowNavBar||settings.bShowCaption){switch(settings.nControlBarStyle){case eControlBarStyle.InternalTop:$frameDiv.append('<div style="position:absolute; visibility:hidden; top:0px; left:0px; width:'+settings.nImageDivWidth+'px; z-index:'+(settings.nZIndex+3)+';"></div>');$controlDiv=$frameDiv.find('div:last');break;case eControlBarStyle.InternalTopAnimated:$frameDiv.append('<div style="position:absolute; visibility:hidden; top:'+(-100)+'px; left:0px; width:'+settings.nImageDivWidth+'px; z-index:'+(settings.nZIndex+3)+';"></div>');$controlDiv=$frameDiv.find('div:last');break;case eControlBarStyle.InternalBottom:$frameDiv.append('<div style="position:absolute; visibility:hidden; top:'+(settings.nImageDivHeight-20)+'px; left:0px; width:'+settings.nImageDivWidth+'px; z-index:'+(settings.nZIndex+3)+';"></div>');$controlDiv=$frameDiv.find('div:last');break;case eControlBarStyle.InternalBottomAnimated:$frameDiv.append('<div style="position:absolute; visibility:hidden; top:'+settings.nImageDivHeight+'px; left:0px; width:'+settings.nImageDivWidth+'px; z-index:'+(settings.nZIndex+3)+'"></div>');$controlDiv=$frameDiv.find('div:last');break;case eControlBarStyle.ExternalBottom:$mainDiv.append('<div style="position:absolute; top:'+settings.nControlBarExternalTop+'px; left:'+((settings.nGalleryWidth-settings.nImageDivWidth)/2)+'px; width:'+settings.nGalleryWidth+'px; z-index:'+(settings.nZIndex+3)+'"></div>');$controlDiv=$mainDiv.find('div:last');break;}var nNavBarLeftPadding=0;var strNavBarColour='';var strNavBarOpacity='';var strNavDiv='';if(settings.bShowNavBar&&settings.bNavBarOnTop){nNavBarLeftPadding=(settings.nNavBarAlignment===eNavbarAlignment.Right)?settings.nImageDivWidth-nNavBarWidth:(settings.nNavBarAlignment===eNavbarAlignment.Left)?0:((settings.nImageDivWidth-nNavBarWidth)/2);strNavBarColour=(settings.strNavBarColour==='none'?'':('background-color:'+settings.strNavBarColour+';'));strNavBarOpacity=(settings.nNavBarOpacity>=1.0?'':(' filter:alpha(opacity='+(settings.nNavBarOpacity*100)+'); opacity:'+settings.nNavBarOpacity+'; -moz-opacity:'+settings.nNavBarOpacity+';'));strNavDiv='<div style="padding-left:'+nNavBarLeftPadding+'px; width:100%; height:'+settings.nNavBarIconHeight+'px; '+strNavBarColour+strNavBarOpacity+'"></div>';$controlDiv.append(strNavDiv);$navBarDiv=$controlDiv.find('div:first');}if(settings.bShowCaption){var strCaptionText=showCaptionCount()+getImageData(0,eImageData.ImageCaption);var strCaptionColour=(settings.strCaptionColour==='none'?'':('background-color:'+settings.strCaptionColour+';'));var strCaptionOpacity=(settings.nCaptionOpacity>=1.0?'':(' filter:alpha(opacity='+(settings.nCaptionOpacity*100)+'); opacity:'+settings.nCaptionOpacity+'; -moz-opacity:'+settings.nCaptionOpacity+';'));var strCaptionDiv='<div style="width:100%; height:auto;'+strCaptionColour+strCaptionOpacity+' color:'+settings.strCaptionTextColour+'; font-family:'+settings.strCaptionFontType+'; font-size:'+settings.nCaptionFontSize+'px; font-weight:'+settings.strCaptionFontWeight+'; text-align:'+settings.strCaptionAlign+'; padding:5px"> '+strCaptionText+' </div>';$controlDiv.append(strCaptionDiv);$captionDiv=$controlDiv.find('div:last');}if(settings.bShowNavBar){if(!settings.bNavBarOnTop){nNavBarLeftPadding=(settings.nNavBarAlignment===eNavbarAlignment.Right)?settings.nImageDivWidth-nNavBarWidth:(settings.nNavBarAlignment===eNavbarAlignment.Left)?0:((settings.nImageDivWidth-nNavBarWidth)/2);strNavBarColour=(settings.strNavBarColour==='none'?'':('background-color:'+settings.strNavBarColour+';'));strNavBarOpacity=(settings.nNavBarOpacity>=1.0?'':(' filter:alpha(opacity='+(settings.nNavBarOpacity*100)+'); opacity:'+settings.nNavBarOpacity+'; -moz-opacity:'+settings.nNavBarOpacity+';'));strNavDiv='<div style="padding-left:'+nNavBarLeftPadding+'px; width:100%; height:'+settings.nNavBarIconHeight+'px; '+strNavBarColour+strNavBarOpacity+'"></div>';$controlDiv.append(strNavDiv);$navBarDiv=$controlDiv.find('div:last');}if(settings.bShowThumbnails&&bShowNavFwrdNReverse){$navBarDiv.append('<img src='+settings.rewindButtonSrc+' title="'+settings.strRewindToolTip+'" style="border-style:none; cursor:pointer;">');$navBarDiv.append('<img src='+settings.prevButtonSrc+' title="'+settings.strPreviousToolTip+'" style="border-style:none; cursor:pointer;">');$navBarDiv.append('<img src='+settings.playButtonSrc+' title="'+settings.strPlayToolTip+'" style="border-style:none; cursor:pointer;">');$navBarDiv.append('<img src='+settings.nextButtonSrc+' title="'+settings.strNextToolTip+'" style="border-style:none; cursor:pointer;">');$navBarDiv.append('<img src='+settings.forwardButtonSrc+' title="'+settings.strForwardToolTip+'" style="border-style:none; cursor:pointer;">');$rewindButton=$navBarDiv.find('img:eq(0)');$previousButton=$navBarDiv.find('img:eq(1)');$playButton=$navBarDiv.find('img:eq(2)');$nextButton=$navBarDiv.find('img:eq(3)');$forwardButton=$navBarDiv.find('img:eq(4)');}else
{$navBarDiv.append('<a style="cursor:pointer;"><img src='+settings.prevButtonSrc+' title="'+settings.strPreviousToolTip+'" style="border-style:none"></a>');$navBarDiv.append('<a style="cursor:pointer;"><img src='+settings.playButtonSrc+' title="'+settings.strPlayToolTip+'" style="border-style:none"></a>');$navBarDiv.append('<a style="cursor:pointer;"><img src='+settings.nextButtonSrc+' title="'+settings.strNextToolTip+'" style="border-style:none"></a>');$previousButton=$navBarDiv.find('img:eq(0)');$playButton=$navBarDiv.find('img:eq(1)');$nextButton=$navBarDiv.find('img:eq(2)');}}switch(settings.nControlBarStyle){case eControlBarStyle.InternalTop:$controlDiv.css({visibility:'visible'});break;case eControlBarStyle.InternalTopAnimated:$controlDiv.css({top:(-$controlDiv.height())});break;case eControlBarStyle.InternalBottom:$controlDiv.css({visibility:'visible',top:(settings.nImageDivHeight-$controlDiv.height())});break;}}if(settings.bShowThumbnails){if(settings.nThumbPosition===eThumbPosition.Horizontal){var nNestedThumbDivTop=(settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeHover)?settings.nThumbSize:0;$thumbDiv.append('<div style="position:absolute; top:'+nNestedThumbDivTop+'px; left:0px; width:'+nThumbDivWidth+'px; height:'+settings.nThumbSize+'px"></div>');$thumb1Div=$thumbDiv.find('div:first');$thumbDiv.append('<div style="position:absolute; top:'+nNestedThumbDivTop+'px; left:'+settings.nGalleryWidth+'px; width:'+nThumbDivWidth+'px; height:'+settings.nThumbSize+'px"></div>');$thumb2Div=$thumbDiv.find('div:last');}else
{$thumbDiv.append('<div style="position:absolute; top:0px; left:0px; width:'+nThumbDivWidth+'px; height:'+nThumbDivHeight+'px"></div>');$thumb1Div=$thumbDiv.find('div:first');$thumbDiv.append('<div style="position:absolute; top:'+settings.nGalleryHeight+'px; left:0px; width:'+nThumbDivWidth+'px; height:'+settings.nThumbDivHeight+'px"></div>');$thumb2Div=$thumbDiv.find('div:last');}for(i=0;i<settings.nTotalThumbs;++i){var nImgOpacity=(settings.nThumbStyle===eThumbStyle.Opacity||settings.nThumbStyle===eThumbStyle.OpacityActive||settings.nThumbStyle===eThumbStyle.OpacityHover)?settings.nThumbOpacity:1.0;var strBorderStyle=(settings.bThumbBorder?'solid':'none');if(settings.nThumbPosition===eThumbPosition.Horizontal){var nImgLeft=(i*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);if(i<settings.nTotalImages){$thumb1Div.append('<a style="cursor:pointer;"><img style="position:absolute; left:'+nImgLeft+'px; height:'+settings.nThumbSize+'px; width:'+settings.nThumbSize+'px; border-style:'+strBorderStyle+'; border-color:'+settings.strThumbBorderColour+'; border-width:'+settings.nColBorderWidth+'px; filter:alpha(opacity='+(nImgOpacity*100)+'); opacity:'+nImgOpacity+'; -moz-opacity:'+nImgOpacity+'; visibility:visible" src='+settings.loadingButtonSrc+' title="'+getImageData(i,eImageData.ImageCaption)+'"/></a>');loadImage($thumb1Div.find('a:eq('+i+')').find('img:first'),getImageData(i,eImageData.ThumbSrc),i,true);}if(settings.nTotalThumbs+i<settings.nTotalImages){$thumb2Div.append('<a style="cursor:pointer;"><img style="position:absolute; left:'+nImgLeft+'px; height:'+settings.nThumbSize+'px; width:'+settings.nThumbSize+'px; border-style:'+strBorderStyle+'; border-color:'+settings.strThumbBorderColour+'; border-width:'+settings.nColBorderWidth+'px; filter:alpha(opacity='+(nImgOpacity*100)+'); opacity:'+nImgOpacity+'; -moz-opacity:'+nImgOpacity+'; visibility:visible" src='+settings.loadingButtonSrc+' title="'+getImageData(settings.nTotalThumbs+i,eImageData.ImageCaption)+'"/></a>');loadImage($thumb2Div.find('a:eq('+i+')').find('img:first'),getImageData(settings.nTotalThumbs+i,eImageData.ThumbSrc),i,true);}}else
{var nImgTop=(i*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);if(i<settings.nTotalImages){$thumb1Div.append('<a style="cursor:pointer;"><img style="position:absolute; left:0px; top:'+nImgTop+'px; height:'+settings.nThumbSize+'px; width:'+settings.nThumbSize+'px; border-style:'+strBorderStyle+'; border-color:'+settings.strThumbBorderColour+'; border-width:'+settings.nColBorderWidth+'px; filter:alpha(opacity='+(nImgOpacity*100)+'); opacity:'+nImgOpacity+'; -moz-opacity:'+nImgOpacity+'; visibility:visible" src='+getImageData(i,eImageData.ThumbSrc)+' title="'+getImageData(i,eImageData.ImageCaption)+'"/></a>');loadImage($thumb1Div.find('a:eq('+i+')').find('img:first'),getImageData(i,eImageData.ThumbSrc),i,true);}if(settings.nTotalThumbs+i<settings.nTotalImages){$thumb2Div.append('<a style="cursor:pointer;"><img style="position:absolute; left:0px; top:'+nImgTop+'px; height:'+settings.nThumbSize+'px; width:'+settings.nThumbSize+'px; border-style:'+strBorderStyle+'; border-color:'+settings.strThumbBorderColour+'; border-width:'+settings.nColBorderWidth+'px; filter:alpha(opacity='+(nImgOpacity*100)+'); opacity:'+nImgOpacity+'; -moz-opacity:'+nImgOpacity+'; visibility:visible" src='+getImageData(settings.nTotalThumbs+i,eImageData.ThumbSrc)+' title="'+getImageData(settings.nTotalThumbs+i,eImageData.ImageCaption)+'"/></a>');loadImage($thumb2Div.find('a:eq('+i+')').find('img:first'),getImageData(i,eImageData.ThumbSrc),i,true);}}if(i<settings.nTotalImages){$thumb1Div.find('img:eq('+i+')').click(function(nThumb){return function(){goToImage(nThumb,false);};}(i));if(settings.bThumbBorder){$thumb1Div.find('img:eq('+i+')').hover(function(){$(this).css({'border-color':settings.strThumbBorderHoverColour});},function(nThumb){return function(){var bHighlight=((nCurrentImage-nThumbFirstImg)===nThumb);$(this).css({'border-color':(bHighlight?settings.strThumbBorderActiveColour:settings.strThumbBorderColour)});};}(i));}if(settings.nThumbStyle===eThumbStyle.Opacity){$thumb1Div.find('img:eq('+i+')').hover(function(){$(this).animate({opacity:1.0},200);},function(nThumb){return function(){var bHighlight=((nCurrentImage-nThumbFirstImg)===nThumb);$(this).animate({opacity:(bHighlight?1.0:settings.nThumbOpacity)},20);};}(i));}else if(settings.nThumbStyle===eThumbStyle.OpacityHover){$thumb1Div.find('img:eq('+i+')').hover(function(){$(this).animate({opacity:1.0},200);},function(){$(this).animate({opacity:settings.nThumbOpacity},20);});}}if(settings.nTotalThumbs+i<settings.nTotalImages){$thumb2Div.find('img:eq('+i+')').click(function(nThumb){return function(){goToImage(nThumb,false);};}(i));if(settings.bThumbBorder){$thumb2Div.find('img:eq('+i+')').hover(function(){$(this).css({'border-color':settings.strThumbBorderHoverColour});},function(nThumb){return function(){var bHighlight=((nCurrentImage-nThumbFirstImg)===nThumb);$(this).css({'border-color':(bHighlight?settings.strThumbBorderActiveColour:settings.strThumbBorderColour)});};}(i));}if(settings.nThumbStyle===eThumbStyle.Opacity){$thumb2Div.find('img:eq('+i+')').hover(function(){$(this).animate({opacity:1.0},200);},function(nThumb){return function(){var bHighlight=((nCurrentImage-nThumbFirstImg)===nThumb);$(this).animate({opacity:(bHighlight?1.0:settings.nThumbOpacity)},20);};}(i));}else if(settings.nThumbStyle===eThumbStyle.OpacityHover){$thumb2Div.find('img:eq('+i+')').hover(function(){$(this).animate({opacity:1.0},200);},function(){$(this).animate({opacity:settings.nThumbOpacity},20);});}}}if(settings.bThumbBorder){$thumb1Div.find('img:eq(0)').css({'border-color':settings.strThumbBorderActiveColour});}if(settings.nThumbStyle===eThumbStyle.Opacity||settings.nThumbStyle===eThumbStyle.OpacityActive){$thumb1Div.find('img:eq(0)').css({opacity:1.0});}else if(settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive){if(settings.nThumbPosition===eThumbPosition.Horizontal){$thumb1Div.find('img:eq(0)').css({'left':((nThumbDivBoundary/2)-(nThumbActiveResize/2)),'top':-nThumbActiveResize,width:settings.nThumbSize+nThumbActiveResize,height:settings.nThumbSize+nThumbActiveResize});}else
{$thumb1Div.find('img:eq(0)').css({'top':((nThumbDivBoundary/2)-(nThumbActiveResize/2)),width:settings.nThumbSize+nThumbActiveResize,height:settings.nThumbSize+nThumbActiveResize});}}if(settings.bShowThumbnailArrows){var nThumbTop;var nThumbLeft;if(settings.nThumbPosition===eThumbPosition.Horizontal){nThumbTop=settings.nThumbTop+((settings.nThumbSize-settings.nThumbButtonSize)/2)+((settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeActive||settings.nThumbStyle===eThumbStyle.ResizeHover)?settings.nThumbSize:0);nThumbLeft=settings.nThumbButtonIndent;var nThumbRight=settings.nGalleryWidth-(settings.nThumbButtonIndent+settings.nThumbButtonSize);$mainDiv.append('<a style="cursor:pointer;"><img src='+settings.thumbRewindButtonSrc+' title="'+settings.strThumbRewindToolTip+'" style="position:absolute; top:'+nThumbTop+'px; left:'+nThumbLeft+'px; z-index:'+(settings.nZIndex+6)+'; border-style:none;"></a>');$thumbRewindButton=$mainDiv.find('a:last').find(('img:eq(0)'));$mainDiv.append('<a style="cursor:pointer;"><img src='+settings.thumbForwardButtonSrc+' title="'+settings.strThumbForwardToolTip+'" style="position:absolute; top:'+nThumbTop+'px; left:'+nThumbRight+'px; z-index:'+(settings.nZIndex+6)+'; border-style:none;"></a>');$thumbForwardButton=$mainDiv.find('a:last').find(('img:eq(0)'));}else
{nThumbLeft=settings.nThumbLeft+((settings.nThumbSize-settings.nThumbButtonSize)/2);nThumbTop=settings.nThumbButtonIndent;var nThumbBottom=settings.nGalleryHeight-(settings.nThumbButtonIndent+settings.nThumbButtonSize);$mainDiv.append('<a style="cursor:pointer;"><img src='+settings.thumbRewindButtonSrc+' title="'+settings.strThumbRewindToolTip+'" style="position:absolute; top:'+nThumbTop+'px; left:'+nThumbLeft+'px; z-index:'+(settings.nZIndex+6)+'; border-style:none;"></a>');$thumbRewindButton=$mainDiv.find('a:last').find(('img:eq(0)'));$mainDiv.append('<a style="cursor:pointer;"><img src='+settings.thumbForwardButtonSrc+' title="'+settings.strThumbForwardToolTip+'" style="position:absolute; top:'+nThumbBottom+'px; left:'+nThumbLeft+'px; z-index:'+(settings.nZIndex+6)+'; border-style:none;"></a>');$thumbForwardButton=$mainDiv.find('a:last').find(('img:eq(0)'));}}}for(i=1;i<settings.nTotalImages;++i){$imageDiv.append('<img src='+settings.loadingButtonSrc+' style="position:absolute; top:'+nImageTop+'px; left:'+nImageLeft+'px; width:'+nImageWidth+'px; height:'+nImageHeight+'px; z-index:'+(settings.nZIndex+1)+'; opacity:0.0; visibility:hidden;" title="'+getImageData(i,eImageData.ImageCaption)+'"/>');}var nTotalNextImages=Math.min((settings.nTotalThumbs*2),settings.nTotalImages);for(i=0;i<nTotalNextImages;++i){loadImage($imageDiv.find('img:eq('+i+')'),getImageData(i,eImageData.ImageSrc),i,false);}if(settings.nTotalImages>(settings.nTotalThumbs*2)){var nStartOfPrevImgages=(settings.nTotalImages-settings.nTotalThumbs);for(i=nStartOfPrevImgages;i<settings.nTotalImages;++i){loadImage($imageDiv.find('img:eq('+i+')'),getImageData(i,eImageData.ImageSrc),i,false);var thumb=new Image();thumb.src=getImageData(i,eImageData.ThumbSrc);}}}function startTimer(){if(!bPlaying){bPlaying=true;if(settings.bShowNavBar)$playButton.attr({'src':settings.pauseButtonSrc,'title':settings.strPauseToolTip});$imageDiv.everyTime((settings.nStaticTime+settings.nTransitTime),"GalleryTimer",function(){switchSlide();});}}initialise();if(settings.bPageCentred){$(window).bind('resize',function(){nGalleryLeft=settings.nGalleryLeft+(($(document).width()-settings.nPageWidth)/2);});}if(settings.bShowNavBar){if(settings.bShowThumbnails&&bShowNavFwrdNReverse){$rewindButton.click(function(){bJumpForward=false;var nTargetImg=nThumbFirstImg-1;if(nTargetImg<0){nTargetImg=settings.nTotalImages-1;}goToImage(nTargetImg,true);});$forwardButton.click(function(){bJumpForward=true;var nTargetImg=nThumbFirstImg+settings.nTotalThumbs;if(nTargetImg>=settings.nTotalImages){nTargetImg=0;}goToImage(nTargetImg,true);});$rewindButton.hover(function(){$(this).attr('src',settings.rewindoverButtonSrc);},function(){$(this).attr('src',settings.rewindButtonSrc);});$forwardButton.hover(function(){$(this).attr('src',settings.forwardoverButtonSrc);},function(){$(this).attr('src',settings.forwardButtonSrc);});}$previousButton.click(function(){stopTimer();bPrevious=true;switchSlide();bPrevious=false;});$playButton.click(function(){if(bPlaying){stopTimer();}else
{switchSlide();startTimer();}});$nextButton.click(function(){stopTimer();switchSlide();});$previousButton.hover(function(){$(this).attr('src',settings.prevoverButtonSrc);},function(){$(this).attr('src',settings.prevButtonSrc);});$playButton.hover(function(){if(bPlaying){$(this).attr('src',settings.pauseoverButtonSrc);}else
{$(this).attr('src',settings.playoverButtonSrc);}},function(){if(bPlaying){$(this).attr('src',settings.pauseButtonSrc);}else
{$(this).attr('src',settings.playButtonSrc);}});$nextButton.hover(function(){$(this).attr('src',settings.nextoverButtonSrc);},function(){$(this).attr('src',settings.nextButtonSrc);});}if(settings.bShowThumbnails&&bShowNavFwrdNReverse&&settings.bShowThumbnailArrows){$thumbRewindButton.click(function(){bJumpForward=false;var nTargetImg=nThumbFirstImg-1;if(nTargetImg<0){nTargetImg=settings.nTotalImages-1;}goToImage(nTargetImg,true);});$thumbForwardButton.click(function(){bJumpForward=true;var nTargetImg=nThumbFirstImg+settings.nTotalThumbs;if(nTargetImg>=settings.nTotalImages){nTargetImg=0;}goToImage(nTargetImg,true);});$thumbRewindButton.hover(function(){$(this).attr('src',settings.thumboverRewindButtonSrc);},function(){$(this).attr('src',settings.thumbRewindButtonSrc);});$thumbForwardButton.hover(function(){$(this).attr('src',settings.thumboverForwardButtonSrc);},function(){$(this).attr('src',settings.thumbForwardButtonSrc);});}if(settings.bShowNavBar||settings.bShowCaption){if(settings.nControlBarStyle===eControlBarStyle.InternalTopAnimated){$frameDiv.hover(function(){$controlDiv.css({visibility:'visible'});$controlDiv.animate({top:0},250);},function(){$controlDiv.animate({top:-$controlDiv.height()},250,function(){$controlDiv.css({visibility:'hidden'});});});}else if(settings.nControlBarStyle===eControlBarStyle.InternalBottomAnimated){$frameDiv.hover(function(){$controlDiv.css({visibility:'visible'});$controlDiv.animate({top:settings.nImageDivHeight-$controlDiv.height()},250);},function(){$controlDiv.animate({top:settings.nImageDivHeight},250,function(){$controlDiv.css({visibility:'hidden'});});});}}if(settings.bShowThumbnails){if(settings.nThumbStyle===eThumbStyle.Resize||settings.nThumbStyle===eThumbStyle.ResizeHover){$mainDiv.mousemove(function(e){var ptMouseX=0;var ptMouseY=0;var fZoom;var nBorderRatio;var $frontThumbDiv;var i;var nThumbCentre;var nRatio;var nImgResize;if(settings.bPageCentred){fZoom=getZoom();nGalleryLeft=settings.nGalleryLeft+((($(document).width()/(fZoom>0.99?fZoom:1))-settings.nPageWidth)/2);}ptMouseX=e.pageX-(nGalleryLeft+nThumbDivLeft);ptMouseY=e.pageY-(settings.nGalleryTop+nThumbDivTop);if(settings.nThumbPosition===eThumbPosition.Horizontal){if(ptMouseX>-1&&ptMouseX<nThumbDivWidth&&ptMouseY>-1&&ptMouseY<(nThumbDivHeight+nThumbHoverBoundary)){nBorderRatio=1;if(ptMouseX<nThumbHoverBoundary){nBorderRatio=1-Math.max(0,((nThumbHoverBoundary-ptMouseX)/nThumbHoverBoundary));}else if(ptMouseX>nThumbDivWidth-nThumbHoverBoundary){nBorderRatio=Math.max(0,((nThumbDivWidth-ptMouseX)/nThumbHoverBoundary));}else if(ptMouseY<nThumbHoverBoundary){nBorderRatio=1-Math.max(0,((nThumbHoverBoundary-ptMouseY)/nThumbHoverBoundary));}else if(ptMouseY>nThumbDivHeight){nBorderRatio=Math.max(0,((nThumbDivHeight+nThumbMinorHoverBoundary-ptMouseY)/nThumbMinorHoverBoundary));}var nSlideX=(ptMouseX-(nThumbDivWidth/2))*0.1*nBorderRatio;$frontThumbDiv=bFirstThumbDiv?$thumb1Div:$thumb2Div;for(i=0;i<settings.nTotalThumbs;++i){nThumbCentre=((i+0.5)*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);var nXOffset=(ptMouseX-nThumbCentre)<0?nThumbCentre-ptMouseX:ptMouseX-nThumbCentre;nRatio=Math.max(0,(150-nXOffset)/150);nImgResize=settings.nThumbSize*nRatio*nBorderRatio;var nImgLeft=(i*(settings.nThumbSize+settings.nThumbSpacing))-(nImgResize/2)+(nThumbDivBoundary/2)-nSlideX;$frontThumbDiv.find('img:eq('+i+')').css({'left':nImgLeft,'width':(settings.nThumbSize+nImgResize),'top':-nImgResize,'height':(settings.nThumbSize+nImgResize)});}bMouseOverThumbs=true;}else if(bMouseOverThumbs){bMouseOverThumbs=false;resetThumbSize(true);}}else
{if(ptMouseX>-nThumbMinorHoverBoundary&&ptMouseX<nThumbDivWidth&&ptMouseY>-1&&ptMouseY<nThumbDivHeight){nBorderRatio=1;if(ptMouseY<nThumbHoverBoundary){nBorderRatio=1-Math.max(0,((nThumbHoverBoundary-ptMouseY)/nThumbHoverBoundary));}else if(ptMouseY>nThumbDivHeight-nThumbHoverBoundary){nBorderRatio=Math.max(0,((nThumbDivHeight-ptMouseY)/nThumbHoverBoundary));}else if(ptMouseX>nThumbDivWidth-nThumbHoverBoundary){nBorderRatio=Math.max(0,((nThumbDivWidth-ptMouseX)/nThumbHoverBoundary));}if(ptMouseX<0){nBorderRatio=Math.max(0,((nThumbMinorHoverBoundary+ptMouseX)/nThumbMinorHoverBoundary));}var nSlideY=(ptMouseY-(nThumbDivHeight/2))*0.1*nBorderRatio;$frontThumbDiv=bFirstThumbDiv?$thumb1Div:$thumb2Div;for(i=0;i<settings.nTotalThumbs;++i){nThumbCentre=((i+0.5)*(settings.nThumbSize+settings.nThumbSpacing))+(nThumbDivBoundary/2);var nYOffset=(ptMouseY-nThumbCentre)<0?nThumbCentre-ptMouseY:ptMouseY-nThumbCentre;nRatio=Math.max(0,(150-nYOffset)/150);nImgResize=settings.nThumbSize*nRatio*nBorderRatio;var nImgTop=(i*(settings.nThumbSize+settings.nThumbSpacing))-(nImgResize/2)+(nThumbDivBoundary/2)-nSlideY;$frontThumbDiv.find('img:eq('+i+')').css({'left':0,'width':(settings.nThumbSize+nImgResize),'top':nImgTop,'height':(settings.nThumbSize+nImgResize)});}bMouseOverThumbs=true;}else if(bMouseOverThumbs){bMouseOverThumbs=false;resetThumbSize(true);}}});}}if(settings.bAutoplay){startTimer();}};})(jQuery);function wp_galleryimage(imgsrc,width,height,thumbSrc,caption){this.wp_image=new Image();this.wp_image.imgsrc=imgsrc;this.wp_image.width=width;this.wp_image.height=height;this.wp_image.thumbSrc=thumbSrc;this.wp_image.caption=caption;}