var currentpos=0;var currentthumbpos=0;var moveamount=106;var thumbnailnum;var maxthumbvisible=5;var current_imgid=0;var moving=false;var finishedsizing=0;var preloadimg="no";var myloadedimage=new Array();myloadedimage[0]=1;var imggallery=new Array();var firstimagestart=1;var nextorprev=0;var fadeout=1;var thumbScroll=0;var firstimagewidth=0;var firstimageheight=0;if(Number(Prototype.Version.substring(0,3))<1.6){Object.extend(Element,{getWidth:function(a){a=$(a);return a.offsetWidth},getHeight:function(a){a=$(a);return a.offsetHeight}})}function modifyimage(b,g,e,a,f){if(current_imgid!=e){var h=document.getElementById(b);var c=document.getElementById("photocount");var d=g*moveamount;dw_scrollObj.scrollTo("thumb_container",d,0);h.innerHTML=returnimgcode(imggallery[g],a,f);c.innerHTML=(Number(g)+1)+" of "+imggallery.length+" Photos";initImage(b);revealThumbnail(e);current_imgid=e;myloadedimage[g]=1}}function returnimgcode(b,a,c){var d="";if(b[1]!=""){d=""}d+='<img id="theimg" src="'+b[0]+'" border="0" id="'+b[8]+'" width="'+c+'" height="'+a+'" />';if(b[1]!=""){d+=""}return d}function initImage(a){new Effect.Appear(a,{duration:transspeed});new Effect.Appear("imgtitle",{duration:transspeed})}function checkbutton(a){if(a==0){mm_shl("back","hidden");mm_shl("more","visible");stopthumbs()}else{if(a<thumbnailnum-maxthumbvisible){mm_shl("back","visible");mm_shl("more","visible")}else{mm_shl("back","visible");mm_shl("more","hidden");stopthumbs()}}}function checknext(a){thumbmax=(Number(thumbnailnum)-1);if(a<1){mm_shl("prev","hidden");mm_display("prevNav","none");mm_shl("next","visible");mm_display("nextNav","inline")}else{if(a<thumbmax){mm_shl("prev","visible");mm_display("prevNav","inline");mm_shl("next","visible");mm_display("nextNav","inline")}else{mm_shl("prev","visible");mm_display("prevNav","inline");mm_shl("next","hidden");mm_display("nextNav","none")}}}function mm_shl(){var b,a=arguments;if((b=MM_findObj(a[0]))!=null){if(b.style){b=b.style}b.visibility=a[1]}}function mm_display(){var b,a=arguments;if((b=MM_findObj(a[0]))!=null){if(b.style){b=b.style}b.display=a[1]}}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function MM_openBrWindow(c,a,b){window.open(c,a,b)}var thumbopen=0;function thumbs(){new Effect.toggle($("thumbhide"),"blind")}function initGallery(a,d,e,c,b){var g="";var f=this;imggallery=a;if(preloadimg=="yes"){for(x=0;x<imggallery.length;x++){g="myimage"+x;f[g]=new Image();f[g].id=g;f[g].src=imggallery[x][0]}}thumbnailnum=imggallery.length;current_imgid=e;currentwidth=c;currentheight=b}function getstarted(f,a,b,e,c,h,g,d){f=Number(f);a=Number(a);e=Number(e);c=Number(c);h=Number(h);g=Number(g);d=Number(d);checknext(c);if(h!=c){if(firstimagestart==1){currentwidth=firstimagewidth;currentheight=firstimageheight;firstimagestart=0}if(nextorprev==1){currentwidth=g;currentheight=d;nextorprev=0}CacheAndResize(imggallery[e][0],b,e,c)}}function directnav(f,a,b,e,c,h,g,d){if(h!=c){hideThumbnail(h);new Effect.Fade("imgtitle",{duration:fadespeed});new Effect.Fade("imgloader",{duration:fadespeed,afterFinish:function(){getstarted(f,a,b,e,c,h,g,d)}})}}function resizeImageContainer(a,i,b,e){var g=a.width;var h=a.height;var j=0;var d=0;var f=0;var c=0;if(g>maxImageWidth){j=g-maxImageWidth;f=j/g;c=h*f;d=h-c;g=maxImageWidth;h=d}this.wCur=Element.getWidth("main_image_wrapper");this.hCur=Element.getHeight("main_image_wrapper");this.xScale=((g+(borderSize*2))/this.wCur)*100;this.yScale=((h+(borderSize*2))/this.hCur)*100;wDiff=(this.wCur-borderSize*2)-g;hDiff=(this.hCur-borderSize*2)-h;if(!(hDiff==0)){new Effect.Scale("main_image_wrapper",this.yScale,{scaleX:false,duration:resizeDuration,queue:"front"})}if(!(wDiff==0)){new Effect.Scale("main_image_wrapper",this.xScale,{scaleY:false,delay:resizeDuration,duration:resizeDuration,afterFinish:function(k){modifyimage(i,b,e,h,g);loadtitle(e)}})}else{modifyimage(i,b,e,h,g);loadtitle(e)}}function loadfirstimage(){var a=new Image();revealThumbnail(0);a.src=null;a.src=imggallery[0][0];mm_display("prevNav","none");$("imgtitle").innerHTML="<strong>"+tempgallery[0][4]+"</strong> "+tempgallery[0][7];CacheAndResize(imggallery[0][0],"imgloader",0,0,"start")}function loadphotocount(){var a=document.getElementById("photocount");a.innerHTML=(Number(current_imgid)+1)+" of "+imggallery.length+" Photos"}function loadtitle(a){$("imgtitle").innerHTML="<strong>"+tempgallery[a][4]+"</strong> "+tempgallery[a][7];new Effect.Appear("imgtitle",{duration:transspeed})}function nextimage(a){newimgid=Number(a)+1;if(newimgid==imggallery.length-1){slideshow_action="stop"}newwidth=imggallery[newimgid][1];newheight=imggallery[newimgid][2];newimgindex=imggallery[newimgid][8];newimgid=imggallery[newimgid][8];cwidth=imggallery[a][1];cheight=imggallery[a][2];checknext(newimgid);nextorprev=1;directnav(Number(newwidth),Number(newheight),"imgloader",Number(newimgindex),Number(newimgid),Number(a),Number(cwidth),Number(cheight))}function previmage(a){newimgid=Number(a)-1;newwidth=imggallery[newimgid][1];newheight=imggallery[newimgid][2];newimgindex=imggallery[newimgid][8];newimgid=imggallery[newimgid][8];cwidth=imggallery[a][1];cheight=imggallery[a][2];checknext(newimgid);nextorprev=1;directnav(Number(newwidth),Number(newheight),"imgloader",Number(newimgindex),Number(newimgid),Number(a),Number(cwidth),Number(cheight))}function revealThumbnail(a){var b="thumbimg_"+a;$(b).style.border="2px solid #D40F44"}function hideThumbnail(a){var b="thumbimg_"+a;$(b).style.border=""}var firstload=1;var slideshow_action="start";var hard_stop=0;function slideshow(){if(hard_stop==1){slideshow_action="stop"}if(imggallery.length==1){hard_stop=1;slideshow_action="stop"}else{if(slideshow_action=="start"){if(current_imgid==imggallery.length-1){dw_scrollObj.scrollTo("thumb_container",0,0);firstload=1;hideThumbnail(current_imgid);initGallery(tempgallery,tempgallery.length,tempgallery[0][8],tempgallery[0][1],tempgallery[0][2]);if(imggallery.length>1){mm_display("nextNav","inline")}loadphotocount();loadfirstimage()}if(firstload!=1){nextimage(current_imgid)}else{firstload=0}document.getElementById("slideShowControl").innerHTML="<a href='javascript:stopMySlideShow();' class='nextprev_buttons'>PAUSE</a> <a href='javascript:stopMySlideShow();' class='nextprev_buttons'><img src='"+imageurl+"pause.gif' border='0' class='toolTips' title='Stop slideshow'></a>";if(current_imgid==imggallery.length-2){setTimeout("slideshow()",250);current_imgid=tempgallery[0][8]}else{setTimeout("slideshow()",6000)}}else{document.getElementById("slideShowControl").innerHTML="<a href='javascript:startMySlideShow();' class='nextprev_buttons'>PLAY</a> <a href='javascript:startMySlideShow();' class='nextprev_buttons'><img src='"+imageurl+"play.gif' border='0' class='toolTips' title='Start slideshow'></a>"}}}function startMySlideShow(){if(current_imgid==imggallery.length-1){dw_scrollObj.scrollTo("thumb_container",0,0);firstload=1;hideThumbnail(current_imgid);initGallery(tempgallery,tempgallery.length,tempgallery[0][8],tempgallery[0][1],tempgallery[0][2]);if(imggallery.length>1){mm_display("nextNav","inline")}loadphotocount();loadfirstimage()}slideshow_action="start";hard_stop=0;slideshow()}function stopMySlideShow(){slideshow_action="stop";hard_stop=1}function CacheAndResize(a,g,d,f,b){var c=document.createElement("img");var e=c.width;var i=50;var h=0;c.src=a;setTimeout(function(){if(h>=i){return}if(c.width==e){h=h+1;setTimeout(arguments.callee,10);return}if(b=="start"){if(c.width>maxImageWidth){variantWidth=c.width-maxImageWidth;variantPct=variantWidth/c.width;tmp=c.height*variantPct;variantHeight=c.height-tmp;variant=1;imgWidth=maxImageWidth;imgHeight=variantHeight}else{variant=0;imgWidth=c.width;imgHeight=c.height}$("imgloader").innerHTML=returnimgcode(imggallery[0],imgHeight,imgWidth);$("main_image_wrapper").setStyle({width:imgWidth+"px",height:imgHeight+"px"})}currentheight=c.height;currentwidth=c.width;resizeImageContainer(c,g,d,f)},10)}function jigglyPuff(b){var a=tempgallery.length*moveamount;if(b=="start"){dw_scrollObj.scrollTo("thumb_container",0,0)}else{dw_scrollObj.scrollTo("thumb_container",a,0)}};