var stepcarousel={ajaxloadingmsg:'<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>',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(C){A.$belt.html("Error fetching content.<br />Server Response: "+C.responseText);
},success:function(C){A.$belt.html(C);A.$panels=A.$gallery.find("."+A.panelclass);
stepcarousel.alignpanels(B,A);}});},alignpanels:function(C,A){var B=0;A.paneloffsets=[B];
A.panelwidths=[];A.$panels.each(function(E){var D=C(this);D.css({"float":"none","position":"absolute","left":B+"px"});
D.bind("click",function(F){return A.onpanelclick(F.target);});B+=stepcarousel.getCSSValue(D.css("marginRight"))+parseInt(D.get(0).offsetWidth);
A.paneloffsets.push(B);A.panelwidths.push(B-A.paneloffsets[A.paneloffsets.length-2]);
});A.paneloffsets.pop();A.$belt.css({width:B+"px"});this.statusreport(A.galleryid);
A.oninit();A.onslideaction(this);},stepTo:function(D,B){var C=stepcarousel.configholder[D];
if(typeof C=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+D+'"!');
return;}var B=Math.min(B,C.paneloffsets.length);var A=C.paneloffsets[B]+(B==0?0:C.beltoffset);
C.$belt.animate({left:-A+"px"},"slow",function(){C.onslideaction(this);});C.currentpanel=B;
this.statusreport(D);},stepBy:function(E,A){var C=stepcarousel.configholder[E];if(typeof C=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+E+'"!');
return;}var F=(A>0)?"forward":"back";var D=C.currentpanel+A;D=(D>C.paneloffsets.length-1||D<0&&D-A>0)?0:(D<0)?C.paneloffsets.length+A:D;
var B=C.paneloffsets[D]+(D==0?0:C.beltoffset);if(D==0&&F=="forward"||C.currentpanel==0&&F=="back"){C.$belt.animate({left:-C.paneloffsets[C.currentpanel]-(F=="forward"?100:-30)+"px"},"normal",function(){C.$belt.animate({left:-B+"px"},"slow",function(){C.onslideaction(this);
});});}else{C.$belt.animate({left:-B+"px"},"slow",function(){C.onslideaction(this);
});}C.currentpanel=D;this.statusreport(E);},statusreport:function(E){var D=stepcarousel.configholder[E];
var G=D.currentpanel;var A=0;for(var C=G;C<D.paneloffsets.length;C++){A+=D.panelwidths[C];
if(A>D.gallerywidth){break;}}G+=1;C=(C+1==G)?G:C;var F=[G,C,D.panelwidths.length];
for(var B=0;B<D.statusvars.length;B++){window[D.statusvars[B]]=F[B];D.$statusobjs[B].html(F[B]);
}},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.$belt=A.$gallery.find("."+A.beltclass);A.$panels=A.$gallery.find("."+A.panelclass);
A.onpanelclick=(typeof A.onpanelclick=="undefined")?function(C){}: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(){jQuery.each(A,function(B,C){C=null;
});A=null;});},reloadPanels:function(B){var A=stepcarousel.configholder[B];A.gallerywidth=A.$gallery.width();
A.$panels=A.$gallery.find("."+A.panelclass);stepcarousel.alignpanels($,A);stepcarousel.stepTo(B,0);
}};
