function addEvent(_1,_2,_3){
if(_1.addEventListener){
_1.addEventListener(_2,_3,false);
}else{
if(_1.attachEvent){
_1.attachEvent(["on",_2].join(""),_3);
}else{
_1[["on",_2].join("")]=_3;
}
}
}
function WindowSize(){
this.w=0;
this.h=0;
return this.update();
}
WindowSize.prototype.update=function(){
var d=document;
this.w=(window.innerWidth)?window.innerWidth:(d.documentElement&&d.documentElement.clientWidth)?d.documentElement.clientWidth:d.body.clientWidth;
this.h=(window.innerHeight)?window.innerHeight:(d.documentElement&&d.documentElement.clientHeight)?d.documentElement.clientHeight:d.body.clientHeight;
return this;
};
function PageSize(){
this.win=new WindowSize();
this.w=0;
this.h=0;
return this.update();
}
PageSize.prototype.update=function(){
var d=document;
this.w=(window.innerWidth&&window.scrollMaxX)?window.innerWidth+window.scrollMaxX:(d.body.scrollWidth>d.body.offsetWidth)?d.body.scrollWidth:d.body.offsetWidt;
this.h=(window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:(d.body.scrollHeight>d.body.offsetHeight)?d.body.scrollHeight:d.body.offsetHeight;
this.win.update();
if(this.w<this.win.w){
this.w=this.win.w;
}
if(this.h<this.win.h){
this.h=this.win.h;
}
return this;
};
function PagePos(){
this.x=0;
this.y=0;
return this.update();
}
PagePos.prototype.update=function(){
var d=document;
this.x=(window.pageXOffset)?window.pageXOffset:(d.documentElement&&d.documentElement.scrollLeft)?d.documentElement.scrollLeft:(d.body)?d.body.scrollLeft:0;
this.y=(window.pageYOffset)?window.pageYOffset:(d.documentElement&&d.documentElement.scrollTop)?d.documentElement.scrollTop:(d.body)?d.body.scrollTop:0;
return this;
};
function UserAgent(){
var ua=navigator.userAgent;
this.isWinIE=this.isMacIE=false;
this.isGecko=ua.match(/Gecko\//);
this.isSafari=ua.match(/AppleWebKit/);
this.isOpera=window.opera;
if(document.all&&!this.isGecko&&!this.isSafari&&!this.isOpera){
this.isWinIE=ua.match(/Win/);
this.isMacIE=ua.match(/Mac/);
this.isNewIE=(ua.match(/MSIE 5\.5/)||ua.match(/MSIE 6\.0/));
}
return this;
}
function LightBox(_8){
var _9=this;
_9._imgs=new Array();
_9._wrap=null;
_9._box=null;
_9._open=-1;
_9._page=new PageSize();
_9._pos=new PagePos();
_9._ua=new UserAgent();
_9._expandable=false;
_9._expanded=false;
_9._expand=_8.expandimg;
_9._shrink=_8.shrinkimg;
return _9._init(_8);
}
LightBox.prototype={_init:function(_a){
var _b=this;
var d=document;
if(!d.getElementsByTagName){
return;
}
var _d=d.getElementsByTagName("a");
for(var i=0;i<_d.length;i++){
var _f=_d[i];
var num=_b._imgs.length;
if(!_f.getAttribute("href")||_f.getAttribute("rel")!="lightbox"){
continue;
}
_b._imgs[num]={src:_f.getAttribute("href"),w:-1,h:-1,title:"",cls:_f.className};
if(_f.getAttribute("title")){
_b._imgs[num].title=_f.getAttribute("title");
}else{
if(_f.firstChild&&_f.firstChild.getAttribute&&_f.firstChild.getAttribute("title")){
_b._imgs[num].title=_f.firstChild.getAttribute("title");
}
}
_f.onclick=_b._genOpener(num);
}
var _11=d.getElementsByTagName("body")[0];
_b._wrap=_b._createWrapOn(_11,_a.loadingimg);
_b._box=_b._createBoxOn(_11,_a);
return _b;
},_genOpener:function(num){
var _13=this;
return function(){
_13._show(num);
return false;
};
},_createWrapOn:function(obj,_15){
var _16=this;
if(!obj){
return null;
}
var _17=document.createElement("div");
_17.id="overlay";
with(_17.style){
display="none";
position="fixed";
top="0px";
left="0px";
zIndex="50";
width="100%";
height="100%";
}
if(_16._ua.isWinIE){
_17.style.position="absolute";
}
addEvent(_17,"click",function(){
_16._close();
});
obj.appendChild(_17);
var _18=new Image;
_18.onload=function(){
var _19=document.createElement("img");
_19.id="loadingImage";
_19.src=_18.src;
_19.style.position="relative";
_16._set_cursor(_19);
addEvent(_19,"click",function(){
_16._close();
});
_17.appendChild(_19);
_18.onload=function(){
};
};
if(_15!=""){
_18.src=_15;
}
return _17;
},_createBoxOn:function(obj,_1b){
var _1c=this;
if(!obj){
return null;
}
var box=document.createElement("div");
box.id="lightbox";
with(box.style){
display="none";
position="absolute";
zIndex="60";
}
obj.appendChild(box);
var img=document.createElement("img");
img.id="lightboxImage";
_1c._set_cursor(img);
addEvent(img,"click",function(){
_1c._close();
});
addEvent(img,"mouseover",function(){
_1c._show_action();
});
addEvent(img,"mouseout",function(){
_1c._hide_action();
});
box.appendChild(img);
var _1f=document.createElement("img");
_1f.id="actionImage";
with(_1f.style){
display="none";
position="absolute";
top="15px";
left="15px";
zIndex="70";
}
_1c._set_cursor(_1f);
_1f.src=_1c._expand;
addEvent(_1f,"mouseover",function(){
_1c._show_action();
});
addEvent(_1f,"click",function(){
_1c._zoom();
});
box.appendChild(_1f);
addEvent(window,"resize",function(){
_1c._set_size(true);
});
if(_1b.closeimg){
var btn=document.createElement("img");
btn.id="closeButton";
with(btn.style){
display="inline";
position="absolute";
right="10px";
top="10px";
zIndex="80";
}
btn.src=_1b.closeimg;
_1c._set_cursor(btn);
addEvent(btn,"click",function(){
_1c._close();
});
box.appendChild(btn);
}
var _21=document.createElement("span");
_21.id="lightboxCaption";
with(_21.style){
display="none";
position="absolute";
zIndex="80";
}
box.appendChild(_21);
if(!_1b.effectpos){
_1b.effectpos={x:0,y:0};
}else{
if(_1b.effectpos.x==""){
_1b.effectpos.x=0;
}
if(_1b.effectpos.y==""){
_1b.effectpos.y=0;
}
}
var _22=new Image;
_22.onload=function(){
var _23=document.createElement("img");
_23.id="effectImage";
_23.src=_22.src;
if(_1b.effectclass){
_23.className=_1b.effectclass;
}
with(_23.style){
position="absolute";
display="none";
left=[_1b.effectpos.x,"px"].join("");
top=[_1b.effectpos.y,"px"].join("");
zIndex="90";
}
_1c._set_cursor(_23);
addEvent(_23,"click",function(){
_23.style.display="none";
});
box.appendChild(_23);
};
if(_1b.effectimg!=""){
_22.src=_1b.effectimg;
}
return box;
},_set_photo_size:function(){
var _24=this;
if(_24._open==-1){
return;
}
var _25=_24._box.firstChild;
var _26={w:_24._page.win.w-30,h:_24._page.win.h-30};
var _27={w:_24._imgs[_24._open].w,h:_24._imgs[_24._open].h};
var _28=1;
if((_27.w>=_26.w||_27.h>=_26.h)&&_27.h&&_27.w){
_28=((_26.w/_27.w)<(_26.h/_27.h))?_26.w/_27.w:_26.h/_27.h;
}
_25.width=Math.floor(_27.w*_28);
_25.height=Math.floor(_27.h*_28);
_24._expandable=(_28<1)?true:false;
if(_24._ua.isWinIE){
_24._box.style.display="block";
}
_24._box.style.top=[_24._pos.y+(_24._page.win.h-_25.height-30)/2,"px"].join("");
_24._box.style.left=[((_24._page.win.w-_25.width-30)/2),"px"].join("");
_24._show_caption(true);
},_set_size:function(_29){
var _2a=this;
if(_2a._open==-1){
return;
}
_2a._page.update();
_2a._pos.update();
var _2b=_2a._wrap.firstChild;
if(_2b){
var top=(_2a._page.win.h-_2b.height)/2;
if(_2a._wrap.style.position=="absolute"){
top+=_2a._pos.y;
}
_2b.style.top=[top,"px"].join("");
_2b.style.left=[(_2a._page.win.w-_2b.width-30)/2,"px"].join("");
}
if(_2a._ua.isWinIE){
_2a._wrap.style.width=[_2a._page.win.w,"px"].join("");
_2a._wrap.style.height=[_2a._page.h,"px"].join("");
}
if(_29){
_2a._set_photo_size();
}
},_show_action:function(){
var _2d=this;
if(_2d._open==-1||!_2d._expandable){
return;
}
var obj=document.getElementById("actionImage");
if(!obj){
return;
}
obj.src=(_2d._expanded)?_2d._shrink:_2d._expand;
obj.style.display="inline";
},_hide_action:function(){
var _2f=this;
var obj=document.getElementById("actionImage");
if(obj){
obj.style.display="none";
}
},_zoom:function(){
var _31=this;
if(_31._expanded){
_31._set_photo_size();
_31._expanded=false;
}else{
if(_31._open>-1){
var _32=_31._box.firstChild;
_31._box.style.top=[_31._pos.y,"px"].join("");
_31._box.style.left="0px";
_32.width=_31._imgs[_31._open].w;
_32.height=_31._imgs[_31._open].h;
_31._show_caption(false);
_31._expanded=true;
}
}
_31._show_action();
},_show_caption:function(_33){
var _34=this;
var _35=document.getElementById("lightboxCaption");
if(!_35){
return;
}
if(_35.innerHTML.length==0||!_33){
_35.style.display="none";
}else{
var _36=_34._box.firstChild;
with(_35.style){
top=[_36.height+10,"px"].join("");
left="0px";
width=[_36.width+20,"px"].join("");
height="1.2em";
display="block";
}
}
},_show:function(num){
var _38=this;
var _39=new Image;
if(num<0||num>=_38._imgs.length){
return;
}
var _3a=document.getElementById("loadingImage");
var _3b=document.getElementById("lightboxCaption");
var _3c=document.getElementById("effectImage");
_38._open=num;
_38._set_size(false);
_38._wrap.style.display="block";
if(_3a){
_3a.style.display="inline";
}
_39.onload=function(){
if(_38._imgs[_38._open].w==-1){
_38._imgs[_38._open].w=_39.width;
_38._imgs[_38._open].h=_39.height;
}
if(_3c){
_3c.style.display=(!_3c.className||_38._imgs[_38._open].cls==_3c.className)?"block":"none";
}
if(_3b){
_3b.innerHTML=_38._imgs[_38._open].title;
}
_38._set_photo_size();
_38._hide_action();
_38._box.style.display="block";
_38._box.firstChild.src=_39.src;
_38._box.firstChild.setAttribute("title",_38._imgs[_38._open].title);
if(_3a){
_3a.style.display="none";
}
};
_38._expandable=false;
_38._expanded=false;
_39.src=_38._imgs[_38._open].src;
},_set_cursor:function(obj){
var _3e=this;
if(_3e._ua.isWinIE&&!_3e._ua.isNewIE){
return;
}
obj.style.cursor="pointer";
},_close:function(){
var _3f=this;
_3f._open=-1;
_3f._hide_action();
_3f._wrap.style.display="none";
_3f._box.style.display="none";
}};
addEvent(window,"load",function(){
var _40=new LightBox({loadingimg:"/img/loading2.gif",expandimg:"expand.gif",shrinkimg:"shrink.gif",effectimg:"zzoop.gif",effectpos:{x:-40,y:-20},effectclass:"effectable",closeimg:"/img/close.gif"});
});


