var stepcarousel={ajaxloadingmsg:'<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>',defaultbuttonsfade:.4,configholder:{},getCSSValue:function(a){return a=="auto"?0:parseInt(a)},getremotepanels:function(b,a){a.$belt.html(this.ajaxloadingmsg);b.ajax({url:a.contenttype[1],async:true,error:function(b){a.$belt.html("Error fetching content.<br />Server Response: "+b.responseText)},success:function(c){a.$belt.html(c);a.$panels=a.$gallery.find("."+a.panelclass);stepcarousel.alignpanels(b,a)}})},getoffset:function(a,b){return a.offsetParent?a[b]+this.getoffset(a.offsetParent,b):a[b]},getCookie:function(b){var a=new RegExp(b+"=[^;]+","i");if(document.cookie.match(a))return document.cookie.match(a)[0].split("=")[1];return null},setCookie:function(b,a){document.cookie=b+"="+a},fadebuttons:function(a,b){a.$leftnavbutton.fadeTo("fast",b==0?this.defaultbuttonsfade:1);a.$rightnavbutton.fadeTo("fast",b==a.lastvisiblepanel?this.defaultbuttonsfade:1)},addnavbuttons:function(a,b){a.$leftnavbutton=$('<img src="'+a.defaultbuttons.leftnav[0]+'">').css({zIndex:50,position:"absolute",left:a.offsets.left+a.defaultbuttons.leftnav[1]+"px",top:a.offsets.top+a.defaultbuttons.leftnav[2]+"px",cursor:"hand",border:"none",cursor:"pointer"}).attr({title:"Back "+a.defaultbuttons.moveby+" panels"}).appendTo("body");a.$rightnavbutton=$('<img src="'+a.defaultbuttons.rightnav[0]+'">').css({zIndex:50,position:"absolute",left:a.offsets.left+a.$gallery.get(0).offsetWidth+a.defaultbuttons.rightnav[1]+"px",top:a.offsets.top+a.defaultbuttons.rightnav[2]+"px",cursor:"hand",border:"none",cursor:"pointer"}).attr({title:"Forward "+a.defaultbuttons.moveby+" panels"}).appendTo("body");a.$leftnavbutton.bind("click",function(){stepcarousel.stepBy(a.galleryid,-a.defaultbuttons.moveby)});a.$rightnavbutton.bind("click",function(){stepcarousel.stepBy(a.galleryid,a.defaultbuttons.moveby)});a.panelbehavior.wraparound==false&&this.fadebuttons(a,b);return a.$leftnavbutton.add(a.$rightnavbutton)},stopautostep:function(a){clearTimeout(a.steptimer);clearTimeout(a.resumeautostep)},alignpanels:function(h,a){var b=0;a.paneloffsets=[b];a.panelwidths=[];a.$panels.each(function(){var c=h(this);c.css({"float":"none",position:"absolute",left:b+"px"});c.bind("click",function(b){return a.onpanelclick(b.target)});b+=stepcarousel.getCSSValue(c.css("marginRight"))+parseInt(c.get(0).offsetWidth||c.css("width"));a.paneloffsets.push(b);a.panelwidths.push(b-a.paneloffsets[a.paneloffsets.length-2])});a.paneloffsets.pop();var f=0,d=a.$panels.length-1;a.lastvisiblepanel=d;for(var c=a.$panels.length-1;c>=0;c--){f+=c==d?a.panelwidths[d]:a.paneloffsets[c+1]-a.paneloffsets[c];if(a.gallerywidth>f)a.lastvisiblepanel=c}a.$belt.css({width:b+"px"});a.currentpanel=a.panelbehavior.persist?parseInt(this.getCookie(window[a.galleryid+"persist"])):0;a.currentpanel=typeof a.currentpanel=="number"&&a.currentpanel<a.$panels.length?a.currentpanel:0;if(a.currentpanel!=0){var i=a.paneloffsets[a.currentpanel]+(a.currentpanel==0?0:a.beltoffset);a.$belt.css({left:-i+"px"})}if(a.defaultbuttons.enable==true){var g=this.addnavbuttons(a,a.currentpanel);h(window).bind("load resize",function(){a.offsets={left:stepcarousel.getoffset(a.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(a.$gallery.get(0),"offsetTop")};a.$leftnavbutton.css({left:a.offsets.left+a.defaultbuttons.leftnav[1]+"px",top:a.offsets.top+a.defaultbuttons.leftnav[2]+"px"});a.$rightnavbutton.css({left:a.offsets.left+a.$gallery.get(0).offsetWidth+a.defaultbuttons.rightnav[1]+"px",top:a.offsets.top+a.defaultbuttons.rightnav[2]+"px"})})}if(a.autostep&&a.autostep.enable){var e=a.$gallery.add(typeof g!="undefined"?g:null);e.bind("click",function(){stepcarousel.stopautostep(a);a.autostep.status="stopped"});e.hover(function(){stepcarousel.stopautostep(a);a.autostep.hoverstate="over"},function(){if(a.steptimer&&a.autostep.hoverstate=="over"&&a.autostep.status!="stopped")a.resumeautostep=setTimeout(function(){stepcarousel.autorotate(a.galleryid);a.autostep.hoverstate="out"},500)});a.steptimer=setTimeout(function(){stepcarousel.autorotate(a.galleryid)},a.autostep.pause)}this.statusreport(a.galleryid);a.oninit();a.onslideaction(this)},stepTo:function(c,b){var a=stepcarousel.configholder[c];if(typeof a=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+c+'"!');return}stepcarousel.stopautostep(a);var b=Math.min(b-1,a.paneloffsets.length-1),d=a.paneloffsets[b]+(b==0?0:a.beltoffset);a.panelbehavior.wraparound==false&&a.defaultbuttons.enable==true&&this.fadebuttons(a,b);a.$belt.animate({left:-d+"px"},a.panelbehavior.speed,function(){a.onslideaction(this)});a.currentpanel=b;this.statusreport(c)},stepBy:function(d,f){var a=stepcarousel.configholder[d];if(typeof a=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+d+'"!');return}stepcarousel.stopautostep(a);var c=f>0?"forward":"back",b=a.currentpanel+f;if(a.panelbehavior.wraparound==false){b=c=="back"&&b<=0?0:c=="forward"?Math.min(b,a.lastvisiblepanel):b;a.defaultbuttons.enable==true&&stepcarousel.fadebuttons(a,b)}else if(b>a.lastvisiblepanel&&c=="forward")b=a.currentpanel<a.lastvisiblepanel?a.lastvisiblepanel:0;else if(b<0&&c=="back")b=a.currentpanel>0?0:a.lastvisiblepanel;var e=a.paneloffsets[b]+(b==0?0:a.beltoffset);if(b==0&&c=="forward"||a.currentpanel==0&&c=="back"&&a.panelbehavior.wraparound==true)a.$belt.animate({left:-a.paneloffsets[a.currentpanel]-(c=="forward"?100:-30)+"px"},"normal",function(){a.$belt.animate({left:-e+"px"},a.panelbehavior.speed,function(){a.onslideaction(this)})});else a.$belt.animate({left:-e+"px"},a.panelbehavior.speed,function(){a.onslideaction(this)});a.currentpanel=b;this.statusreport(d)},autorotate:function(b){var a=stepcarousel.configholder[b];a.$gallery.attr("_ismouseover")!="yes"&&this.stepBy(b,a.autostep.moveby);a.steptimer=setTimeout(function(){stepcarousel.autorotate(b)},a.autostep.pause)},statusreport:function(g){for(var a=stepcarousel.configholder[g],d=a.currentpanel,e=0,b=d;b<a.paneloffsets.length;b++){e+=a.panelwidths[b];if(e>a.gallerywidth)break}d+=1;b=b+1==d?d:b;for(var f=[d,b,a.panelwidths.length],c=0;c<a.statusvars.length;c++){window[a.statusvars[c]]=f[c];a.$statusobjs[c].text(f[c]+" ")}},setup:function(a){document.write('<style type="text/css">\n#'+a.galleryid+"{overflow: hidden;}\n</style>");jQuery(document).ready(function(b){a.$gallery=b("#"+a.galleryid);a.gallerywidth=a.$gallery.width();a.offsets={left:stepcarousel.getoffset(a.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(a.$gallery.get(0),"offsetTop")};a.$belt=a.$gallery.find("."+a.beltclass);a.$panels=a.$gallery.find("."+a.panelclass);a.panelbehavior.wraparound=a.autostep&&a.autostep.enable?true:a.panelbehavior.wraparound;a.onpanelclick=typeof a.onpanelclick=="undefined"?function(){}:a.onpanelclick;a.onslideaction=typeof a.onslide=="undefined"?function(){}:function(c){b(c).stop();a.onslide()};a.oninit=typeof a.oninit=="undefined"?function(){}:a.oninit;a.beltoffset=stepcarousel.getCSSValue(a.$belt.css("marginLeft"));a.statusvars=a.statusvars||[];a.$statusobjs=[b("#"+a.statusvars[0]),b("#"+a.statusvars[1]),b("#"+a.statusvars[2])];a.currentpanel=0;stepcarousel.configholder[a.galleryid]=a;if(a.contenttype[0]=="ajax"&&typeof a.contenttype[1]!="undefined")stepcarousel.getremotepanels(b,a);else stepcarousel.alignpanels(b,a)});jQuery(window).bind("unload",function(){a.panelbehavior.persist&&stepcarousel.setCookie(window[a.galleryid+"persist"],a.currentpanel);jQuery.each(a,function(b,a){a=null});a=null})}}