NG.Slideshow=function(){};NG.Slideshow.instantiate=function(c){var a=function(){};a.prototype=this;var b=new a();b.initialize(c);return b};NG.Slideshow.initialize=function(g){this.cmsID=g;this.node=document.getElementById("slideshow-"+g);this.photos=[];this.current=0;this.speed=30;this.interval=10000;this.opacity=0;var c=this;var d=this.node.getElementsByTagName("div");for(var b=0;b<d.length;b++){if(NG.hasClass(d[b],"slideshow-image")){this.imageNode=d[b]}if(NG.hasClass(d[b],"slideshow-caption")){this.captionNode=d[b]}if(NG.hasClass(d[b],"slideshow-nav")){this.navNode=d[b]}}var e=this.node.getElementsByTagName("a");for(var b=0;b<e.length;b++){NG.addEventListener(e[b],"click",function(h){clearTimeout(c.fader);c.stop();c.fadeTo(parseInt(this.innerHTML)-1);c.run();c.cancleEvent(h)})}this.fade();var a=this;NG.addEventListener(this.imageNode,"click",function(h){a.click(h)});NG.addEventListener(this.imageNode.parentNode,"click",function(h){a.click(h)});var f=this.node.getElementsByTagName("img");if(f[this.current].parentNode.nodeName=="A"){this.imageNode.parentNode.style.cursor="pointer"}};NG.Slideshow.run=function(){var c=this.imageNode.getElementsByTagName("img");var a=c[this.current].getAttribute("ngcms:interval")*1000||this.interval;var b=this;this.runner=setTimeout(function(){b.fadeToNext();b.run()},a)};NG.Slideshow.stop=function(){clearTimeout(this.runner)};NG.Slideshow.setOpacity=function(a){this.opacity=a;var b=this.imageNode.getElementsByTagName("img");b[this.current].style.opacity=(a/100);b[this.current].style.MozOpacity=(a/100);b[this.current].style.KhtmlOpacity=(a/100);b[this.current].style.filter="alpha(opacity="+a+")"};NG.Slideshow.fadeTo=function(b){if(this.current==b){return}clearTimeout(this.fader);var c=this.imageNode.getElementsByTagName("img");if(b>=c.length){b=0}c[this.current].style.display="none";this.current=b;this.setOpacity(0);c[b].style.display="block";var a=this;this.fader=setTimeout(function(){a.fade()},this.speed)};NG.Slideshow.fadeToNext=function(){this.fadeTo(this.current+1)};NG.Slideshow.fade=function(){this.setOpacity(this.opacity+3);if(this.opacity<100){var e=this;this.fader=setTimeout(function(){e.fade()},this.speed)}else{var f=this.node.getElementsByTagName("img");this.imageNode.style.backgroundImage="url("+f[this.current].src+")";f[this.current].style.display="none";if(this.captionNode){this.captionNode.innerHTML=f[this.current].alt}if(this.navNode){var b=this.navNode.getElementsByTagName("a");for(var d=0;d<b.length;d++){if(NG.hasClass(b[d],"selected")){NG.delClass(b[d],"selected")}}NG.addClass(b[this.current],"selected")}if(f[this.current].parentNode.nodeName=="A"){if(this.imageNode.lastChild.nodeName=="A"){this.imageNode.removeChild(this.imageNode.lastChild)}var c=document.createElement("a");c.href=f[this.current].parentNode.href;c.title=f[this.current].parentNode.title;c.className="link";this.imageNode.appendChild(c);this.imageNode.parentNode.style.cursor="pointer"}else{this.imageNode.parentNode.style.cursor="default"}}};NG.Slideshow.click=function(a){var b=this.node.getElementsByTagName("img");if(b[this.current].parentNode.nodeName=="A"){document.location=b[this.current].parentNode.href}};NG.Slideshow.cancleEvent=function(a){if(!a){a=window.event}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}};