function Animator(options){this.setOptions(options);var _this=this;this.timerDelegate=function(){_this.onTimerEvent()};this.subjects=[];this.target=0;this.state=0;this.lastTime=null;};Animator.prototype={setOptions:function(options){this.options=Animator.applyDefaults({interval:20,duration:400,onComplete:function(){},onStep:function(){},transition:Animator.tx.easeInOut},options);},seekTo:function(to){this.seekFromTo(this.state,to);},seekFromTo:function(from,to){this.target=Math.max(0,Math.min(1,to));this.state=Math.max(0,Math.min(1,from));this.lastTime=new Date().getTime();if(!this.intervalId){this.intervalId=window.setInterval(this.timerDelegate,this.options.interval);}},jumpTo:function(to){this.target=this.state=Math.max(0,Math.min(1,to));this.propagate();},toggle:function(){this.seekTo(1-this.target);},addSubject:function(subject){this.subjects[this.subjects.length]=subject;return this;},clearSubjects:function(){this.subjects=[];},propagate:function(){var value=this.options.transition(this.state);for(var i=0;i<this.subjects.length;i++){if(this.subjects[i].setState){this.subjects[i].setState(value);}else{this.subjects[i](value);}}},onTimerEvent:function(){var now=new Date().getTime();var timePassed=now-this.lastTime;this.lastTime=now;var movement=(timePassed/this.options.duration)*(this.state<this.target?1:-1);if(Math.abs(movement)>=Math.abs(this.state-this.target)){this.state=this.target;}else{this.state+=movement;}
try{this.propagate();}finally{this.options.onStep.call(this);if(this.target==this.state){window.clearInterval(this.intervalId);this.intervalId=null;this.options.onComplete.call(this);}}},play:function(){this.seekFromTo(0,1)},reverse:function(){this.seekFromTo(1,0)},inspect:function(){var str="#<Animator:\n";for(var i=0;i<this.subjects.length;i++){str+=this.subjects[i].inspect();}
str+=">";return str;}}
Animator.applyDefaults=function(defaults,prefs){prefs=prefs||{};var prop,result={};for(prop in defaults)result[prop]=prefs[prop]!==undefined?prefs[prop]:defaults[prop];return result;}
Animator.makeArray=function(o){if(o==null)return[];if(!o.length)return[o];var result=[];for(var i=0;i<o.length;i++)result[i]=o[i];return result;}
Animator.camelize=function(string){var oStringList=string.split('-');if(oStringList.length==1)return oStringList[0];var camelizedString=string.indexOf('-')==0?oStringList[0].charAt(0).toUpperCase()+oStringList[0].substring(1):oStringList[0];for(var i=1,len=oStringList.length;i<len;i++){var s=oStringList[i];camelizedString+=s.charAt(0).toUpperCase()+s.substring(1);}
return camelizedString;}
Animator.apply=function(el,style,options){if(style instanceof Array){return new Animator(options).addSubject(new CSSStyleSubject(el,style[0],style[1]));}
return new Animator(options).addSubject(new CSSStyleSubject(el,style));}
Animator.makeEaseIn=function(a){return function(state){return Math.pow(state,a*2);}}
Animator.makeEaseOut=function(a){return function(state){return 1-Math.pow(1-state,a*2);}}
Animator.makeElastic=function(bounces){return function(state){state=Animator.tx.easeInOut(state);return((1-Math.cos(state*Math.PI*bounces))*(1-state))+state;}}
Animator.makeADSR=function(attackEnd,decayEnd,sustainEnd,sustainLevel){if(sustainLevel==null)sustainLevel=0.5;return function(state){if(state<attackEnd){return state/attackEnd;}
if(state<decayEnd){return 1-((state-attackEnd)/(decayEnd-attackEnd)*(1-sustainLevel));}
if(state<sustainEnd){return sustainLevel;}
return sustainLevel*(1-((state-sustainEnd)/(1-sustainEnd)));}}
Animator.makeBounce=function(bounces){var fn=Animator.makeElastic(bounces);return function(state){state=fn(state);return state<=1?state:2-state;}}
Animator.tx={easeInOut:function(pos){return((-Math.cos(pos*Math.PI)/2)+0.5);},linear:function(x){return x;},easeIn:Animator.makeEaseIn(1.5),easeOut:Animator.makeEaseOut(1.5),strongEaseIn:Animator.makeEaseIn(2.5),strongEaseOut:Animator.makeEaseOut(2.5),elastic:Animator.makeElastic(1),veryElastic:Animator.makeElastic(3),bouncy:Animator.makeBounce(1),veryBouncy:Animator.makeBounce(3)}
function NumericalStyleSubject(els,property,from,to,units){this.els=Animator.makeArray(els);if(property=='opacity'&&window.ActiveXObject){this.property='filter';}else{this.property=Animator.camelize(property);}
try{var isIE9=(navigator.userAgent.match(/\bMSIE\b/)&&(document.documentMode==9));if(isIE9){this.property=Animator.camelize(property);}}catch(e){}
this.from=parseFloat(from);this.to=parseFloat(to);this.units=units!=null?units:'px';}
NumericalStyleSubject.prototype={setState:function(state){var style=this.getStyle(state);var visibility=(this.property=='opacity'&&state==0)?'hidden':'';var j=0;for(var i=0;i<this.els.length;i++){try{this.els[i].style[this.property]=style;}catch(e){if(this.property!='fontWeight')throw e;}
if(j++>20)return;}},getStyle:function(state){state=this.from+((this.to-this.from)*state);if(this.property=='filter')return"alpha(opacity="+Math.round(state*100)+")";if(this.property=='opacity')return state;return Math.round(state)+this.units;},inspect:function(){return"\t"+this.property+"("+this.from+this.units+" to "+this.to+this.units+")\n";}}
function ColorStyleSubject(els,property,from,to){this.els=Animator.makeArray(els);this.property=Animator.camelize(property);this.to=this.expandColor(to);this.from=this.expandColor(from);this.origFrom=from;this.origTo=to;}
ColorStyleSubject.prototype={expandColor:function(color){var hexColor,red,green,blue;hexColor=ColorStyleSubject.parseColor(color);if(hexColor){red=parseInt(hexColor.slice(1,3),16);green=parseInt(hexColor.slice(3,5),16);blue=parseInt(hexColor.slice(5,7),16);return[red,green,blue]}
if(window.DEBUG){alert(ICaltgopub.pa_txt1+color+"' ");}},getValueForState:function(color,state){return Math.round(this.from[color]+((this.to[color]-this.from[color])*state));},setState:function(state){var color='#'+ColorStyleSubject.toColorPart(this.getValueForState(0,state))+ColorStyleSubject.toColorPart(this.getValueForState(1,state))+ColorStyleSubject.toColorPart(this.getValueForState(2,state));for(var i=0;i<this.els.length;i++){this.els[i].style[this.property]=color;}},inspect:function(){return"\t"+this.property+"("+this.origFrom+" to "+this.origTo+")\n";}}
ColorStyleSubject.parseColor=function(string){var color='#',match;if(match=ColorStyleSubject.parseColor.rgbRe.exec(string)){var part;for(var i=1;i<=3;i++){part=Math.max(0,Math.min(255,parseInt(match[i])));color+=ColorStyleSubject.toColorPart(part);}
return color;}
if(match=ColorStyleSubject.parseColor.hexRe.exec(string)){if(match[1].length==3){for(var i=0;i<3;i++){color+=match[1].charAt(i)+match[1].charAt(i);}
return color;}
return'#'+match[1];}
return false;}
ColorStyleSubject.toColorPart=function(number){if(number>255)number=255;var digits=number.toString(16);if(number<16)return'0'+digits;return digits;}
ColorStyleSubject.parseColor.rgbRe=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;ColorStyleSubject.parseColor.hexRe=/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function DiscreteStyleSubject(els,property,from,to,threshold){this.els=Animator.makeArray(els);this.property=Animator.camelize(property);this.from=from;this.to=to;this.threshold=threshold||0.5;}
DiscreteStyleSubject.prototype={setState:function(state){var j=0;for(var i=0;i<this.els.length;i++){this.els[i].style[this.property]=state<=this.threshold?this.from:this.to;}},inspect:function(){return"\t"+this.property+"("+this.from+" to "+this.to+" @ "+this.threshold+")\n";}}
function CSSStyleSubject(els,style1,style2){els=Animator.makeArray(els);this.subjects=[];if(els.length==0)return;var prop,toStyle,fromStyle;if(style2){fromStyle=this.parseStyle(style1,els[0]);toStyle=this.parseStyle(style2,els[0]);}else{toStyle=this.parseStyle(style1,els[0]);fromStyle={};for(prop in toStyle){fromStyle[prop]=CSSStyleSubject.getStyle(els[0],prop);}}
var prop;for(prop in fromStyle){if(fromStyle[prop]==toStyle[prop]){delete fromStyle[prop];delete toStyle[prop];}}
var prop,units,match,type,from,to;for(prop in fromStyle){var fromProp=String(fromStyle[prop]);var toProp=String(toStyle[prop]);if(toStyle[prop]==null){if(window.DEBUG)alert(ICaltgopub.pa_txt2+prop+'"');continue;}
if(from=ColorStyleSubject.parseColor(fromProp)){to=ColorStyleSubject.parseColor(toProp);type=ColorStyleSubject;}else if(fromProp.match(CSSStyleSubject.numericalRe)&&toProp.match(CSSStyleSubject.numericalRe)){from=parseFloat(fromProp);to=parseFloat(toProp);type=NumericalStyleSubject;match=CSSStyleSubject.numericalRe.exec(fromProp);var reResult=CSSStyleSubject.numericalRe.exec(toProp);if(match[1]!=null){units=match[1];}else if(reResult[1]!=null){units=reResult[1];}else{units=reResult;}}else if(fromProp.match(CSSStyleSubject.discreteRe)&&toProp.match(CSSStyleSubject.discreteRe)){from=fromProp;to=toProp;type=DiscreteStyleSubject;units=0;}else{if(window.DEBUG){alert(ICaltgopub.pa_txt3+prop+": '"+fromStyle[prop]+"'");}
continue;}
this.subjects[this.subjects.length]=new type(els,prop,from,to,units);}}
CSSStyleSubject.prototype={parseStyle:function(style,el){var rtn={};if(style.indexOf(":")!=-1){var styles=style.split(";");for(var i=0;i<styles.length;i++){var parts=CSSStyleSubject.ruleRe.exec(styles[i]);if(parts){rtn[parts[1]]=parts[2];}}}
else{var prop,value,oldClass;oldClass=el.className;el.className=style;for(var i=0;i<CSSStyleSubject.cssProperties.length;i++){prop=CSSStyleSubject.cssProperties[i];value=CSSStyleSubject.getStyle(el,prop);if(value!=null){rtn[prop]=value;}}
el.className=oldClass;}
return rtn;},setState:function(state){for(var i=0;i<this.subjects.length;i++){this.subjects[i].setState(state);}},inspect:function(){var str="";for(var i=0;i<this.subjects.length;i++){str+=this.subjects[i].inspect();}
return str;}}
CSSStyleSubject.getStyle=function(el,property){if(document.defaultView){var computedStyle=document.defaultView.getComputedStyle(el,null);if(computedStyle){style=document.defaultView.getComputedStyle(el,"").getPropertyValue(property);}else if(property=='display'){style='none';}else{property=Animator.camelize(property);if(el.currentStyle){style=el.currentStyle[property];}}
return style||el.style[property];}}
CSSStyleSubject.ruleRe=/^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;CSSStyleSubject.numericalRe=/^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;CSSStyleSubject.discreteRe=/^\w+$/;CSSStyleSubject.cssProperties=['azimuth','background','background-attachment','background-color','background-image','background-position','background-repeat','border-collapse','border-color','border-spacing','border-style','border-top','border-top-color','border-right-color','border-bottom-color','border-left-color','border-top-style','border-right-style','border-bottom-style','border-left-style','border-top-width','border-right-width','border-bottom-width','border-left-width','border-width','bottom','clear','clip','color','content','cursor','direction','display','elevation','empty-cells','css-float','font','font-family','font-size','font-size-adjust','font-stretch','font-style','font-variant','font-weight','height','left','letter-spacing','line-height','list-style','list-style-image','list-style-position','list-style-type','margin','margin-top','margin-right','margin-bottom','margin-left','max-height','max-width','min-height','min-width','orphans','outline','outline-color','outline-style','outline-width','overflow','padding','padding-top','padding-right','padding-bottom','padding-left','pause','position','right','size','table-layout','text-align','text-decoration','text-indent','text-shadow','text-transform','top','vertical-align','visibility','white-space','width','word-spacing','z-index','opacity','outline-offset','overflow-x','overflow-y'];function AnimatorChain(animators,options){this.animators=animators;this.setOptions(options);for(var i=0;i<this.animators.length;i++){this.listenTo(this.animators[i]);}
this.forwards=false;this.current=0;}
AnimatorChain.prototype={setOptions:function(options){this.options=Animator.applyDefaults({resetOnPlay:true},options);},play:function(){this.forwards=true;this.current=-1;if(this.options.resetOnPlay){for(var i=0;i<this.animators.length;i++){this.animators[i].jumpTo(0);}}
this.advance();},reverse:function(){this.forwards=false;this.current=this.animators.length;if(this.options.resetOnPlay){for(var i=0;i<this.animators.length;i++){this.animators[i].jumpTo(1);}}
this.advance();},toggle:function(){if(this.forwards){this.seekTo(0);}else{this.seekTo(1);}},listenTo:function(animator){var oldOnComplete=animator.options.onComplete;var _this=this;animator.options.onComplete=function(){if(oldOnComplete)oldOnComplete.call(animator);_this.advance();}},advance:function(){if(this.forwards){if(this.animators[this.current+1]==null)return;this.current++;this.animators[this.current].play();}else{if(this.animators[this.current-1]==null)return;this.current--;this.animators[this.current].reverse();}},seekTo:function(target){if(target<=0){this.forwards=false;this.animators[this.current].seekTo(0);}else{this.forwards=true;this.animators[this.current].seekTo(1);}}}
function Accordion(options){this.setOptions(options);var selected=this.options.initialSection,current;if(this.options.rememberance){current=document.location.hash.substring(1);}
this.rememberanceTexts=[];this.ans=[];var _this=this;for(var i=0;i<this.options.sections.length;i++){var el=this.options.sections[i];var an=new Animator(this.options.animatorOptions);var from=this.options.from+(this.options.shift*i);var to=this.options.to+(this.options.shift*i);an.addSubject(new NumericalStyleSubject(el,this.options.property,from,to,this.options.units));an.jumpTo(0);var activator=this.options.getActivator(el);activator.index=i;activator.onclick=function(){_this.show(this.index)};this.ans[this.ans.length]=an;this.rememberanceTexts[i]=activator.innerHTML.replace(/\s/g,"");if(this.rememberanceTexts[i]===current){selected=i;}}
this.show(selected);}
Accordion.prototype={setOptions:function(options){this.options=Object.extend({sections:null,getActivator:function(el){return document.getElementById(el.getAttribute("activator"))},shift:0,initialSection:0,rememberance:true,animatorOptions:{}},options||{});},show:function(section){for(var i=0;i<this.ans.length;i++){this.ans[i].seekTo(i>section?1:0);}
if(this.options.rememberance){document.location.hash=this.rememberanceTexts[section];}}}
var slowest=5000;var slow=4000;var med=3000;var fast=2000;var fastest=1000;var slideTime;var randTime;window.onscroll=adjustOverlay;function checkMouseover(evt){if(!evt)var evt=window.event;if(document.all)
evtObj=evt.srcElement;else
evtObj=evt.target;if(evtObj.id.substring(0,5)=='thumb'&&evtObj.parentNode.offsetWidth<75)
{var positionX=getCoords(evtObj).x;var positionY=getCoords(evtObj).y;enlargedImage=$('enlargedImage'+this.photoNum);enlargedImage.style.width=Math.floor(evtObj.width*2.25)+'px';enlargedImage.style.height=Math.floor(evtObj.height*2.25)+'px';enlargedImage.style.position="absolute";enlargedImage.style.top=positionY-Math.floor(evtObj.height*0.75)+'px';enlargedImage.style.left=positionX-Math.floor(evtObj.width*0.75)+'px';enlargedImage.src=this.imageAttributes[this.currentImage].olpath;enlargedImage.style.display='block';}}
function checkDoubleClicks(evt){if(!evt)var evt=window.event;if(document.all)
evtObj=evt.srcElement;else
evtObj=evt.target;if(((evtObj.id.substring(0,5)=="thumb")||(evtObj.id.substring(0,8)=='enlarged'))&&this.mainViewer==1)
{PA_ID=this.photoNum;window.document.body.appendChild($('detailScreen'));window.document.body.appendChild($('detailsContainer'+PA_ID));$('detailScreen').style.height=getWinHeight();$('detailScreen').style.width=getWinWidth();this.showDetails(evtObj);if($('pausebutton'+this.photoNum).style.display=='block')
{this.midPlay=1;}}
else return;}
function checkClickables(evt){if(!evt)var evt=window.event;if(document.all)
evtObj=evt.srcElement;else
evtObj=evt.target;if(((evtObj.id.substring(0,5)=='thumb')||(evtObj.id.substring(0,8)=='enlarged'))&&(evtObj.id.substring(5,8)!="Con"))
{thumbID=evtObj.id.split("_");this.lastImage=this.currentImage;this.currentImage=parseInt(thumbID[2]);this.currentImage=parseInt(thumbID[2]);this.findCurrent();this.showCurrent(evtObj);}
if((evtObj.id==("mainImage"+this.photoNum)||evtObj.id==("imageContainer"+this.photoNum))||(evtObj.id.substring(0,5)=="thumb"&&this.mainViewer==0)||((evtObj.id.substring(0,8)=="enlarged")&&(this.mainViewer==0)))
{PA_ID=this.photoNum;window.document.body.appendChild($('detailScreen'));window.document.body.appendChild($('detailsContainer'+PA_ID));$('detailScreen').style.height=getWinHeight();$('detailScreen').style.width=getWinWidth();this.showDetails(evtObj);this.midPlay=1;}}
PhotoAlbum.prototype.calcRatio=calcRatio;PhotoAlbum.prototype.buildThumbs=buildThumbs;PhotoAlbum.prototype.updateCounter=updateCounter;PhotoAlbum.prototype.buildMainViewer=buildMainViewer;PhotoAlbum.prototype.showDetails=showDetails;PhotoAlbum.prototype.showNextDetail=showNextDetail;PhotoAlbum.prototype.showPrevDetail=showPrevDetail;PhotoAlbum.prototype.closeDetails=closeDetails;PhotoAlbum.prototype.next=next;PhotoAlbum.prototype.previous=previous;PhotoAlbum.prototype.findCurrent=findCurrent;PhotoAlbum.prototype.showCurrent=showCurrent;PhotoAlbum.prototype.initPlay=initPlay;PhotoAlbum.prototype.linearPlay=linearPlay;PhotoAlbum.prototype.randPlay=randPlay;PhotoAlbum.prototype.stop=stop;PhotoAlbum.prototype.f_Slide=f_Slide;PhotoAlbum.prototype.l_Slide=l_Slide;PhotoAlbum.prototype.changeSpeed=changeSpeed;PhotoAlbum.prototype.adjustOverlay=adjustOverlay;PhotoAlbum.prototype.hideDetails=hideDetails;PhotoAlbum.prototype.checkClickables=checkClickables;PhotoAlbum.prototype.checkDoubleClicks=checkDoubleClicks;PhotoAlbum.prototype.checkMouseover=checkMouseover;function PhotoAlbum(photoNum,mainWidth,photoAlbumType,imageBackColor,titleColor,thumbWidth,numOfThumbs,aspectRatio,titles,imageAttributes,textFont,specifyBoxWidth,newIC){this.photoNum=photoNum;this.mainWidth=mainWidth;this.photoAlbumType=photoAlbumType;this.imageBackColor=imageBackColor;this.titleColor=titleColor;this.textFont=textFont;this.specifyBoxWidth=specifyBoxWidth;if(this.specifyBoxWidth=="true"){this.numOfThumbs=0;if(thumbWidth.length==0){this.thumbWidth=0;}else{this.thumbWidth=parseInt(thumbWidth);}}
else{this.thumbWidth=0;if(numOfThumbs.length==0){this.numOfThumbs=0;}else{this.numOfThumbs=parseInt(numOfThumbs);}}
this.aspectRatio=aspectRatio;if(titles.length==0||titles=="false"){this.titles=0;}else{this.titles=1;}
this.slideSpeed=med;this.imageAttributes=imageAttributes;this.imageTotal=imageAttributes.length;for(i=0;i<this.imageTotal;i++){imgObject=new Image();imgObject.src=imageAttributes[i].sspath;imgObject.src=imageAttributes[i].tnpath;imgObject.src=imageAttributes[i].olpath;}
this.newIC=newIC;this.mainHeight;this.thumbHeight;this.imageTotal=imageAttributes.length;this.controls=0;this.thumbnails=0;this.mainViewer=0;this.randomSlideShow=0;this.defaultPlay=0;this.currentImage=0;this.lastImage=0;this.stopSlide=0;this.firstPlay=1;this.midPlay=0;this.Xcoord=0;this.Ycoord=0;this.playInterval=0;this.randInterval=0;this.mainDiv;this.mainIMG;this.thumbDiv;this.thumbIMG;this.thumbTitle;this.largestDiv=[];this.enlargedImage;this.mainContainer=$('mainContainer'+this.photoNum);this.anContainer=new Animator({transition:Animator.makeEaseOut(4),duration:1000});this.anImage=new Animator({transition:Animator.makeEaseOut(3),duration:600});this.anTitle=new Animator({transition:Animator.makeEaseOut(3),duration:600});this.anScreen=new Animator({duration:500});this.calcRatio();this.buildThumbs();this.findCurrent();this.buildMainViewer();this.showCurrent();var PA_ID=this.photoNum;var oldhandler=window.onload;if(this.newIC=="true")
window.onload=function(){oldhandler();buildOverlay(PA_ID);}
this.anContainer.addSubject(new CSSStyleSubject($('details'+this.photoNum),"position: relative; top: 30px; left: 500px; opacity: 0.0; filter: alpha(opacity = 0); width: 400px; height: 400px; border: 1px solid #cccccc; margin: auto; overflow: hidden;","opacity: 1; filter: alpha(opacity = 100); width: 500px; height: 690px; border: 2px solid #56A7EF; margin: auto;"));this.anImage.addSubject(new CSSStyleSubject($('popImage'+this.photoNum),"opacity: 0;filter: alpha(opacity = 0);","opacity: 1; filter: alpha(opacity = 100);"));this.anTitle.addSubject(new CSSStyleSubject($('popTitle'+this.photoNum),"opacity: 0;filter: alpha(opacity = 0);","opacity: 1; filter: alpha(opacity = 100);"));this.anScreen.addSubject(new CSSStyleSubject($('detailScreen'),"opacity: 0;filter: alpha(opacity = 0);","opacity: 0.5; filter: alpha(opacity = 50);"));switch(this.photoAlbumType)
{case(this.photoAlbumType=1):this.mainViewer=1;this.controls=1;this.thumbnails=1;this.defaultPlay=0;break;case(this.photoAlbumType=2):this.mainViewer=1;this.controls=0;this.thumbnails=1;this.defaultPlay=1;break;case(this.photoAlbumType=3):this.mainViewer=1;this.controls=1;this.thumbnails=0;this.defaultPlay=0;break;case(this.photoAlbumType=4):this.mainViewer=1;this.controls=0;this.thumbnails=0;this.defaultPlay=1;break;default:this.mainViewer=0;this.controls=0;this.thumbnails=1;this.defaultPlay=0;$('photoFoot'+this.photoNum).style.display='none';}
$("imageContainer"+this.photoNum).style.backgroundColor=this.imageBackColor;$("imageContainer"+this.photoNum).style.borderColor=this.imageBackColor;if(this.defaultPlay==1){swap('detailplaybtn'+this.photoNum,'detailpausebtn'+this.photoNum);swap('playbutton'+this.photoNum,'pausebutton'+this.photoNum);this.initPlay();}
if(this.controls==0){$("controls"+this.photoNum).style.display="none";}
if(this.thumbnails==0){$('thumbContainer'+this.photoNum).style.display='none';}
if(this.mainViewer==0){$("controls"+this.photoNum).style.display="none";$("imageContainer"+this.photoNum).style.display="none";this.defaultPlay=0;}
$("photoFoot"+this.photoNum).style.width=mainWidth+"px";$("controls"+this.photoNum).style.width=(mainWidth-6)+"px";$("details"+this.photoNum).style.backgroundColor=imageBackColor;$("details"+this.photoNum).style.borderColor="#CCCCCC";$("popTitle"+this.photoNum).style.color=titleColor;$("popTitle"+this.photoNum).style.backgroundColor=imageBackColor;if(this.textFont!=""){$("popTitle"+this.photoNum).style.fontFamily=this.textFont;}
$("popDesc"+this.photoNum).style.color=titleColor;$("popDesc"+this.photoNum).style.backgroundColor=imageBackColor;if(this.textFont!=""){$("popDesc"+this.photoNum).style.fontFamily=this.textFont;}
this.updateCounter(this.photoNum);if(this.mainContainer.addEventListener){this.mainContainer.addEventListener('click',createObjectCallback(this,this.checkClickables),false);this.mainContainer.addEventListener('dblclick',createObjectCallback(this,this.checkDoubleClicks),false);}else if(this.mainContainer.attachEvent){this.mainContainer.attachEvent('onclick',createObjectCallback(this,this.checkClickables));this.mainContainer.attachEvent('ondblclick',createObjectCallback(this,this.checkDoubleClicks));}
if(this.largestDiv.length>0){for(var i=0;i<this.largestDiv.length;i++){}}}
function buildOverlay(PA_ID){window.document.body.appendChild($('detailScreen'));window.document.body.appendChild($('detailsContainer'+PA_ID));}
function calcRatio(){if(this.aspectRatio=="landscape"){this.thumbHeight=Math.floor(this.thumbWidth*0.75);this.mainHeight=Math.floor(this.mainWidth*0.75);}
else if(this.aspectRatio=="portrait"){this.thumbHeight=Math.floor(this.thumbWidth*1.33);this.mainHeight=Math.floor(this.mainWidth*1.33);}
else
{this.thumbHeight=this.thumbWidth;this.mainHeight=this.mainWidth;}}
function updateCounter(){this.currentNum=this.currentImage+1;if($("SlideNum"+this.photoNum)){$("SlideNum"+this.photoNum).innerHTML=this.currentNum+"/"+this.imageTotal;}}
function buildThumbs(){var j=0;var largestTitle=[j];if(this.numOfThumbs>0){if(document.all)
this.thumbWidth=Math.floor(this.mainWidth/this.numOfThumbs)-13;else
this.thumbWidth=Math.floor(this.mainWidth/this.numOfThumbs)-12;}
this.calcRatio();$('thumbContainer'+this.photoNum).style.width=this.mainWidth+"px";this.thumbDiv=new Array;this.thumbIMG=new Array;this.thumbTitle=new Array;this.thumbTable=new Array;this.thumbTBody=new Array;this.thumbTR=new Array;this.thumbTD=new Array;for(i=0;i<this.imageTotal;i++){this.thumbDiv[i]=document.createElement("div");this.thumbTitle[i]=document.createElement("div");this.thumbIMG[i]=document.createElement("IMG");this.thumbTable[i]=document.createElement("table");this.thumbTBody[i]=document.createElement("tbody");this.thumbTR[i]=document.createElement("tr");this.thumbTD[i]=document.createElement("td");this.thumbTable[i].cellPadding=0;this.thumbTable[i].cellSpacing=0;this.thumbTable[i].height=this.thumbHeight+"px";this.thumbTable[i].width=this.thumbWidth+"px";this.thumbTD[i].height=this.thumbHeight+"px";this.thumbTD[i].width=this.thumbWidth+"px";this.thumbTD[i].vAlign="middle";this.thumbDiv[i].className="imageThumb";this.thumbDiv[i].id="thumbDiv_"+this.photoNum+"_"+i;this.thumbDiv[i].style.width=this.thumbWidth+"px";this.thumbDiv[i].style.height=this.thumbHeight+"px";this.thumbDiv[i].style.backgroundColor=this.imageBackColor;this.thumbDiv[i].style.borderColor=this.imageBackColor;this.thumbDiv[i].style.lineHeight=this.thumbHeight+"px";this.thumbIMG[i].src=this.imageAttributes[i].tnpath;this.thumbIMG[i].alt=this.imageAttributes[i].alt;this.thumbIMG[i].id="thumb_"+this.photoNum+"_"+i;this.thumbIMG[i].style.margin="auto";this.thumbIMG[i].style.display="block";this.thumbIMG[i].style.textAlign="center";this.thumbTitle[i].className='thumbTitle';this.thumbTitle[i].innerHTML=this.imageAttributes[i].title;this.thumbTitle[i].style.color=this.titleColor;this.thumbTitle[i].style.fontFamily=this.textFont;this.thumbTitle[i].style.textAlign="center";this.thumbTitle[i].style.cursor="default";if(this.imageAttributes[i].title.length>largestTitle[j]){largestTitle[j]=this.imageAttributes[i].title.length;this.largestDiv[j]=this.thumbTitle[i];}
if(((i+1)%this.numOfThumbs)==0){j++;largestTitle[j]=0;this.largestDiv[j]=this.thumbTitle[i];}
$("thumbContainer"+this.photoNum).appendChild(this.thumbDiv[i]);this.thumbDiv[i].appendChild(this.thumbTable[i]);this.thumbTable[i].appendChild(this.thumbTBody[i]);this.thumbTBody[i].appendChild(this.thumbTR[i]);this.thumbTR[i].appendChild(this.thumbTD[i]);this.thumbTD[i].appendChild(this.thumbIMG[i]);this.thumbDiv[i].appendChild(this.thumbTitle[i]);}
var newHeight=[];if(this.titles==1){for(i=0;i<=j;i++){approxWidth=Math.ceil(largestTitle[i]*11);if(approxWidth>this.thumbWidth)
rowUnit=Math.ceil(approxWidth/this.thumbWidth);else if(largestTitle[i]==0)
rowUnit=0;else
rowUnit=1;newHeight[i]=rowUnit*16;}
j=0;for(i=0;i<this.imageTotal;i++){this.thumbDiv[i].style.height=parseInt(this.thumbDiv[i].style.height)+newHeight[j]+"px";if(((i+1)%this.numOfThumbs)==0){j++;}}}}
function getStyle(node,sStyle){var style;if(document.all){nodeStyle=node.offsetHeight;}else{try{nodeStyle=document.defaultView.getComputedStyle(node,null).getPropertyValue(sStyle);}catch(e){}}
return nodeStyle;}
function buildMainViewer(){this.mainIMG=document.createElement("IMG");$("imageContainer"+this.photoNum).width=this.mainWidth;$("imageContainer"+this.photoNum).height=this.mainHeight;$("imageContainer"+this.photoNum).appendChild(this.mainIMG);$('detailScreen').style.height=getWinHeight();$('detailScreen').style.width=getWinWidth();if(this.newIC=='false'&&document.all){$('details'+this.photoNum).style.position='absolute';}}
function getWinWidth(){var w;if(document.innerWidth){w=document.innerWidth;}else if(document.documentElement.clientWidth){w=document.documentElement.clientWidth;}else if(document.body){w=document.body.clientWidth;}
return w;}
function getWinHeight(){var h;if(document.innerHeight){h=document.innerHeight;}else if(document.documentElement.clientHeight){h=document.documentElement.clientHeight;}else if(document.body){h=document.body.clientHeight;}
return h;}
function showDetails(evtObj){if(document.all){var dropdowns=document.getElementsByTagName('select');for(var j=0;j<dropdowns.length;j++){dropdowns[j].style.visibility='hidden';}}
if(document.all){if(this.newIC=='false'){if(((evtObj.id.substring(0,5)=='thumb')||(evtObj.id.substring(0,8)=='enlarged'))&&(evtObj.id.substring(5,8)!="Con")){$('detailsContainer'+this.photoNum).style.marginTop=getCoords(evtObj).y-20+"px";$('detailsContainer'+this.photoNum).style.marginLeft=getCoords($('mainContainer'+this.photoNum)).x+"px";}
else{$("detailsContainer"+this.photoNum).style.marginTop=getCoords($('mainContainer'+this.photoNum)).y+"px";$("detailsContainer"+this.photoNum).style.marginLeft=getCoords($('mainContainer'+this.photoNum)).x+"px";}}
else{$("detailsContainer"+this.photoNum).style.top=document.documentElement.scrollTop+10+"px";$("detailScreen").style.top=document.documentElement.scrollTop+"px";}
if(navigator.appVersion.indexOf("MSIE 7.")!=-1){$("detailScreen").style.top="0px";}}
else{$("detailsContainer"+this.photoNum).style.top=window.pageYOffset+10+"px";$("detailScreen").style.top="0px";}
$("detailsContainer"+this.photoNum).style.display="block";$("detailScreen").style.display="block";$("popImage"+this.photoNum).src=this.imageAttributes[this.currentImage].olpath;$("popTitle"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].title;$("popDesc"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].desc;this.anContainer.toggle();if(this.newIC=='true')
this.anScreen.toggle();this.anImage.toggle();this.anTitle.toggle();}
function closeDetails(){if($('playbutton'+this.photoNum).style.display=='none'||(this.defaultPlay==1&&this.controls==0)){window.setTimeout(createObjectCallback(this,this.initPlay),500);}
this.anImage.toggle();this.anTitle.toggle();this.anContainer.toggle();if(this.newIC=='true')
this.anScreen.toggle();window.setTimeout(createObjectCallback(this,this.hideDetails),1000);}
function hideDetails(){$("detailsContainer"+this.photoNum).style.display="none";$("detailScreen").style.display="none";this.mainIMG.style.display='block';if(document.all){var dropdowns=document.getElementsByTagName('select');for(var i=0;i<dropdowns.length;i++){dropdowns[i].style.visibility='visible';}}}
function stop(){if(this.randomSlideShow==1){clearInterval(this.randInterval);}
else{clearInterval(this.playInterval);}
this.midPlay=0;}
function f_Slide(){this.lastImage=this.currentImage;this.currentImage=0;this.findCurrent();this.showCurrent();}
function l_Slide(){this.lastImage=this.currentImage;this.currentImage=this.imageTotal-1;this.findCurrent();this.showCurrent();}
function findCurrent(){this.updateCounter(this.currentImage);}
function showCurrent(){this.mainIMG.src=this.imageAttributes[this.currentImage].sspath;this.mainIMG.alt=this.imageAttributes[this.currentImage].alt;this.mainIMG.id="mainImage"+this.photoNum;$("popImage"+this.photoNum).src=this.imageAttributes[this.currentImage].olpath;if($("popTitle"+this.photoNum))
$("popTitle"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].title;if($("popDesc"+this.photoNum))
$("popDesc"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].desc;}
function initPlay(){var speed=this.slideSpeed;if(this.randomSlideShow==1){if(this.firstPlay==0)clearInterval(this.randInterval);this.randInterval=window.setInterval(createObjectCallback(this,this.linearPlay),speed);}
else{if(this.firstPlay==0)clearInterval(this.playInterval);this.playInterval=window.setInterval(createObjectCallback(this,this.linearPlay),speed);}
this.firstPlay=0;}
function linearPlay(){this.showNextDetail();}
function next(){if(this.currentImage<this.imageTotal-1){this.lastImage=this.currentImage;this.currentImage++;}
else{this.currentImage=0;this.lastImage=this.imageTotal-1;}
this.findCurrent();this.showCurrent();}
function showNextDetail(){this.next();$("popImage"+this.photoNum).src=this.imageAttributes[this.currentImage].olpath;$("popTitle"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].title;$("popDesc"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].desc;}
function previous(){if(this.currentImage>0){this.lastImage=this.currentImage;this.currentImage--;}
else{this.currentImage=this.imageTotal-1;this.lastImage=0;}
this.findCurrent();this.showCurrent();}
function showPrevDetail(){this.previous();$("popImage"+this.photoNum).src=this.imageAttributes[this.currentImage].olpath;$("popTitle"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].title;$("popDesc"+this.photoNum).innerHTML=this.imageAttributes[this.currentImage].desc;}
function randPlay(){if(stopSlide!=1){if(this.currentImage<=this.imageTotal)
{this.lastImage=this.currentImage;while(this.lastImage==this.currentImage){this.currentImage=randNum(0,(this.imageTotal-1));}
this.findCurrent();this.showCurrent();}}
else return;}
function changeSpeed(speed,num,relative_path)
{this.slideSpeed=speed;for(i=num;i<6;i++)
{$('speed'+i+this.photoNum).src=relative_path+'images/photoalbum/button_photoSpeed'+i+'.jpg';}
for(i=1;i<=num;i++)
{$('speed'+i+this.photoNum).src=relative_path+'images/photoalbum/button_photoSpeed'+i+'_ON.jpg';}
if(this.randomSlideShow==1){clearInterval(this.randInterval);this.randInterval=window.setInterval(createObjectCallback(this,this.randPlay),this.slideSpeed);}
else if($('playbutton'+this.photoNum).style.display=='none')
{clearInterval(this.playInterval);this.playInterval=window.setInterval(createObjectCallback(this,this.linearPlay),this.slideSpeed);}}
function swap(a,b){$(a).style.display='none';$(b).style.display='inline';}
function $(id){return document.getElementById(id);}
function randNum(x,y){var range=y-x+1;return Math.floor(Math.random()*range)+x;}
function getCoords(element)
{var valueT=0,valueL=0;do
{valueT+=element.offsetTop||0;valueL+=element.offsetLeft||0;element=element.offsetParent;}
while(element);return{x:valueL,y:valueT};}
function adjustOverlay(){try{if(document.all&&(navigator.appVersion.indexOf("MSIE 7.")==-1)){$('detailScreen').style.height=getWinHeight();$('detailScreen').style.width=getWinWidth();if(this.newIC=='false'){}
else{$("detailScreen").style.top=document.documentElement.scrollTop+"px";}}}
catch(e){return false;}}
function createObjectCallback(obj,fn)
{return function()
{fn.apply(obj,arguments);};}
