jQuery.noConflict()
function reelslideshow(a){
var $=jQuery
this.setting={displaymode:{type:'auto',pause:2000,cycles:2,pauseonmouseover:true},orientation:'h',persist:true,slideduration:500}
jQuery.extend(this.setting,a)
var b=(this.setting.persist)?reelslideshow.routines.getCookie("slider-"+this.setting.wrapperid):0
this.curslide=(b==null||b>this.setting.imagearray.length-1)?0:parseInt(b)
this.curstep=0
this.zIndex=1
this.animation_isrunning=false
this.posprop=(this.setting.orientation=="h")?"left":"top"
a=null
var c=this,d=this.setting,e=[],slidesHTML=''
for(var i=0;i<d.imagearray.length;i++){
e[i]=new Image()
e[i].src=d.imagearray[i][0]
slidesHTML+=reelslideshow.routines.getSlideHTML(d.imagearray[i],d.dimensions[0]+'px',d.dimensions[1]+'px',this.posprop)+'\n'
}
jQuery(function($){
c.init($,slidesHTML)})
$(window).bind('unload',function(){
if(c.setting.persist)
reelslideshow.routines.setCookie("slider-"+d.wrapperid,c.curslide)})}
reelslideshow.prototype={
slide:function(a,b){
if(this.curslide==a)
return
var c=this
var d=this.setting.dimensions[(b=="right"||b=="left")?0:1]*((b=="right"||b=="down")?-1:1)
var e=-d
var f=this.posprop
if(this.animation_isrunning!=null)
this.animation_isrunning=true
this.$imageslides.eq(b=="left"||b=="top"?a:this.curslide).css("zIndex",++this.zIndex)
this.$imageslides.eq(a).css(reelslideshow.routines.createobj(['visibility','visible'],[f,d]))
.animate(reelslideshow.routines.createobj([f,0]),this.setting.slideduration,function(){c.animation_isrunning=false})
this.$imageslides.eq(this.curslide).animate(reelslideshow.routines.createobj([f,e]),this.setting.slideduration,function(){jQuery(this).css("visibility","hidden")})
this.curslide=a},
navigate:function(a){
clearTimeout(this.rotatetimer)
var b=(a=="back")?(this.setting.orientation=="h"?"right":"down"):(this.setting.orientation=="h"?"left":"up")
var c=(a=="back")?this.curslide-1:this.curslide+1
c=(c<0)?this.$imageslides.length-1:(c>this.$imageslides.length-1)?0:c
if(this.animation_isrunning==false)
this.slide(c,b)},
rotate:function(){
var a=this
if(this.ismouseover){
this.rotatetimer=setTimeout(function(){a.rotate()},this.setting.displaymode.pause)
return
}
var b=(this.curslide<this.$imageslides.length-1)?this.curslide+1:0
this.slide(b,this.posprop)
if(this.setting.displaymode.cycles==0||this.curstep<this.maxsteps-1){
this.rotatetimer=setTimeout(function(){a.rotate()},this.setting.displaymode.pause)
this.curstep++
}},
init:function($,a){
var b=this,c=this.setting
this.$wrapperdiv=$('#'+c.wrapperid).css({position:'relative',visibility:'visible',overflow:'hidden',width:c.dimensions[0],height:c.dimensions[1]})
if(this.$wrapperdiv.length==0){
alert("Error: DIV with ID \""+c.wrapperid+"\" not found on page.")
return
}
this.$wrapperdiv.html(a)
this.$imageslides=this.$wrapperdiv.find('div.slide')
this.$imageslides.eq(this.curslide).css(reelslideshow.routines.createobj([this.posprop,0]))
if(this.setting.displaymode.type=="auto"){
this.setting.displaymode.pause+=this.setting.slideduration
this.maxsteps=this.setting.displaymode.cycles*this.$imageslides.length
if(this.setting.displaymode.pauseonmouseover){
this.$wrapperdiv.mouseenter(function(){b.ismouseover=true})
this.$wrapperdiv.mouseleave(function(){b.ismouseover=false})}
this.rotatetimer=setTimeout(function(){b.rotate()},this.setting.displaymode.pause)}}}
reelslideshow.routines={
getSlideHTML:function(a,w,h,b){
var c=b+":"+((b=="left")?w:h)
var d=(a[1])?'<a href="'+a[1]+'" target="'+a[2]+'">':''
d+='<img src="'+a[0]+'" style="border-width:0;" />'
d+=(a[1])?'</a>':''
return '<div class="slide" style="position:absolute;'+c+';width:'+w+';height:'+h+';text-align:center;">'
+'<div style="width:'+w+';height:'+h+';display:table-cell;vertical-align:middle;">'
+d
+'</div></div>'},
getCookie:function(a){
var re=new RegExp(a+"=[^;]+","i");
if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null},
setCookie:function(a,b){
document.cookie=a+"="+b+";path=/"},
createobj:function(){
var a={}
for(var i=0;i<arguments.length;i++){
a[arguments[i][0]]=arguments[i][1]}
return a
}}

