;(function($){var container=null;var allImgs='',allLIs='',containerStr='';var element=this;var _bgStretcherPause=false;var _bgStretcherTm=null;$.fn.bgStretcher=function(settings){settings=$.extend({},$.fn.bgStretcher.defaults,settings);$.fn.bgStretcher.settings=settings;function _build(){if(!settings.images.length){return}_genHtml();containerStr='#'+settings.imageContainer;container=$(containerStr);allImgs='#'+settings.imageContainer+' IMG';allLIs='#'+settings.imageContainer+' LI';$(allLIs).hide();$(allLIs+':last').addClass('bgs-last');$(allLIs+':first').show().addClass('bgs-current');if(!container.length){return}$(window).resize(_resize);_resize()};function _resize(){var winW=$(window).width();var winH=$(window).height();var imgW=0,imgH=0;container.width(winW);container.height(winH);if(!settings.resizeProportionally){imgW=winW;imgH=winH}else{var initW=settings.imageWidth,initH=settings.imageHeight;var ratio=initH/initW;imgW=winW;imgH=winW*ratio;if(imgH<winH){imgH=winH;imgW=imgH/ratio}}$(allImgs).width(imgW).height(imgH)};function _genHtml(){var code='<div id="'+settings.imageContainer+'" class="bgstretcher"><ul>';for(i=0;i<settings.images.length;i++){code+='<li><img src="'+settings.images[i]+'" alt="" /></li>'}code+='</ul></div>';$(code).appendTo('body')};_build()};$.fn.bgStretcher.play=function(){$.fn.bgStretcher.slideShow()};$.fn.bgStretcher.rewind=function(){$.fn.bgStretcher.rewindSlideShow()};$.fn.bgStretcher.slideShow=function(){var current=$(containerStr+' LI.bgs-current');var next=current.next();if(!next.length){next=$(containerStr+' LI:first')}$(containerStr+' LI').removeClass('bgs-current');next.addClass('bgs-current');next.show('slide',{direction:'right'},"slow");var slideit="-"+current.width()+"px";current.animate({"left":slideit},"slow",function(){current.hide();current.css("left","0px")})};$.fn.bgStretcher.rewindSlideShow=function(){var current=$(containerStr+' LI.bgs-current');var next=current.prev();if(!next.length){next=$(containerStr+' LI:last')}$(containerStr+' LI').removeClass('bgs-current');next.addClass('bgs-current');next.show('slide',{direction:'left'},"slow");var slideit=current.width()+"px";current.animate({"left":slideit},"slow",function(){current.hide();current.css("left","0px")})};$.fn.bgStretcher.defaults={imageContainer:'bgstretcher',resizeProportionally:true,resizeAnimate:false,images:[],imageWidth:1024,imageHeight:768,nextSlideDelay:5000,slideShowSpeed:'normal',slideShow:true};$.fn.bgStretcher.settings={}})(jQuery);