/* PHOTO MORPHER v1.0beta (c) 2004-2006 Angus Turnbull, http://www.twinhelix.com Altering this notice or redistributing this file is prohibited. */ if(typeof addEvent!='function'){var addEvent=function(o,t,f,l){var d='addEventListener',n='on'+t,rO=o,rT=t,rF=f,rL=l;if(o[d]&&!l)return o[d](t,f,false);if(!o._evts)o._evts={};if(!o._evts[t]){o._evts[t]=o[n]?{b:o[n]}:{};o[n]=new Function('e','var r=true,o=this,a=o._evts["'+t+'"],i;for(i in a){o._f=a[i];r=o._f(e||window.event)!=false&&r;o._f=null}return r');if(t!='unload')addEvent(window,'unload',function(){removeEvent(rO,rT,rF,rL)})}if(!f._i)f._i=addEvent._i++;o._evts[t][f._i]=f};addEvent._i=1;var removeEvent=function(o,t,f,l){var d='removeEventListener';if(o[d]&&!l)return o[d](t,f,false);if(o._evts&&o._evts[t]&&f._i)delete o._evts[t][f._i]}}function PhotoMorpher(myName,areaID,listID,itemClass,applyClasses){this.myName=myName;this.areaID=areaID;this.listID=listID;this.itemClass=itemClass;this.applyClasses=applyClasses;this.list=null;this.area=null;this.images=[];this.activeImage=0;this.currentItem=null;this.loaded=false;this.loading=false;this.fadeSteps=5;this.fadeVal=0;this.fadeTimer=null;this.autoPlay=false;this.autoDelay=10000;this.autoPreload=true;this.autoTimer=null;if(document.getElementById&&document.createElement&&document.documentElement)addEvent(window,'load',new Function(myName+'.init()'))};PhotoMorpher.prototype.init=function(){with(this){list=document.getElementById(listID);area=document.getElementById(areaID);if(!list||!area)return;var container=document.createElement('div');container.style.position='relative';area.appendChild(container);images[0]=document.createElement('img');images[0].style.position='relative';images[0].style.zIndex=2;container.appendChild(images[0]);images[1]=document.createElement('img');images[1].style.position='absolute';images[1].style.left=images[1].style.top='0px';images[1].style.zIndex=1;container.appendChild(images[1]);for(var i=0;i<2;i++){images[i]._pgWidth=images[i]._pgHeight=-1;images[i]._pgWidth=images[i]._pgHeight=-1;addEvent(images[i],'load',new Function('clearTimeout('+myName+'.fadeTimer);'+myName+'.fadeTimer=setInterval("'+myName+'.fade(0)",10)'));if(images[i].filters)images[i].style.filter+='alpha(opacity=0)';else images[i].style.opacity=images[i].style.MozOpacity=0}for(var i=0;i100){clearTimeout(fadeTimer);fadeVal=0;loading=false;if(oldI.filters&&oldI.filters.length&&oldI.filters.alpha){newI.filters.alpha.enabled=false;oldI.filters.alpha.opacity=0}else oldI.style.opacity=oldI.style.MozOpacity=0;if(autoPlay){autoTimer=setTimeout(myName+'.next()',autoDelay);if(autoPreload){var nextItem=currentItem;do{nextItem=nextItem.nextSibling||nextItem.parentNode.firstChild}while(nextItem.nodeType!=1);this.autoPreloadImage=new Image();autoPreloadImage.src=this.getItemDetails(nextItem).src}}return}if(!fadeVal||(oldI._pgWidth!=newI._pgWidth)||(oldI._pgHeight!=newI._pgHeight)){var newWidth=parseInt(oldI._pgWidth+fadeVal*(newI._pgWidth-oldI._pgWidth)/100);newI.style.width=oldI.style.width=newWidth+'px';area.style.width=newWidth+'px';var newHeight=parseInt(oldI._pgHeight+fadeVal*(newI._pgHeight-oldI._pgHeight)/100);newI.style.height=oldI.style.height=newHeight+'px';area.style.height=newHeight+'px'}if(newI.filters&&newI.filters.length&&newI.filters.alpha){if(!newI.filters.alpha.enabled)newI.filters.alpha.enabled=true;newI.filters.alpha.opacity=parseInt(fadeVal)}else newI.style.opacity=newI.style.MozOpacity=fadeVal/100.1;newI.style.zIndex=2;oldI.style.zIndex=1;fadeVal+=100/fadeSteps}};PhotoMorpher.prototype.next=function(){with(this){if(!loaded)return;var newItem=currentItem;do{newItem=newItem.nextSibling||newItem.parentNode.firstChild}while(newItem.nodeType!=1);display(newItem)}};PhotoMorpher.prototype.prev=function(){with(this){if(!loaded)return;var newItem=currentItem;do{newItem=newItem.previousSibling||newItem.parentNode.lastChild}while(newItem.nodeType!=1);display(newItem)}};PhotoMorpher.prototype.play=function(timer){with(this){if(timer)autoDelay=timer;autoPlay=!autoPlay;if(!autoPlay)clearTimeout(autoTimer);else next()}};