// Copyright (c) 2005 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// 
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
var Scriptaculous={Version:'1.5.1',require:function(libraryName){document.write('<script type="text/javascript" src="'+libraryName+'"></script>');},load:function(){if((typeof Prototype=='undefined')||parseFloat(Prototype.Version.split(".")[0]+"."+
Prototype.Version.split(".")[1])<1.4)
throw("script.aculo.us requires the Prototype JavaScript framework >= 1.4.0");$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z,]*)/);(includes?includes[1]:'builder,effects,dragdrop,controls,slider').split(',').each(function(include){Scriptaculous.require(path+include+'.js')});});}}
Scriptaculous.load();var MDSK={}
MDSK.Slideshow=Class.create();MDSK.Slideshow.DefaultOptions={duration:0.6,seconds_per_slide:3.0,numOfSlides:0,pause_on_mouseover:false,onChange:function(){}}
Object.extend(MDSK.Slideshow.prototype,{initialize:function(container,slide_selector,options){var me=this;this.options=Object.extend(Object.extend({},MDSK.Slideshow.DefaultOptions),options||{});this.container=$(container);this.slides=Selector.findChildElements(this.container,[slide_selector]);this.slides.sort(function(a,b){return me.rndm(1);});this.currentSlide=0;this.paused=false;var self=this;var Found=false
this.slides.each(function(slide,idx){if(idx>0)Element.hide(slide);if(self.options.pause_on_mouseover){Event.observe(slide,'mouseover',self.pause.bind(self))
Event.observe(slide,'mouseout',self.unpause.bind(self))}})
this.slides[0].style.display="block";this.numOfSlides=this.slides.length;this.start();this.options.onChange(this);},forward:function(){var newSlideIdx=this.currentSlide+1;if(newSlideIdx>=this.slides.length)newSlideIdx=0;this.transition(newSlideIdx);},backward:function(){var newSlideIdx=this.currentSlide-1;if(newSlideIdx<0)newSlideIdx=this.slides.length-1;var currNum=newSlideIdx+1;var num1=document.getElementById("numDisp");num1.src=null;num1.src=""+currNum+".jpg";this.transition(newSlideIdx);},jumpToSlide:function(idx){if(idx<0||idx>=this.slides.length)return false;this.stop();this.transition(idx);for(i=0;i<this.slides.length;i++)
{var nam=document.getElementById("showStyle"+i);if(idx==i)
{nam.style.backgroundColor="#B9B9B9";}
else
{nam.style.backgroundColor="#FFFFFF";}}},start:function(){if(this.interval)return;this.interval=setInterval(this.forward.bind(this),this.options.seconds_per_slide*1000);this.container.addClassName('playing');},stop:function(){if(!this.interval)return;clearInterval(this.interval);this.interval=null;this.container.removeClassName('playing');},pausePlay:function(){if(this.interval)this.stop();else this.start();},rndm:function(min,max){return Math.floor(Math.random()*(max-min+1)+min);},transition:function(newSlideIdx){var oldSlideIdx=this.currentSlide;if(newSlideIdx==oldSlideIdx)return;if(this.fadeIn&&this.fadeIn.state!='finished')this.fadeIn.cancel();if(this.fadeOut&&this.fadeOut.state!='finished'){this.fadeOut.cancel();Element.hide(this.fadeOut.element);}
this.fadeOut=new Effect.Fade(this.slides[oldSlideIdx],{duration:this.options.duration});this.fadeIn=new Effect.Appear(this.slides[newSlideIdx],{duration:this.options.duration});this.currentSlide=newSlideIdx;this.options.onChange(this);for(i=0;i<this.slides.length;i++)
{var nam=document.getElementById("showStyle"+i);if(this.currentSlide==i)
{nam.style.backgroundColor="#990000";}
else
{nam.style.backgroundColor="#FFFFFF";}}}});function writeSlides(numOfSlides)
{var compNum=numOfSlides-1;for(i=0;i<numOfSlides;i++)
{var k=numOfSlides;var j=k-i;var l=j-1;document.write("<div id=\"showStyle"+l+"\"><a name=\"target\" href=\"javascript:slideshow.jumpToSlide("+l+"); pauseAlways();\" id=\"slideAnchors\">&nbsp;&nbsp;"+j+"&nbsp;&nbsp;<\/a><\/div>");if(i!=compNum)
{document.write("<div id=\"dividerLine\"><\/div>");}}}
var playPauseBtn=null;var togl=null;function btnController()
{playPauseBtn=document.getElementById('playPauseButton');togl="false";toggle();}
function toggle()
{if(togl=="false")
{playPauseBtn.src=null;playPauseBtn.src="graphics/pause.jpg";playPauseBtn.alt="pause";togl="true";}
else
{playPauseBtn.src=null;playPauseBtn.src="graphics/play.jpg";playPauseBtn.alt="play";togl="false";}}
function pauseAlways()
{playPauseBtn.src=null;playPauseBtn.src="graphics/play.jpg";playPauseBtn.alt="play";togl="false";}