var NUMTHUMB,firstnum,currnum,preload,urlArray=new Array();
function init(){
NUMTHUMB=document.images.length-1;var URL=top.pGetCurrentURL();parent.setPicWindowLocation(URL);
var pause_time=top.frames[0].getCookie("pausetime")-0;
if(isNaN(pause_time))pause_time=9;
document.forms[0].slideshowpause.value=pause_time;
if(top.frames[0].getCookie("nopop")=="true")document.forms[0].nopop.checked=true;
perhapsUpdateThumbs(URL);
if(top.frames[0].getCookie("embedit")=="true")document.forms[0].embedit.checked=true;
}
function resizeThumbs(w){top.frames[0].setCookie("thumbsize",w);}
function popup(p){if(p){top.frames[0].setCookie("nopop","true");alert("Check this box to turn off NAKEDBROWSER! warnings about 'adding a zero' to the URL.\nREMEMBER: CLICK THE |< BUTTON TWICE to go from 001.jpg to 1.jpg");}else top.frames[0].setCookie("nopop","false");}
function embed(p){if(p){top.frames[0].setCookie("embedit","true");alert("May cause some web browsers to act oddly, but checking this box:\n-disables annoying popup windows & browser redirects\n-allows NAKEDBROWSER! to work with movies");parent.new_poppy.location.href="about:blank";}else top.frames[0].setCookie("embedit","false");}
function updateThumbs(URL){
var i;for(i=0;i<NUMTHUMB;i++){this.document.images[i].src="";this.document.links[i].href="#";urlArray[i]="";}
var a,b,num,r=URL.match(/^(.*\D)(\d+)(.*)/);
if(URL==""||r==null||r.length<3)return;
a=r[1];num=r[2];b=r[3];var numLenWithZero=(""+num).length,numLenNoZero=((num-0)+"").length;firstnum=num-0;currnum=firstnum;
for(var i=0;i<NUMTHUMB+1;i++){
var mynum=i+(num-0),num$=""+mynum;
while(numLenWithZero>num$.length)num$="0"+num$;
var newURL=a+num$+b;
urlArray[i]=newURL;
if(i<NUMTHUMB){this.document.images[i].src=newURL;this.document.links[i].href="javascript:void(thumbClick('"+newURL+"'))";}
else{this.document.images[i].src=newURL;}
}this.document.images[0].border=3;
}
function perhapsUpdateThumbs(URL){
var i,b_update=true;
for(i=0;i<NUMTHUMB;i++){
if(urlArray[i]==URL){currnum=firstnum+i-0;b_update=false;this.document.images[i].border=3;}
else this.document.images[i].border=0;
}
if(b_update)updateThumbs(URL);
}
function thumbClick(URL){top.changeAd();parent.setPicWindowLocation(URL);top.frames[0].setLocationField(URL);}
function slideshow(){
var slideshow_button=document.forms[0].slideshowbutton;
if(slideshow_button.value=="slideshow"){slideshow_button.value="pause";setTimeout("advanceSlideshow()",500);}
else slideshow_button.value="slideshow";
}
function advanceSlideshow(){
if(document.forms[0].slideshowbutton.value=="pause"){
top.frames[0].goToPic(1,false);
var pause_time=document.forms[0].slideshowpause.value-0;
if(isNaN(pause_time)||pause_time<2)pause_time=2;
top.frames[0].setCookie("pausetime",""+pause_time);
setTimeout("advanceSlideshow()",pause_time*1000);
}
}
function thumbGo(n){top.frames[0].goToPic(n*NUMTHUMB-currnum+firstnum,false)}