﻿(function(a){a.fn.jCarouselLite=function(e){e=a.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:1,start:0,scroll:1,beforeStart:null,afterEnd:null},e||{});return this.each(function(){var n=false,f=e.vertical?"top":"left",o=e.vertical?"height":"width";var h=a(this),r=a("ul",h),q=a("li",r),p=q.size(),t=e.visible;if(e.circular){r.prepend(q.slice(p-t-1+1).clone()).append(q.slice(0,t).clone());e.start+=t}var l=a("li",r),k=l.size(),g=e.start;h.css("visibility","visible");l.css({overflow:"hidden","float":e.vertical?"none":"left"});r.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});h.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var m=e.vertical?c(l):d(l);var s=m*k;var i=m*t;l.css({width:l.width(),height:l.height()});r.css(o,s+"px").css(f,-(g*m));h.css(o,i+"px");if(e.btnPrev){a(e.btnPrev).click(function(){return j(g-e.scroll)})}if(e.btnNext){a(e.btnNext).click(function(){return j(g+e.scroll)})}if(e.btnGo){a.each(e.btnGo,function(v,w){a(w).click(function(){return j(e.circular?e.visible+v:v)})})}if(e.mouseWheel&&h.mousewheel){h.mousewheel(function(w,v){return v>0?j(g-e.scroll):j(g+e.scroll)})}if(e.auto){autoScroll=setInterval(function(){j(g+e.scroll)},e.auto+e.speed);h.hover(function(){clearInterval(autoScroll)},function(){autoScroll=setInterval(function(){j(g+e.scroll)},e.auto+e.speed)})}function u(){return l.slice(g).slice(0,t)}function j(v){if(!n){if(e.beforeStart){e.beforeStart.call(this,u())}if(e.circular){if(v<=e.start-t-1){r.css(f,-((k-(t*2))*m)+"px");g=v==e.start-t-1?k-(t*2)-1:k-(t*2)-e.scroll}else{if(v>=k-t+1){r.css(f,-((t)*m)+"px");g=v==k-t+1?t+1:t+e.scroll}else{g=v}}}else{if(v<0||v>k-t){return}else{g=v}}n=true;r.animate(f=="left"?{left:-(g*m)}:{top:-(g*m)},e.speed,e.easing,function(){if(e.afterEnd){e.afterEnd.call(this,u())}n=false});if(!e.circular){a(e.btnPrev+","+e.btnNext).removeClass("disabled");a((g-e.scroll<0&&e.btnPrev)||(g+e.scroll>k-t&&e.btnNext)||[]).addClass("disabled")}}return false}})};function b(e,f){return parseInt(a.css(e[0],f))||0}function d(e){return e[0].offsetWidth+b(e,"marginLeft")+b(e,"marginRight")}function c(e){return e[0].offsetHeight+b(e,"marginTop")+b(e,"marginBottom")}})(jQuery);var offsetfrommouse=[-250,30];var displayduration=0;var currentimageheight;var currentimagewidth;var imageEdgeBuffer=50;var loadingImage="img/loading.gif";var loadingImageWidth="50px";var loadingImageHeight="50px";if(document.getElementById||document.all){document.write('<div id="trailimageid">');document.write("</div>")}function gettrailobj(){if(document.getElementById){return document.getElementById("trailimageid").style}else{if(document.all){return document.all.trailimagid.style}}}function gettrailobjnostyle(){if(document.getElementById){return document.getElementById("trailimageid")}else{if(document.all){return document.all.trailimagid}}}function truebody(){return(!window.opera&&document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body}function showtrail(b,c,a){if(a>0){currentimageheight=a}if(c>0){currentimagewidth=c}document.onmousemove=followmouse;imgPreloader=new Image();gettrailobjnostyle().innerHTML='<img id="loadingImage" src="'+loadingImage+'" border="0">';gettrailobj().height=loadingImageHeight;gettrailobj().width=loadingImageWidth;imgPreloader.onload=function(){gettrailobj().height=currentimageheight+"px";gettrailobj().width=currentimagewidth+"px";gettrailobjnostyle().innerHTML='<img src="'+imgPreloader.src+'" border="0">'};imgPreloader.src=b;gettrailobj().visibility="visible"}function hidetrail(){gettrailobj().visibility="hidden";document.onmousemove="";gettrailobj().left="-500px";gettrailobjnostyle().innerHTML="";gettrailobj().height=loadingImageHeight;gettrailobj().width=loadingImageWidth}function followmouse(c){var d=offsetfrommouse[0];var f=offsetfrommouse[1];var b=document.all?truebody().scrollLeft+truebody().clientWidth:pageXOffset+window.innerWidth-15;var a=document.all?Math.min(truebody().scrollHeight,truebody().clientHeight):Math.min(window.innerHeight);if(typeof c!="undefined"){if(b-c.pageX<currentimagewidth){d=c.pageX-d-width}else{d+=c.pageX}if(a-c.pageY<(currentimageheight+imageEdgeBuffer)){f+=c.pageY-Math.max(0,(imageEdgeBuffer+currentimageheight+c.pageY-a-truebody().scrollTop))}else{f+=c.pageY}}else{if(typeof window.event!="undefined"){if(b-event.clientX<currentimagewidth){d=event.clientX+truebody().scrollLeft-d-currentimagewidth}else{d+=truebody().scrollLeft+event.clientX}if(a-event.clientY<(currentimageheight+imageEdgeBuffer)){f+=event.clientY+truebody().scrollTop-Math.max(0,(imageEdgeBuffer+currentimageheight+event.clientY-a))}else{f+=truebody().scrollTop+event.clientY}}}var b=document.all?truebody().scrollLeft+truebody().clientWidth:pageXOffset+window.innerWidth-15;var a=document.all?Math.max(truebody().scrollHeight,truebody().clientHeight):Math.max(document.body.offsetHeight,window.innerHeight);if(f<0){f=f*-1}gettrailobj().left=d+"px";gettrailobj().top=f+"px"}$(function(){$(".stepcarousel").jCarouselLite({btnNext:".next",btnPrev:".prev",auto:2000,speed:2000})});
