
var lib={};lib.d=YAHOO.util.Dom;lib.e=YAHOO.util.Event;lib.ce=YAHOO.util.CustomEvent;lib.a=YAHOO.util.Anim;var AccordionMenu=(function(){var oMenuSetting={};var oMenuCache={};var dLastHoverTitle;lib.d.addClass(document.documentElement,'accordion-menu-js');function getDT(e){var dEl=lib.e.getTarget(e);if((e.tagName+'').toUpperCase()==='DD'){var dt=e.previousSibling;while(dt){if(dt.tagName&&dt.tagName.toUpperCase()==='DT'){break;}
dt=dt.previousSibling;}
if(!dt||dt.tagName.toUpperCase()!=='DT'){return;}
else{return(dt.tagName==='DT')?dt:null;}}
else if(e.clientX){var found=false;while(dEl.parentNode){if(lib.d.hasClass(dEl,'a-m-t')){found=true;break;}
dEl=dEl.parentNode;}
if(!found){return null;}
else{return(dEl.tagName==='DT')?dEl:null;}}}
function getDD(dt){if(!dt){return null;}
var dd=dt.nextSibling;while(dd)
{if(dd.tagName&&dd.tagName.toUpperCase()==='DD'){break;}
dd=dd.nextSibling;}
if(!dd||dd.tagName.toUpperCase()!=='DD'){return;}
else{return dd;}}
function expand(dl,dt,dd){var seconds=0.5;var oAttr={height:{from:0,to:dd.offsetHeight}};var oEaseType=YAHOO.util.Easing.easeOut;var oAnim=new YAHOO.util.Anim(dd,oAttr,seconds,oEaseType);dl.hasAnimation+=1;lib.d.addClass(dd,'a-m-d-before-expand');lib.d.removeClass(dd,'a-m-d-before-expand');var onComplete=function(){oAnim.onComplete.unsubscribe(onComplete);oAnim.stop();lib.d.removeClass(dd,'a-m-d-anim');lib.d.addClass(dd,'a-m-d-expand');onComplete=null;dl.hasAnimation-=1;var dt=getDT(dd);lib.d.addClass(dt,'a-m-t-expand');if(oMenuCache[dl.id]&&oMenuCache[dl.id].onOpen&&dd.style.height!==''){oMenuCache[dl.id].onOpen({dl:dl,dt:dt,dd:dd});}
dd.style.height='';};var onTween=function(){if(dd.style.height){lib.d.addClass(dd,'a-m-d-anim');oAnim.onTween.unsubscribe(onTween);onTween=null;dd.oAnim=null;}};if(dd.oAnim){dd.oAnim.stop();dd.oAnim=null;dl.hasAnimation-=1;}
if(oMenuCache[dl.id]){oEaseType=oMenuCache[dl.id]['easeOut']?oEaseType:YAHOO.util.Easing.easeIn;seconds=oMenuCache[dl.id]['seconds'];if(!oMenuCache[dl.id]['animation']){oAnim={onComplete:{unsubscribe:function(){}},stop:function(){}};onComplete();return;}}
oAnim.onComplete.subscribe(onComplete);oAnim.onTween.subscribe(onTween);oAnim.animate();dd.oAnim=oAnim;}
function collapse(dl,dt,dd){dl.hasAnimation+=1;lib.d.addClass(dd,'a-m-d-anim');var seconds=0.5;var oEaseType=YAHOO.util.Easing.easeOut;var oAttr={height:{from:dd.offsetHeight,to:0}};var oAnim=new YAHOO.util.Anim(dd,oAttr,seconds,oEaseType);var onComplete=function(){oAnim.onComplete.unsubscribe(onComplete);lib.d.removeClass(dd,'a-m-d-anim');lib.d.removeClass(dd,'a-m-d-expand');dd.style.height='';dd.oAnim=null;onComplete=null;dl.hasAnimation-=1;var dt=getDT(dd);lib.d.removeClass(dt,'a-m-t-expand');if(oMenuCache[dl.id]&&oMenuCache[dl.id].onOpen){oMenuCache[dl.id].onClose({dl:dl,dt:dt,dd:dd});}};if(dd.oAnim){dd.oAnim.stop();dd.oAnim=null;dl.hasAnimation-=1;}
if(oMenuCache[dl.id]){oEaseType=oMenuCache[dl.id]['easeOut']?oEaseType:YAHOO.util.Easing.easeIn;seconds=oMenuCache[dl.id]['seconds'];if(!oMenuCache[dl.id]['animation']){oAnim={onComplete:{unsubscribe:function(){}},stop:function(){}};onComplete();return;}}
oAnim.onComplete.subscribe(onComplete);oAnim.animate();dd.oAnim=oAnim;}
function collapseAll(dl,dt,dd){var aOtherDD=lib.d.getElementsByClassName('a-m-d-expand','dd',dl);for(var i=0;i<aOtherDD.length;i++){var otherDD=aOtherDD[i];if(otherDD!==dd){collapse(dl,null,otherDD);}}}
var onMenuMouseover=function(e){var dMenuTitle=getDT(e);if(!dMenuTitle){return;}
if(dLastHoverTitle){lib.d.removeClass(dLastHoverTitle,'a-m-t-hover');}
lib.d.addClass(dMenuTitle,'a-m-t-hover');dLastHoverTitle=dMenuTitle;lib.e.preventDefault(e);return false;};var onMenuMouseout=function(e){var dMenuTitle=getDT(e);if(!dMenuTitle){return;}
if(dLastHoverTitle&&dLastHoverTitle!==dMenuTitle){lib.d.removeClass(dLastHoverTitle,'a-m-t-hover');lib.d.removeClass(dLastHoverTitle,'a-m-t-down');}
lib.d.removeClass(dMenuTitle,'a-m-t-down');lib.d.removeClass(dMenuTitle,'a-m-t-hover');dLastHoverTitle=null;lib.e.preventDefault(e);return false;};var onMenuMousedown=function(e){var dMenuTitle=getDT(e);if(!dMenuTitle){return;}
lib.d.addClass(dMenuTitle,'a-m-t-down');lib.e.preventDefault(e);return false;};var onMenuClick=function(e){var dt=getDT(e);if(!dt){return;}
var dd=getDD(dt);if(!dd){return;}
var dl=dt.parentNode;if(dl.hasAnimation===null){dl.hasAnimation=0;}
if(dl.hasAnimation>0){return;}
lib.d.removeClass(dt,'a-m-t-down');if(lib.d.hasClass(dd,'a-m-d-expand')){collapse(dl,dt,dd);}
else{if(oMenuCache[dl.id]&&oMenuCache[dl.id].dependent===false){}
else{collapseAll(dl,dt,dd);}
expand(dl,dt,dd);}
lib.e.preventDefault(e);return false;};lib.e.on(document,'mouseover',onMenuMouseover);lib.e.on(document,'mouseout',onMenuMouseout);lib.e.on(document,'mousedown',onMenuMousedown);lib.e.on(document,'click',onMenuClick);var oApi={openDtById:function(sId){var dt=document.getElementById(sId);if(!dt){return;}
if(!lib.d.hasClass(dt,'a-m-t')){return;}
var dl=dt.parentNode;var dd=getDD(dt);if(dl.hasAnimation===null){dl.hasAnimation=0;}
if(dl.hasAnimation>0){return;}
if(lib.d.hasClass(dd,'a-m-d-expand')){return;}
if(oMenuCache[dl.id]&&oMenuCache[dl.id].dependent===false){}
else{collapseAll(dl,dt,dd);}
expand(dl,dt,dd);},closeDtById:function(sId){var dt=document.getElementById(sId);if(!dt){return;}
if(!lib.d.hasClass(dt,'a-m-t')){return;}
var dl=dt.parentNode;var dd=getDD(dt);if(dl.hasAnimation===null){dl.hasAnimation=0;}
if(dl.hasAnimation>0){return;}
if(!lib.d.hasClass(dd,'a-m-d-expand')){return;}
collapse(dl,dt,dd);},setting:function(id,oOptions){if(!oOptions){return;}
if(typeof(id)!=='string'){return;}
var setMunu=function(dl){dl=dl||this;dl.hasAnimation=0;oMenuCache[dl.id]={element:dl,dependent:true,onOpen:function(){},onClose:function(){},seconds:0.5,easeOut:true,openedIds:[],animation:true};oMenu=oMenuCache[dl.id];if(typeof(oOptions['animation'])==='boolean'){oMenu['animation']=!!oOptions['animation'];}
if(typeof(oOptions['dependent'])==='boolean'){oMenu['dependent']=!!oOptions['dependent'];}
if(typeof(oOptions['easeOut'])==='boolean'){oMenu['easeOut']=!!oOptions['easeOut'];}
if(typeof(oOptions['seconds'])==='number'){oMenu['seconds']=Math.max(0,oOptions['seconds']);}
if(typeof(oOptions['onOpen'])==='function'){oMenu['onOpen']=oOptions['onOpen'];}
if(typeof(oOptions['onClose'])==='function'){oMenu['onClose']=oOptions['onClose'];}
if(oOptions['openedIds'].shift){oMenu['openedIds']=oOptions['openedIds'];}
for(var i=0;i<oMenu['openedIds'].length;i++){var sId=oMenu['openedIds'][i];var dt=document.getElementById(sId);if(dt&&dt.tagName.toUpperCase()==='DT'){dl=dt.parentNode;var dd=getDD(dt);expand(dl,dt,dd);}
else if(!dt){(function onDtAvailable(){var dt=this;if(dt.tagName.toUpperCase()==='DT'){var dl=dt.parentNode;var dd=getDD(dt);expand(dl,dt,dd);}});lib.e.onAvailable(sId,onDtAvailable);}}};if(document.getElementById(id)){setMunu(document.getElementById(id));}
else{lib.e.onAvailable(id,setMunu);}}};return oApi;})();YAHOO.namespace("YAHOO.photoViewer");YAHOO.photoViewer.base=function(id){var container=null;var viewerDom=null;var maskDom=null;var showcaseImage=null;var headerDom=null;var titleDom=null;var closeDom=null;var bodyDom=null;var descDom=null;var footerDom=null;var prevDom=null;var nextDom=null;var flickrDom=null;var controlsDom=null;var playDom=null;var stopDom=null;var displayDom=null;var viewer=null;var controls=null;var thumbs=null;var that=this;var properties=YAHOO.photoViewer.config.viewers[id].properties;var events={};var currentThumb=null;var preloadtimer=null;var preloadimgs=[];var hasLoaded={};var defaultText={next:"next",prev:"prev",close:"close"};var shuffleArr=[];var slideShowTimerTimeout=null;this.init=function(){properties.thumbEvent=properties.thumbEvent||"click";properties.slideShow=properties.slideShow||false;if(properties.slideShow){properties.slideShow.duration=properties.slideShow.duration||3000;properties.slideShow.loopMode=properties.slideShow.loopMode||"loop";properties.slideShow.startAt=properties.slideShow.startAt||"first";properties.slideShow.playMode=properties.slideShow.playMode||"ordered";properties.slideShow.applyControls=lib.d.get(properties.slideShow.applyControls)||false;properties.slideShow.loop=(properties.slideShow.loop===undefined)?true:properties.slideShow.loop;properties.slideShow.autoStart=(properties.slideShow.autoStart===undefined)?true:properties.slideShow.autoStart;properties.slideShow.state=0;}
if(properties.loadFrom==="flickr"){if(!properties.flickrRss.id){alert("You cannot use a Flickr feed without an id");return;}
properties.flickrRss.thumbSize=properties.flickrRss.thumbSize||"thumb";}
switch(properties.loadFrom){case"xml":setEvents();if(properties.slideShow){if(properties.slideShow.autoStart){this.loadXML();events.xmlload.unsubscribe(this.play);events.xmlload.subscribe(this.play);}}
break;case"flickr":setEvents();if(properties.slideShow){if(properties.slideShow.autoStart){this.loadFlickrRss();events.flickrload.unsubscribe(this.play);events.flickrload.subscribe(this.play);}}
break;case"html":config();if(properties.slideShow){if(properties.slideShow.autoStart){this.play();}}
break;}
if(properties.slideShow){if(!properties.slideShow.loop){events.lastphoto.subscribe(this.stop);}}
return this;};this.loadXML=function(url){var sUrl=url?url:properties.url;var postData="";var callback={success:readPhotos,failure:fail,that:this};YAHOO.photoViewer.loading.on();var request=YAHOO.util.Connect.asyncRequest('GET',sUrl,callback,postData);};this.loadFlickrRss=function(){var scriptSrc="http://api.flickr.com/services/feeds/photos_public.gne?id="+properties.flickrRss.id+"&lang=en-us&format=json&jsoncallback=YAHOO.photoViewer.controller.viewers."+properties.id+".registerFlickr";flickrDom=document.createElement("script");flickrDom.setAttribute("type","text/javascript");flickrDom.setAttribute("src",scriptSrc);document.getElementsByTagName("head")[0].appendChild(flickrDom);};this.registerFlickr=function(rsp){if(properties.flickrRss){var maxLen=600;var photo={};var start=0;var replaceStr="&quot; /&gt;&lt;/a&gt;&lt;/p&gt;";var thumbReplace=(properties.flickrRss.thumbSize==="square")?"_s":"_t";var photoNodes=rsp.items;for(var i=0;i<photoNodes.length;i++){photo.thumbsource=photoNodes[i].media.m.replace("_m",thumbReplace);photo.fullsource=photoNodes[i].media.m.replace("_m","");photo.title=photoNodes[i].title;photo.description=photoNodes[i].description;if(!YAHOO.env.ua.ie){maxLen=600;photo.description=photo.description.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"');photo.description=mid(photo.description,0,maxLen);}
else{var tempDesc=document.createElement("div");tempDesc.innerHTML=photo.description.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"');photo.description=tempDesc.innerText;tempDesc=null;}
if(photo.description.length>maxLen){photo.description+=" ...";}
createPhoto(photo);}
config();events.flickrload.fire();YAHOO.photoViewer.loading.off();}};this.prev=function(){var currentIndex=getThumbIndexFromId(currentThumb);var prevousIndex=(currentIndex>0)?(currentIndex-1):(thumbs.length-1);currentThumb=thumbs[prevousIndex].getElementsByTagName("img")[0];loadViewer(thumbs[prevousIndex]);};this.next=function(){var currentIndex=getThumbIndexFromId(currentThumb);var nextIndex=(currentIndex<(thumbs.length-1))?(currentIndex+1):0;currentThumb=thumbs[nextIndex].getElementsByTagName("img")[0];loadViewer(thumbs[nextIndex]);};this.close=function(){viewer.hide();lib.d.setStyle(maskDom,"visibility","hidden");if(properties.slideShow){that.stop();lib.d.setStyle(controlsDom,"display","none");}
events.closeviewer.fire(that);};this.open=function(index){var thumb=currentThumb?currentThumb.parentNode:thumbs[0];index=Number(index);if(index>-1&&index<thumbs.length){thumb=thumbs[index];}
currentThumb=thumb.getElementsByTagName("img")[0];events.openviewer.fire(that);loadViewer(thumb);if(lib.d.getStyle(viewer.element,"display")==="none"){viewer.show();}};this.on=function(evt,callback){events[evt].subscribe(callback);};this.un=function(evt,callback){events[evt].unsubscribe(callback);};this.getProperty=function(p){if(!properties[p]){return null;}
return properties[p];};this.setProperty=function(p,v){if(!properties[p]){return null;}
properties[p]=v;return properties[p];};this.preload=function(){var func="YAHOO.photoViewer.controller.getViewer('"+properties.id+"').preload()";if(preloadtimer){clearTimeout(preloadtimer);}
for(var a=0;a<thumbs.length;a++){var href=thumbs[a].getAttribute("href");var fullsource=thumbs[a].getAttribute("fullsource");preloadimgs.push(new Image());if(href!=="javascript"){preloadimgs[a].src=href;}
else{preloadimgs[a].src=fullsource;}}
if(preloadimgs.length<thumbs.length){preloadtimer=setTimeout(func,1000);}};this.play=function(index){var next=0;if(properties.slideShow.playMode==="shuffle"){next=shuffle();}
if(properties.slideShow.playMode==="random"){next=randRange(0,thumbs.length);}
if(properties.slideShow.state===1){next=(getThumbIndexFromId(currentThumb)+1);}
if(arguments.length){next=index+1;}
events.viewerload.unsubscribe(startTimer);events.viewerload.subscribe(startTimer);that.open(next);properties.slideShow.state=2;events.play.fire(that);};this.stop=function(){events.viewerload.unsubscribe(startTimer);clearTimeout(slideShowTimerTimeout);slideShowTimerTimeout=null;resetShuffle();properties.slideShow.state=0;events.stop.fire(that);};this.pause=function(){events.viewerload.unsubscribe(startTimer);clearTimeout(slideShowTimerTimeout);slideShowTimerTimeout=null;properties.slideShow.state=1;events.pause.fire(that);};this.destroyViewer=function(){if(viewer){lib.e.purgeElement(showcaseImage,true,"load");viewer.destroy();for(var a in events){var us=events[a].unsubscribeAll();}
for(var ab=0;ab<thumbs.length;ab++){lib.e.removeListener(thumbs[ab],properties.thumbEvent,thumbClick);thumbs[ab].setAttribute("href",thumbs[ab].fullsource);}
events.viewerload.unsubscribe(startTimer);clearTimeout(slideShowTimerTimeout);slideShowTimerTimeout=null;if(maskDom){if(maskDom.parentNode){maskDom.parentNode.removeChild(maskDom);}}
YAHOO.photoViewer.loading.destroy();YAHOO.photoViewer.controller.removeViewer(properties.id);}};function startTimer(){var func="YAHOO.photoViewer.controller.getViewer('"+properties.id+"').getNextSlide()";if(slideShowTimerTimeout){clearTimeout(slideShowTimerTimeout);}
slideShowTimerTimeout=setTimeout(func,properties.slideShow.duration);}
function shuffle(){if(shuffleArr.length===0){resetShuffle();}
var seed=randRange(0,(shuffleArr.length-1));var next=shuffleArr[seed];shuffleArr.splice(seed,1);if(shuffleArr.length===0){events.lastphoto.fire();if(properties.slideShow.state<2){return;}}
return next;}
function resetShuffle(){for(var a=0;a<thumbs.length;a++){shuffleArr[a]=a;}}
function randRange(intFrom,intTo,intSeed){intFrom=Math.floor(intFrom);intTo=Math.floor(intTo);return(Math.floor(intFrom+((intTo-intFrom+1)*Math.random((intSeed!==null)?intSeed:0))));}
this.getNextSlide=function(){var next=0;if(properties.slideShow.playMode==="ordered"){var currentIndex=getThumbIndexFromId(currentThumb);var nextIndex=(currentIndex<(thumbs.length-1))?(currentIndex+1):0;this.open(nextIndex);}
if(properties.slideShow.playMode==="shuffle"){this.open(shuffle());}
if(properties.slideShow.playMode==="random"){this.open(randRange(0,thumbs.length));}};function getThumbIndexFromId(el){return Number(lib.d.getAncestorByTagName(el,"a").getAttribute("id").split("_")[1]);}
function getThumbIndex(el){for(var a=0;a<thumbs.length;a++){if(el===thumbs[a]){return a;}}}
function loadViewer(e){if(!viewer){createViewer();if(properties.slideShow){createControls();}
if(YAHOO.env.ua.ie===0||YAHOO.env.ua.ie===7){lib.e.on(showcaseImage,"load",viewerLoaded);}
else{that.checkLoadForIe();}}
var thumbImage=lib.e.getTarget(e)?lib.e.getTarget(e):e.getElementsByTagName("img")[0];var thumbAnchor=thumbImage.parentNode;var titleText=thumbAnchor.getAttribute("title").length?thumbAnchor.getAttribute("title"):"";var descText=thumbImage.getAttribute("alt");var photoCount=getThumbIndexFromId(thumbImage)+1;if(properties.slideShow){lib.d.setStyle(controlsDom,"display","block");}
if(photoCount===(thumbs.length)){var flag=false;if(properties.slideShow){if(properties.slideShow.playMode==="ordered"){flag=true;}}
else{flag=true;}
if(flag){events.beforelastphoto.fire();}}
insertStr(titleDom,titleText);insertStr(descDom.firstChild,descText);if(!YAHOO.env.ua.ie!==6){events.viewerupdated.unsubscribe(attachShowcaseEvts);events.viewerupdated.subscribe(attachShowcaseEvts);events.viewerupdated.fire();}
else
{that.checkLoadForIe();}
showcaseImage.src=thumbAnchor.fullsource;if(!hasLoaded[thumbAnchor.fullsource]){YAHOO.photoViewer.loading.on({applyTo:viewerDom});}
lib.d.setStyle(bodyDom,"opacity","0");lib.d.setStyle(titleDom,"opacity","0");lib.d.setStyle(viewerDom,"z-index",YAHOO.photoViewer.zIndex++);lib.d.setStyle(maskDom,"z-index",YAHOO.photoViewer.zIndex-1);}
function attachShowcaseEvts(){lib.e.purgeElement(showcaseImage,true,"load");lib.e.on(showcaseImage,"load",viewerLoaded);}
var checkLoadTimeout=null;this.checkLoadForIe=function(){var func="YAHOO.photoViewer.controller.getViewer('"+properties.id+"').checkLoadForIe()";if(checkLoadTimeout){clearTimeout(checkLoadTimeout);}
if(!showcaseImage.complete){checkLoadTimeout=setTimeout(func,1000);}
else{viewerLoaded();}};function getClassName(el){if(!typeof el==="object"){return null;}
if(YAHOO.env.ua.ie){return el.getAttribute("className");}
else{return el.getAttribute("class");}}
function readPhotos(data){var photo={};if(data.responseXML!==undefined){var photoNodes=data.responseXML.getElementsByTagName("photo");for(var i=0;i<photoNodes.length;i++){photo.thumbsource=photoNodes[i].getElementsByTagName("thumbsource")[0].firstChild.nodeValue;photo.fullsource=photoNodes[i].getElementsByTagName("fullsource")[0].firstChild.nodeValue;if(photoNodes[i].getElementsByTagName("title")[0].firstChild){photo.title=photoNodes[i].getElementsByTagName("title")[0].firstChild.nodeValue;}
else{photo.title="";}
if(photoNodes[i].getElementsByTagName("description")[0].firstChild){photo.description=photoNodes[i].getElementsByTagName("description")[0].firstChild.nodeValue;}
else{photo.description="";}
createPhoto(photo);}
config();events.xmlload.fire();YAHOO.photoViewer.loading.off();}}
function fail(data){alert("XML file failed to load");YAHOO.photoViewer.loading.off();}
function createPhoto(photo){var anchor=document.createElement("a");var img=document.createElement("img");container=lib.d.get(properties.id);anchor.setAttribute("href",photo.fullsource);anchor.setAttribute("fullsource",photo.fullsource);anchor.setAttribute("title",photo.title);lib.d.addClass(anchor,"photoViewer");img.setAttribute("src",photo.thumbsource);img.setAttribute("alt",photo.description);anchor.appendChild(img);container.appendChild(anchor);}
function config(){container=lib.d.get(properties.id);thumbs=lib.d.getElementsByClassName("photoViewer","a",container);that.preload();setEvents();}
function setEvents(){if(thumbs){for(var a=0;a<thumbs.length;a++){if(thumbs[a].getAttribute("href")!=="javascript:;"){thumbs[a].fullsource=thumbs[a].href;thumbs[a].setAttribute("href","javascript:;");}
lib.e.removeListener(thumbs[a],properties.thumbEvent,thumbClick,that,true);lib.e.on(thumbs[a],properties.thumbEvent,thumbClick,that,true);thumbs[a].setAttribute("id","thumb_"+a);}
lib.e.on(window,"resize",adjustPosition);lib.e.on(window,"resize",adjustControls);lib.e.on(window,"scroll",adjustControls);}
if(!events.opeviewer){events.openviewer=new lib.ce("openviewer",this,true,1);}
if(!events.closeviewer){events.closeviewer=new lib.ce("closeviewer",this,true,1);}
if(!events.xmlload){events.xmlload=new lib.ce("xmlload",this,true,1);}
if(!events.viewerload){events.viewerload=new lib.ce("viewerload",this,true,1);}
if(!events.viewerupdated){events.viewerupdated=new lib.ce("viewerupdated",this,true,1);}
if(!events.beforelastphoto){events.beforelastphoto=new lib.ce("beforelastphoto",this,true,1);}
if(!events.lastphoto){events.lastphoto=new lib.ce("lastphoto",this,true,1);}
if(!events.play){events.play=new lib.ce("play",this,true,1);}
if(!events.stop){events.stop=new lib.ce("stop",this,true,1);}
if(!events.pause){events.pause=new lib.ce("pause",this,true,1);}
if(!events.flickrload){events.flickrload=new lib.ce("flickrload",this,true,1);}}
function thumbClick(e,scope){currentThumb=lib.e.getTarget(e);events.openviewer.fire(that);loadViewer(e);lib.e.preventDefault(e);}
function viewerLoaded(){if(showcaseImage.src===""||!showcaseImage.src){return;}
lib.d.setStyle(maskDom,"visibility","visible");hasLoaded[showcaseImage.src]=true;var widthTo=(lib.d.getRegion(showcaseImage).right-lib.d.getRegion(showcaseImage).left)+
parseInt(lib.d.getStyle(imageContDom,"padding-left"),10)+
parseInt(lib.d.getStyle(imageContDom,"padding-right"),10);if(!isVisible(viewerDom)){if(properties.fixedcenter){lib.d.setStyle(viewerDom,"width","10px");lib.d.setStyle(viewerDom,"height","10px");}
try{viewer.center();}catch(e){}
viewer.show();}
lib.d.setStyle(descDom,"width",widthTo+"px");var heightTo=lib.d.getRegion(showcaseImage).bottom-lib.d.getRegion(showcaseImage).top+
parseInt(lib.d.getStyle(imageContDom,"padding-top"),10)+
parseInt(lib.d.getStyle(imageContDom,"padding-bottom"),10)+
lib.d.getRegion(descDom).bottom-lib.d.getRegion(descDom).top+
lib.d.getRegion(headerDom).bottom-lib.d.getRegion(headerDom).top+
lib.d.getRegion(footerDom).bottom-lib.d.getRegion(footerDom).top;var topTo=(lib.d.getViewportHeight()/2)-(heightTo/2)-20+lib.d.getDocumentScrollTop();var leftTo=(lib.d.getViewportWidth()/2)-(widthTo/2)-20+lib.d.getDocumentScrollLeft();var attr={width:{to:widthTo},height:{to:heightTo},top:{to:topTo},left:{to:leftTo}};if(!properties.fixedcenter){var x=eval(properties.xy)[0];var y=eval(properties.xy)[1];attr={width:{to:widthTo},height:{to:heightTo}};lib.d.setStyle(viewerDom,"top",y+"px");lib.d.setStyle(viewerDom,"left",x+"px");}
var resize=new lib.a(viewerDom,attr,properties.grow,properties.easing);resize.animate();resize.onComplete.unsubscribe(fadeViewer);resize.onComplete.subscribe(fadeViewer);adjustPosition();resize=null;events.viewerload.fire();YAHOO.photoViewer.loading.off();}
function fadeViewer(){var fade=null;var domEls=[bodyDom,titleDom];for(var a=0;a<domEls.length;a++){fade=new lib.a(domEls[a],{opacity:{to:1}},properties.fade,properties.easing);fade.animate();}
fade.onComplete.unsubscribe(finishLoad);fade.onComplete.subscribe(finishLoad);fade=null;}
function finishLoad(){if((getThumbIndexFromId(currentThumb)+1)===(thumbs.length)){var flag=false;if(properties.slideShow){if(properties.slideShow.playMode==="ordered"){flag=true;}}
else{flag=true;}
if(flag){events.lastphoto.fire();}}}
function createControls(){var controlsZ=99999999999999999999;var defaultPlayText=properties.slideShow.controlsText.pause;var playClass="photoViewer-pause";controlsDom=document.createElement("div");controlsDom.setAttribute("id",properties.id+"-controls");lib.d.addClass(controlsDom,"photoViewer-controls");playDom=document.createElement("a");playDom.setAttribute("id",properties.id+"-play");lib.d.addClass(playDom,playClass);playDom.setAttribute("href","javascript:;");lib.e.on(playDom,"click",btnPlay);insertStr(playDom,defaultPlayText);stopDom=document.createElement("a");stopDom.setAttribute("id",properties.id+"-stop");lib.d.addClass(stopDom,"photoViewer-stop");stopDom.setAttribute("href","javascript:;");lib.e.on(stopDom,"click",btnStop);insertStr(stopDom,properties.slideShow.controlsText.stop);displayDom=document.createElement("span");displayDom.setAttribute("id",properties.id+"-display");lib.d.addClass(displayDom,"photoViewer-display");displayUpdate();controlsDom.appendChild(playDom);controlsDom.appendChild(stopDom);controlsDom.appendChild(displayDom);if(properties.slideShow.applyControls){lib.d.get(properties.slideShow.applyControls).appendChild(controlsDom);lib.d.addClass(controlsDom,"photoViewer-controls-relative");}
else{document.body.appendChild(controlsDom);lib.d.addClass(controlsDom,"photoViewer-controls-absolute");lib.d.setStyle(controlsDom,"z-index",controlsZ);var marginLeft=((lib.d.getRegion(controlsDom).right-lib.d.getRegion(controlsDom).left)/2)*-1;lib.d.setStyle(controlsDom,"margin-left",marginLeft+"px");}
events.viewerload.unsubscribe(displayUpdate);events.viewerload.subscribe(displayUpdate);events.lastphoto.unsubscribe(playBtnDisplay);events.lastphoto.subscribe(playBtnDisplay);}
function displayUpdate(){var displayText=properties.slideShow.controlsText.display;var newText="";newText=displayText.replace("{0}",Number(getThumbIndexFromId(currentThumb)+1));newText=newText.replace("{1}",thumbs.length);displayDom.innerHTML=newText;playBtnDisplay();}
function adjustControls(){if(YAHOO.env.ua.ie<7){if(controlsDom){var top=(lib.d.getViewportHeight()-controlsDom.offsetHeight)+(lib.d.getDocumentScrollTop()-10);lib.d.setY(controlsDom,top);}}
else{var bottom=10-lib.d.getDocumentScrollTop();lib.d.setStyle(controlsDom,"bottom",bottom+"px");}}
function btnPlay(){if(lib.d.hasClass(playDom,"photoViewer-play")){that.play();insertStr(playDom,properties.slideShow.controlsText.pause);lib.d.replaceClass(playDom,"photoViewer-play","photoViewer-pause");}
else{that.pause();insertStr(playDom,properties.slideShow.controlsText.play);lib.d.replaceClass(playDom,"photoViewer-pause","photoViewer-play");}}
function playBtnDisplay(){if(properties.slideShow.state!==2){insertStr(playDom,properties.slideShow.controlsText.play);lib.d.replaceClass(playDom,"photoViewer-pause","photoViewer-play");}
else{insertStr(playDom,properties.slideShow.controlsText.pause);lib.d.replaceClass(playDom,"photoViewer-play","photoViewer-pause");}}
function btnStop(){that.stop();insertStr(playDom,properties.slideShow.controlsText.play);lib.d.replaceClass(playDom,"photoViewer-pause","photoViewer-play");}
function createViewer(){var buttonText=properties.buttonText?properties.buttonText:defaultText;showcaseImage=document.createElement("img");lib.d.addClass(showcaseImage,"photoViewer-showcaseImage");lib.d.addClass(showcaseImage,"photoViewer-showcase");if(!viewerDom){viewerDom=document.createElement("div");viewerDom.setAttribute("id",properties.id+"-viewer");lib.d.addClass(viewerDom,"photoViewer-viewer");maskDom=document.createElement("div");maskDom.setAttribute("id",properties.id+"-mask");lib.d.addClass(maskDom,"photoViewer-mask");lib.d.setStyle(maskDom,"z-index",YAHOO.photoViewer.zIndex-1);headerDom=document.createElement("div");headerDom.setAttribute("id",properties.id+"-header");lib.d.addClass(headerDom,"photoViewer-header");titleDom=document.createElement("h1");titleDom.setAttribute("id",properties.id+"-title");lib.d.addClass(titleDom,"photoViewer-title");closeDom=document.createElement("a");var closeText=buttonText.close?buttonText.close:defaultText.close;insertStr(closeDom,closeText);closeDom.setAttribute("id",properties.id+"-close");closeDom.setAttribute("href","javascript:;");lib.d.addClass(closeDom,"photoViewer-close");lib.e.on(closeDom,"click",that.close);bodyDom=document.createElement("div");bodyDom.setAttribute("id",properties.id+"-body");lib.d.addClass(maskDom,"photoViewer-body");imageContDom=document.createElement("div");imageContDom.setAttribute("id",properties.id+"-imageCont");lib.d.addClass(imageContDom,"photoViewer-imageCont");descDom=document.createElement("div");descDom.setAttribute("id",properties.id+"-desc");lib.d.addClass(descDom,"photoViewer-desc");footerDom=document.createElement("div");footerDom.setAttribute("id",properties.id+"-footer");lib.d.addClass(footerDom,"photoViewer-footer");prevDom=document.createElement("a");var prevText=buttonText.prev?buttonText.prev:defaultText.prev;insertStr(prevDom,prevText);prevDom.setAttribute("id",properties.id+"-prev");prevDom.setAttribute("href","javascript:;");lib.d.addClass(prevDom,"photoViewer-prev");lib.e.on(prevDom,"click",that.prev);nextDom=document.createElement("a");var nextText=buttonText.next?buttonText.next:defaultText.next;insertStr(nextDom,nextText);nextDom.setAttribute("id",properties.id+"-next");nextDom.setAttribute("href","javascript:;");lib.d.addClass(nextDom,"photoViewer-next");lib.e.on(nextDom,"click",that.next);headerDom.appendChild(titleDom);headerDom.appendChild(closeDom);bodyDom.appendChild(imageContDom);imageContDom.appendChild(showcaseImage);bodyDom.appendChild(descDom);descDom.appendChild(document.createElement("p"));footerDom.appendChild(prevDom);footerDom.appendChild(nextDom);if(properties.modal){document.body.appendChild(maskDom);}
if(properties.position==="absolute"||!properties.container){document.body.appendChild(viewerDom);}
else{lib.d.get(properties.container).appendChild(viewerDom);}
if(properties.dragable){var dragObj=new YAHOO.photoViewer.DDOnTop(viewerDom.getAttribute("id"));dragObj.setHandleElId(titleDom.getAttribute("id"));lib.d.setStyle(titleDom,"cursor","move");lib.e.on(viewerDom,"click",function(){lib.d.setStyle(this,"z-index",YAHOO.photoViewer.zIndex++);});}}
var posXY=properties.xy?properties.xy:null;var type,attr;if(properties.position==="absolute"){type=YAHOO.widget.Overlay;attr={xy:eval(posXY),fixedcenter:properties.fixedcenter,constraintoviewport:true,visible:false,zIndex:YAHOO.photoViewer.zIndex,effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:properties.fade}};}
else{type=YAHOO.widget.Module;attr={visible:true};lib.d.setStyle(viewerDom,"position","relative");}
viewer=new type(properties.id+"-viewer",attr);viewer.setHeader(headerDom);viewer.setBody(bodyDom);viewer.setFooter(footerDom);viewer.render();}
function adjustPosition(){var width=(lib.d.getDocumentWidth()>lib.d.getViewportWidth())?lib.d.getDocumentWidth():lib.d.getViewportWidth();var height=(lib.d.getDocumentHeight()>lib.d.getViewportHeight())?lib.d.getDocumentHeight():lib.d.getViewportHeight();lib.d.setStyle(maskDom,"width",width+"px");lib.d.setStyle(maskDom,"height",height+"px");}
function isVisible(el){if(lib.d.getStyle(el,"visibility")==="visible"){return true;}
else{return false;}}
function insertStr(el,str,append){append=append?append:false;if(append){el.innerHTML+=str;}
else{el.innerHTML=str;}}
function testForThumb(el){return lib.d.hasClass(el,"photoViewer");}
function mid(str,start,len){if(start<0||len<0){return"";}
var iEnd,iLen=String(str).length;if(start+len>iLen){iEnd=iLen;}
else{iEnd=start+len;}
return String(str).substring(start,iEnd);}};YAHOO.photoViewer.loading=function(){var loadingScreen=null;var applyTo=null;var myPublic={on:function(config){if(!config){config={};}
applyTo=config.applyTo?lib.d.get(config.applyTo):document.body;createLoadingScreen();},off:function(){lib.d.setStyle(loadingScreen,"display","none");},destroy:function(){if(loadingScreen){loadingScreen.parentNode.removeChild(loadingScreen);loadingScreen=null;}}};function createLoadingScreen(){if(!loadingScreen){loadingScreen=document.createElement("div");loadingScreen.setAttribute("id","photoViewer-loading");lib.d.addClass(loadingScreen,"photoViewer-loading");lib.d.setStyle(loadingScreen,"position","absolute");lib.d.setStyle(loadingScreen,"display","none");document.body.appendChild(loadingScreen);}
position();lib.d.setStyle(loadingScreen,"display","block");lib.d.setStyle(loadingScreen,"z-index",YAHOO.photoViewer.zIndex+10);}
function position(){lib.d.setStyle(loadingScreen,"top",lib.d.getRegion(applyTo).top+"px");lib.d.setStyle(loadingScreen,"left",lib.d.getRegion(applyTo).left+"px");lib.d.setStyle(loadingScreen,"width",(lib.d.getRegion(applyTo).right-lib.d.getRegion(applyTo).left)+"px");lib.d.setStyle(loadingScreen,"height",(lib.d.getRegion(applyTo).bottom-lib.d.getRegion(applyTo).top)+"px");if(applyTo.tagName.toLowerCase()==="body"){if((lib.d.getRegion(applyTo).bottom-lib.d.getRegion(applyTo).top)<lib.d.getViewportHeight()){lib.d.setStyle(loadingScreen,"height",lib.d.getViewportHeight()+"px");}}}
return myPublic;}();YAHOO.photoViewer.DDOnTop=function(id,sGroup,config){YAHOO.photoViewer.DDOnTop.superclass.constructor.apply(this,arguments);};YAHOO.extend(YAHOO.photoViewer.DDOnTop,YAHOO.util.DD,{startDrag:function(x,y){var style=this.getEl().style;style.zIndex=YAHOO.photoViewer.zIndex++;},endDrag:function(x,y){var pos="["+lib.d.getRegion(this.getEl()).left+","+lib.d.getRegion(this.getEl()).top+"]";var id=this.getEl().id.split("-");id.splice(id.length-1,1);id=id.join("-");YAHOO.photoViewer.controller.getViewer(id).setProperty("xy",pos);}});YAHOO.photoViewer.zIndex=1000;YAHOO.photoViewer.controller=function(){var viewers={};var myPublic={init:function(){for(var a in YAHOO.photoViewer.config.viewers){viewers[a]=new YAHOO.photoViewer.base(YAHOO.photoViewer.config.viewers[a].properties.id);viewers[a].init();}},getViewer:function(id){if(viewers[id]){return viewers[id];}},getViewers:function(){return viewers;},removeViewer:function(id){delete viewers[id];},viewers:viewers};return myPublic;}();lib.e.onDOMReady(YAHOO.photoViewer.controller.init,YAHOO.photoViewer.controller,YAHOO.photoViewer.controller);