resDur=0.6;
var ohover=false;
function pause(nm){
var n=new Date();
var et=n.getTime()+nm;
while(true){
n=new Date();
if(n.getTime()>et){
return;
}
}
}
function showimg3(id){
eval(id).iload.showimg3();
}
function setimg(id){
eval(id).iload.setimg();
}
function getphpath(_6,_7){
var _8=false;
var n=_7.lastIndexOf("/");
if(n>=0){
if(_7.indexOf("/i")==0&&_6.cfg.i=="o"){
_8=true;
_7=_7.substring(3);
}else{
_7=_7.substring(n+1);
}
}
phtcid=_6.id;
var _a="";
if(_6.cfg.i!="o"){
_a=phiroot+"/pdir/"+phtcid+"/i/"+_6.imgsize+"-"+_7;
}else{
if(_8){
_a=phiroot+"/"+_7;
}else{
_a=phiroot+"/pdir/"+phtcid+"/"+_7;
}
}
return _a;
}
function showhovnav(id,t){
if(t==true){
new Effect.Appear(id,{duration:0.5,from:0,to:1,queue:"end"});
}else{
new Effect.Appear(id,{duration:0.5,from:1,to:0,queue:"end"});
}
}
function updatenextprev(id,_e,_f,cn,_11){
var _12="";
if(_f>=cn){
_12=_12+"<a id=\"nxpib\" href=\"javascript:"+_e+".jump("+(_f-cn)+")\">Prev</a>";
}
startcn=0;
endcn=_11;
if((_11/cn)>20){
nstart=_f-(10*cn);
nend=1*_f+(10*cn);
if(nstart<0){
nend=cn*20;
nstart=0;
}
if(nend>endcn){
nend=Math.round(endcn/cn)*cn;
nstart=1*nend-(20*cn);
}
startcn=nstart;
endcn=nend;
}
if(_11>cn){
for(i=startcn;i<endcn;i=i+cn){
ct=Math.round(i/cn);
if(i==_f){
_12=_12+"<span id=\"nxpisel\">";
_12=_12+(ct+1);
_12=_12+"</span>";
}else{
_12=_12+"<a id=\"nxpi\" href=\"javascript:"+_e+".jump("+(i)+")\">";
_12=_12+(ct+1)+"</a>";
}
}
}
if(_11>_f+cn){
_12=_12+"<a id=\"nxpib\" href=\"javascript:"+_e+".jump("+(_f+cn)+")\">Next</a>";
}
ndiv=document.getElementById("nextprev"+id);
if(ndiv&&_12.length>0){
ndiv.style.display="block";
ndiv.innerHTML=_12;
}
}
function pilink(id,idx,cfg,img,_17,_18){
var il=cfg.ilink;
if(!il||il==null){
il=0;
}
if(il=="0"){
cellstr="<img border=0 src=\""+_17+"\" "+_18+">";
}
if(il=="2"){
cellstr="<a "+img.pl+");\"><img  border=0 src=\""+_17+"\" "+_18+"></a>";
}
if(il=="1"){
func="javascript:th"+id+".viewdetail("+idx+")";
cellstr="<a href=\""+func+"\"><img border=0 src=\""+_17+"\" "+_18+"></a>";
}
return cellstr;
}
function pgScroll(){
var yS;
if(self.pageYOffset){
yS=self.pageYOffset;
}else{
if(document.documentElement&&document.documentElement.scrollTop){
yS=document.documentElement.scrollTop;
}else{
if(document.body){
yS=document.body.scrollTop;
}
}
}
aPS=new Array("",yS);
return aPS;
}
function photohelperobj(tid,p,c,i){
this.images=p;
this.cfg=c;
this.id=tid;
this.col=0;
this.row=0;
this.html="";
this.imgsize=i;
this.scrollx=0;
this.trot=null;
this.doscroll=true;
this.scrolling=false;
this.popup=true;
this.reset=function(){
this.col=0;
this.html="";
};
this.start=function(){
this.html=this.html+"<table class=\"phgrid\" border=0 cellpadding=0 cellspacing=0>";
};
this.over=function(){
if(this.cfg.pause==true){
this.doscroll=false;
}
};
this.out=function(){
this.doscroll=true;
};
this.slt=function(goe){
if(goe){
this.scrollx=-2;
}else{
this.scrollx=0;
}
this.scroll(false);
};
this.srt=function(goe){
if(goe){
this.scrollx=2;
}else{
this.scrollx=0;
}
this.scroll(false);
};
this.cscroll=function(){
this.scrollx=1;
this.scroll(true);
};
this.scroll=function(st){
if(this.scrollx!=0&&this.doscroll){
ds=$("ppdiv"+this.id);
if(ds&&ds!=null){
sl=ds.scrollLeft;
ds.scrollLeft=ds.scrollLeft+this.scrollx;
if(sl==ds.scrollLeft){
ds.scrollLeft=(ds.scrollLeft/2)-(ds.clientWidth/2)+this.scrollx;
}
}
}
if(st||this.scrolling==false){
window.setTimeout("th"+this.id+".scroll(true)",10*this.cfg.speed);
this.scrolling=true;
}
};
this.add=function(_22){
if(this.col==0){
this.html=this.html+"<tr>";
this.row=this.row+1;
}
if(this.row>this.cfg.rows){
return false;
}
this.html=this.html+"<td valign=\"top\" class=\"gtd\">"+_22+"</td>";
if(this.col==(this.cfg.cols-1)){
this.html=this.html+"</tr>";
this.col=0;
}else{
this.col++;
}
return true;
};
this.jump=function(j){
var i=0;
for(x=j;x<j+(this.cfg.cols*this.cfg.rows);x++){
var p=$("pd-"+this.id+"-"+i);
if(x<this.images.length){
p.style.visibility="visible";
this.showpic(x,i++);
}else{
p.style.visibility="hidden";
i++;
de=$("desc-"+this.id+"-"+i);
if(de&&de!=null){
de.innerHTML="";
}
}
}
updatenextprev(this.id,"th"+this.id,j,this.cfg.rows*this.cfg.cols,this.images.length);
};
this.endtable=function(){
this.html=this.html+"</tr></table>";
updatenextprev(this.id,"th"+this.id,0,this.cfg.rows*this.cfg.cols,this.images.length);
};
this.updatenextprevs=function(){updatenextprev(this.id,"th"+this.id,0,this.cfg.rows*this.cfg.cols,this.images.length)};
this.gethtml=function(){
return this.html;
};
this.closedetail=function(){
var pd=$("photodetailw");
if(pd){
pd.style.display="none";
}
var pd=$("photodetail"+this.id);
pd.style.visibility="hidden";
};
this.viewdetail=function(idx){
var db=document.body;
if(this.popup){
var pd=$("photodetailw");
pd.style.width=db.offsetWidth+"px";
pd.style.height=db.offsetHeight+"0px";
pd.style.visibility="visible";
pd.style.display="block";
}
if(this.popup){
var pd=$("photodetail"+this.id);
pd.style.visibility="visible";
pd.style.width=db.offsetWidth+"px";
ps=pgScroll();
pd.style.top=(ps[1]+50)+"px";
}
if(this.trot){
this.trot.showimg(idx,false);
}
};
this.showpic=function(_2a,idx){
var img=this.images[_2a];
if(img.p.indexOf(".")<0){
return;
}
var di=$("pd2-"+this.id+"-"+idx);
cellstr=pilink(this.id,_2a,this.cfg,img,getphpath(this,img.p)+"?bd="+this.phbid," id=\"img-"+this.id+"-"+idx+"\" ");
di.innerHTML=cellstr;
de=$("desc-"+this.id+"-"+idx);
if(de&&de!=null){
if(this.cfg.desc==true&&img.pd){
de.innerHTML=img.pd;
}else{
de.innerHTML="";
}
}
};
this.swapphotorand=function(){
var idx=(Math.floor(Math.random()*this.cfg.cols));
var _2f=Math.floor(Math.random()*this.images.length);
this.showpic(_2f,idx);
window.setTimeout("th"+this.id+".swapphotorand()",this.cfg.speed*1000);
};
this.dispp=function(img,idx){
if(img.p.indexOf(".")<0){
return;
}
var _32="";
_32=_32+"<div class=\"pd\" id=\"pd-"+this.id+"-"+idx+"\"><table cellpadding=0 cellspacing=0 border=0><tr><td><div class=\"pd1\"><div class=\"pd2\" id=\"pd2-"+this.id+"-"+idx+"\">";
_32=_32+pilink(this.id,idx,this.cfg,img,getphpath(this,img.p)+"?bd="+this.phbid," id=\"img-"+this.id+"-"+idx+"\" ");
_32=_32+"</div></div></td></tr></table>";
if(this.cfg.desc==true){
_32=_32+"<div class=\"phinfo\">";
var pt="";
if(img.pd){
pt=img.pd;
}
_32=_32+"<div id=\"desc-"+this.id+"-"+idx+"\" class=\"phdesc\">"+pt+"</div>";
_32=_32+"</div></div>";
}
this.add(_32);
};
}
function rotatorhelperobj(v,tid,p,c,i){
this.popup=false;
this.varname=v;
this.cfg=c;
this.id=tid;
this.images=p;
this.curidx=0;
this.dorotate=true;
this.imgsize=i;
this.iload=null;
this.phbid=1;
this.viewdetail=function(idx){
var db=document.body;
if(this.popup){
var pd=$("photodetailw");
pd.style.width=db.offsetWidth+"px";
pd.style.height=db.offsetHeight+"0px";
pd.style.visibility="visible";
pd.style.display="block";
}
if(this.popup){
var pd=$("photodetail"+this.id);
pd.style.visibility="visible";
pd.style.width=db.offsetWidth+"px";
ps=pgScroll();
pd.style.top=(ps[1]+50)+"px";
}
if(this.trot){
this.trot.showimg(idx,false);
}
};
this.findPos=function(obj){
var _3d=curtop=0;
if(obj.offsetParent){
_3d=obj.offsetLeft;
curtop=obj.offsetTop;
while(obj=obj.offsetParent){
_3d+=obj.offsetLeft;
curtop+=obj.offsetTop;
}
}
return [_3d,curtop];
};
this.alignnextprev=function(){
if(this.cfg.nextprev!=0){
document.getElementById("thumbarr-"+this.id+"-left").style.display="block";
document.getElementById("thumbarr-"+this.id+"-right").style.display="block";
document.getElementById("pd2i-"+this.id+"-r").style.display="block";
}
return;
if(this.popup){
prot=this.findPos($("img-"+this.id+"-r"));
var ph=$("pdprev"+this.id);
var _3f=0;
var _40=0;
ph.style.position="absolute";
ph.style.top=(-_40)+"px";
ph.style.left=(-_3f)+"px";
var ph=$("pdnext"+this.id);
ph.style.position="absolute";
ph.style.top=(-_40)+"px";
ph.style.left=(_3f+$("img-"+this.id+"-r").clientWidth-ph.clientWidth-4)+"px";
}else{
prot=this.findPos($("img-"+this.id+"-r"));
var ph=$("pdprev"+this.id);
var _3f=20;
var _40=10;
ph.style.position="absolute";
ph.style.top=(prot[1]-_40)+"px";
ph.style.left=(prot[0]-_3f)+"px";
var ph=$("pdnext"+this.id);
ph.style.position="absolute";
ph.style.top=(prot[1]-_40)+"px";
ph.style.left=(_3f+prot[0]+$("img-"+this.id+"-r").clientWidth-ph.clientWidth-4)+"px";
}
};
this.start=function(){
this.showimg(this.curidx,true);
if(this.cfg.speed&&this.cfg.speed!=0){
window.setTimeout(this.varname+".anext()",this.cfg.speed*1000);
}
};
this.anext=function(){
if(this.cfg.speed && this.cfg.speed!=0)
{if(this.curidx>=this.images.length-1)
   this.curidx=-1;
this.rnext();
window.setTimeout(this.varname+".anext()",this.cfg.speed*1000);
}}
this.next=function(){this.cfg.speed=0;this.rnext();}
this.rnext=function(){
this.curidx++;
if(this.curidx>=this.images.length){
this.curidx=0;
}
this.showimg(this.curidx,false);
};
this.prev=function(){
this.cfg.speed=0;
this.curidx--;
if(this.curidx<0){
this.curidx=this.images.length-1;
}
this.showimg(this.curidx,false);
};
this.showimg=function(idx,_42){
this.curidx=idx;
var img=this.images[idx];
if(img==null||img.p.indexOf(".")<0){
return;
}
if(this.cfg.ct==true){
ctd=document.getElementById("ct-"+this.id+"-r");
if(ctd&&ctd!=null){
ctd.style.display="block";
var xyz=(idx*1+1)+"/"+this.images.length;
ctd.innerHTML=" "+xyz+" ";
}
}
var _45=img.p;
var n=_45.lastIndexOf("/");
if(n>0){
_45=_45.substring(n+1);
}
iload=new picloader(this,this.imgsize,idx,"r",this.cfg);
this.iload=iload;
iload.showimg(idx,_42);
};
}
function picloader(h,s,pix,x,c){
this.helper=h;
this.dividx=x;
this.imgsize=s;
this.iload=null;
this.id=this.helper.id;
this.idx=0;
this.pidx=pix;
this.wc=0;
this.hc=0;
this.cfg=c;
this.cfg=c;
this.iload=null;
this.bks=null;
this.showimg3=function(){
if(this.iload.complete==false){
window.setTimeout(this.helper.varname+".iload.showimg3()",30);
return;
}
var _4c=$("tspc-"+this.helper.id+"-"+this.dividx);
var _4d=$("img-"+this.helper.id+"-"+this.dividx);
this.bks=_4d.src;
if(_4d&&_4d!=null){
_4c.style.backgroundImage="url("+this.bks+")";
}
var td=$("tdiv-"+this.id+"-"+this.dividx);
if(td!=null){
td.style.visibility="hidden";
}
this.wc=td.offsetWidth;
this.hc=td.offsetHeight;
this.pcon=_4c;
window.setTimeout(this.helper.varname+".iload.showimg4()",500);
};
this.showimg4=function(){
this.sizepic();
};
this.showimg=function(idx,_50){
pi=$("pd2i-"+this.helper.id+"-r");
if(pi&&pi!=null){
pi.style.visibility="visible";
}
var img=this.helper.images[idx];
if(img.p.indexOf(".")<0){
return;
}
var id=this.helper.varname;
this.iload=new Image();
this.iload.onload=function(){
showimg3(id);
};
this.iload.src=getphpath(this,img.p)+"?ab="+this.helper.phbid;
};
this.setimg=function(){
var img=this.helper.images[this.pidx];
if(img.p.indexOf(".")<0){
return;
}
tx="tdiv-"+this.id+"-"+this.dividx;
var _54="<div id=\""+tx+"\" style=\"opacity:.0;filter:alpha(opacity=0)\">"+pilink(this.helper.id,this.pidx,this.helper.cfg,img,getphpath(this,img.p)+"?ab="+this.helper.phbid,"id=\"img-"+this.id+"-"+this.dividx+"\"")+"</div>";
$("tspc-"+this.id+"-"+this.dividx).innerHTML=_54;
new Effect.Appear(tx,{duration:1,from:0,to:1,queue:"end"});
pi=$("pd2i-"+this.helper.id+"-r");
if(pi&&pi!=null){
pi.style.visibility="hidden";
}
};
this.sizepic=function(){
pc=this.pcon;
this.wc=pc.offsetWidth;
this.hc=pc.offsetHeight;
this.xs=((this.iload.width)/this.wc)*100;
this.ys=((this.iload.height)/this.hc)*100;
wd=(this.wc)-this.iload.width;
hd=(this.hc)-this.iload.height;
var id=this.helper.varname;
var cid="tspc-"+this.id+"-"+this.dividx;
if(hd==0&&wd==0){
this.setimg();
pause(250);
}else{
var exw="";
var exh="";
if(wd!=0){
exw="";
}
if(!(hd==0)){
if(wd==0){
new Effect.Scale(cid,this.ys,{scaleX:false,duration:resDur,queue:"front",afterFinish:function(){
setimg(id);
}});
}else{
new Effect.Scale(cid,this.ys,{scaleX:false,duration:resDur,queue:"front"});
}
}
if(!(wd==0)){
new Effect.Scale(cid,this.xs,{scaleY:false,delay:resDur,duration:resDur,afterFinish:function(){
setimg(id);
}});
}
}
};
}

