var fullpageslideshow={
imagesarr:[], layers:null, thumbs:null, layerorder:{fg:1, bg:0}, curimage:0, previmage:0,
setting:{fadeduration:1000, autorotate:{enabled:true, pause:3000}, thumbdimensions:[50,50], sortby:'date', thumbdir:''},
signalcomplete:function(){
var slideshow=this, imagesarr=this.imagesarr, thumbs=this.thumbs, templayer=this.templayer, setting=this.setting, imagecount=0
function createthumbnail(i, imageref, thumbref){
var thumbimgsrc=(setting.imagesobj.baseurl)? setting.thumbdir+setting.imagesobj.images[i][1] : imageref.src
thumbref.html('')
thumbref.find('img:eq(0)').css({opacity:0.3})
}
function process(i, imageref, thumbref){
templayer.append('')
var tempimage=templayer.find('img:last')
imageref._specs={w:tempimage.width(), h:tempimage.height()}
thumbref.find('img:eq(0)').css({opacity:1})
if (i==slideshow.curimage){ //if first image has loaded
slideshow.changeimage(slideshow.curimage, true)
if (setting.autorotate.enabled)
setting.rotatetimer=setInterval(function(){slideshow.cycleimage()}, setting.autorotate.pause)
}
imagecount++
if (imagecount==imagesarr.length){
templayer.remove()
}
}
for (var i=0; iod.h)? windoww : Math.round(windowh*od.w/od.h)
var newh=Math.round(neww*od.h/od.w)
if (neww>windoww){
neww=windoww
newh=Math.round(neww*od.h/od.w)
}
else if (newh>windowh){
newh=windowh
neww=Math.round(newh*od.w/od.h)
}
var xpos=(neww>=windoww)? 0 : windoww/2-neww/2
var ypos=(newh>=windowh)? 0 : windowh/2-newh/2
return {width:neww+'px', height:newh+'px', left:xpos+'px', top:ypos+'px', position:'absolute'}
},
changeimage:function(i, forcechange){
var layers=this.layers, imagesarr=this.imagesarr, layerorder=this.layerorder, thumbs=this.thumbs, setting=this.setting
var fglayer=layers.eq(layerorder.fg), bglayer=layers.eq(layerorder.bg)
if (!imagesarr[i].complete && typeof forcechange=="undefined")
return
bglayer.stop(true,true).css({opacity:1, zIndex:999}).empty().append($('').css(this.scaleimage(imagesarr[i]))) //update background layer's image
fglayer.css({opacity:1, zIndex:1000}).stop(true,true).animate({opacity:0}, setting.fadeduration, function(){
bglayer.css('z-index', 1000)
fglayer.css('z-index', 999)
})
layerorder.fg=layerorder.fg==1? 0 : 1
layerorder.bg=layerorder.bg==1? 0 : 1
this.previmage=this.curimage
this.curimage=i
thumbs.eq(this.previmage).find('img:eq(0)').removeClass('selected')
thumbs.eq(i).find('img:eq(0)').addClass('selected')
},
cycleimage:function(){
var nextimage=(this.curimagefileb)? 1 : 0
})
}
}
var thumbsarr=['']
for (var i=0; i')
}
thumbsarr.push('
')
jQuery(function($){
var slideshow=fullpageslideshow
var layers=$('').clone().andSelf().appendTo(document.body)
var thumbs=$(thumbsarr.join('')).appendTo(document.body)
thumbs=thumbs.find('li')
thumbs.each(function(i){
var $thumb=$(this)
this._index=i
$thumb.css({left: 60*i+20})
$thumb.click(function(){
clearTimeout(slideshow.setting.rotatetimer)
slideshow.changeimage(this._index)
})
})
slideshow.layers=layers
slideshow.thumbs=thumbs
slideshow.templayer=$('').appendTo(document.body)
slideshow.signalcomplete()
$(window).resize(function(){
if (imagesarr[slideshow.curimage].complete==true)
var cssattr=slideshow.scaleimage(imagesarr[slideshow.curimage])
slideshow.layers.eq(slideshow.layerorder.fg).find('img').css(cssattr)
})
})
}
}
/////////////INITIALIZE SCRIPT BELOW:
fullpageslideshow.init({ //initialize script
imagesobj: fpslideshowvar, //no need to change. Object variable referencing images as generated inside "fpslideshow.php"
thumbdir: 'thumbnails', //sub directory directly below main images directory containing the thumbnail versions. Image names should be same as main images.
sortby: 'date', //sort by "date" or "filename"
fadeduration: 1000,
thumbdimensions:[30,30],
autorotate:{enabled:true, pause:4000}
})