var stepcarousel={
	ajaxloadingmsg:'<div style="margin: 1em; font-weight: bold"><img src="ajaxloadr.gif" style="vertical-align: middle" /> Fetching Content. Please wait...</div>',
	defaultbuttonsfade:1,config_bknholder:{},
	getCSSValue:function(val){return(val=="auto")?0:parseInt(val)},
	getremotepanels:function($,config_bkn){config_bkn.$belt.html(this.ajaxloadingmsg)
$.ajax({url:config_bkn.contenttype[1],async:true,error:function(ajaxrequest){config_bkn.$belt.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)},success:function(content){config_bkn.$belt.html(content)
config_bkn.$panels=config_bkn.$gallery.find('.'+config_bkn.panelclass)

stepcarousel.alignpanels($,config_bkn)}})},
getoffset:function(what,offsettype){return(what.offsetParent)?what[offsettype]+this.getoffset(what.offsetParent,offsettype):what[offsettype]},
getCookie:function(Name){var re=new RegExp(Name+"=[^;]+","i");if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null},
setCookie:function(name,value){document.cookie=name+"="+value},
fadebuttons:function(config_bkn,currentpanel){config_bkn.$leftnavbutton.fadeTo('fast',currentpanel==0?this.defaultbuttonsfade:1)
config_bkn.$rightnavbutton.fadeTo('fast',currentpanel==config_bkn.lastvisiblepanel?this.defaultbuttonsfade:1)},
addnavbuttons:function(config_bkn,currentpanel){config_bkn.$leftnavbutton=jQuery('<img src="'+config_bkn.defaultbuttons.leftnav[0]+'">').css({zIndex:50,position:'absolute',left:config_bkn.offsets.left+config_bkn.defaultbuttons.leftnav[1]+'px',top:config_bkn.offsets.top+config_bkn.defaultbuttons.leftnav[2]+'px',cursor:'hand',cursor:'pointer'}).attr(																																																																																						 {title:'Back '+config_bkn.defaultbuttons.moveby+' panels'}																																																																																							 ).appendTo('body')
config_bkn.$rightnavbutton=jQuery('<img src="'+config_bkn.defaultbuttons.rightnav[0]+'">').css({zIndex:50,position:'absolute',left:config_bkn.offsets.left+config_bkn.$gallery.get(0).offsetWidth+config_bkn.defaultbuttons.rightnav[1]+'px',top:config_bkn.offsets.top+config_bkn.defaultbuttons.rightnav[2]+'px',cursor:'hand',cursor:'pointer'}).attr({title:'Forward '+config_bkn.defaultbuttons.moveby+' panels'}).appendTo('body')
config_bkn.$leftnavbutton.bind('click',function(){stepcarousel.stepBy(config_bkn.galleryid,-config_bkn.defaultbuttons.moveby)})
config_bkn.$rightnavbutton.bind('click',function(){stepcarousel.stepBy(config_bkn.galleryid,config_bkn.defaultbuttons.moveby)})
if(config_bkn.panelbehavior.wraparound==false){this.fadebuttons(config_bkn,currentpanel)}
return config_bkn.$leftnavbutton.add(config_bkn.$rightnavbutton)},stopautostep:function(config_bkn){clearTimeout(config_bkn.steptimer)
clearTimeout(config_bkn.resumeautostep)},alignpanels:function($,config_bkn){var paneloffset=0
config_bkn.paneloffsets=[paneloffset]
config_bkn.panelwidths=[]
config_bkn.$panels.each(function(index){var $currentpanel=jQuery(this)
$currentpanel.css({float:'none',position:'absolute',left:paneloffset+'px'})
$currentpanel.bind('click',function(e){return config_bkn.onpanelclick(e.target)})
paneloffset+=stepcarousel.getCSSValue($currentpanel.css('marginRight'))+parseInt($currentpanel.get(0).offsetWidth||$currentpanel.css('width'))
config_bkn.paneloffsets.push(paneloffset)
config_bkn.panelwidths.push(paneloffset-config_bkn.paneloffsets[config_bkn.paneloffsets.length-2])})
config_bkn.paneloffsets.pop()
var addpanelwidths=0
var lastpanelindex=config_bkn.$panels.length-1
config_bkn.lastvisiblepanel=lastpanelindex
for(var i=config_bkn.$panels.length-1;i>=0;i--){addpanelwidths+=(i==lastpanelindex?config_bkn.panelwidths[lastpanelindex]:config_bkn.paneloffsets[i+1]-config_bkn.paneloffsets[i])
if(config_bkn.gallerywidth>addpanelwidths){config_bkn.lastvisiblepanel=i}}
config_bkn.$belt.css({width:paneloffset+'px'})
config_bkn.currentpanel=(config_bkn.panelbehavior.persist)?parseInt(this.getCookie(window[config_bkn.galleryid+"persist"])):0
config_bkn.currentpanel=(typeof config_bkn.currentpanel=="number"&&config_bkn.currentpanel<config_bkn.$panels.length)?config_bkn.currentpanel:0
if(config_bkn.currentpanel!=0){var endpoint=config_bkn.paneloffsets[config_bkn.currentpanel]+(config_bkn.currentpanel==0?0:config_bkn.beltoffset)
config_bkn.$belt.css({left:-endpoint+'px'})}
if(config_bkn.defaultbuttons.enable==true){var $navbuttons=this.addnavbuttons(config_bkn,config_bkn.currentpanel)
jQuery(window).bind("load resize",function(){config_bkn.offsets={left:stepcarousel.getoffset(config_bkn.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(config_bkn.$gallery.get(0),"offsetTop")}
config_bkn.$leftnavbutton.css({left:config_bkn.offsets.left+config_bkn.defaultbuttons.leftnav[1]+'px',top:config_bkn.offsets.top+config_bkn.defaultbuttons.leftnav[2]+'px'})
config_bkn.$rightnavbutton.css({left:config_bkn.offsets.left+config_bkn.$gallery.get(0).offsetWidth+config_bkn.defaultbuttons.rightnav[1]+'px',top:config_bkn.offsets.top+config_bkn.defaultbuttons.rightnav[2]+'px'})})}
if(config_bkn.autostep&&config_bkn.autostep.enable){var $carouselparts=config_bkn.$gallery.add(typeof $navbuttons!="undefined"?$navbuttons:null)
$carouselparts.bind('click',function(){stepcarousel.stopautostep(config_bkn)
config_bkn.autostep.status="stopped"})
$carouselparts.hover(function(){stepcarousel.stopautostep(config_bkn)
config_bkn.autostep.hoverstate="over"},function(){if(config_bkn.steptimer&&config_bkn.autostep.hoverstate=="over"&&config_bkn.autostep.status!="stopped"){config_bkn.resumeautostep=setTimeout(function(){stepcarousel.autorotate(config_bkn.galleryid)
config_bkn.autostep.hoverstate="out"},500)}})
config_bkn.steptimer=setTimeout(function(){stepcarousel.autorotate(config_bkn.galleryid)},config_bkn.autostep.pause)}
this.statusreport(config_bkn.galleryid)
config_bkn.oninit()
config_bkn.onslideaction(this)},stepTo:function(galleryid,pindex){var config_bkn=stepcarousel.config_bknholder[galleryid]
if(typeof config_bkn=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+galleryid+"\"!")
return}
stepcarousel.stopautostep(config_bkn)
var pindex=Math.min(pindex-1,config_bkn.paneloffsets.length-1)
var endpoint=config_bkn.paneloffsets[pindex]+(pindex==0?0:config_bkn.beltoffset)
if(config_bkn.panelbehavior.wraparound==false&&config_bkn.defaultbuttons.enable==true){this.fadebuttons(config_bkn,pindex)}
config_bkn.$belt.animate({left:-endpoint+'px'},config_bkn.panelbehavior.speed,function(){config_bkn.onslideaction(this)})
config_bkn.currentpanel=pindex
this.statusreport(galleryid)},stepBy:function(galleryid,steps){var config_bkn=stepcarousel.config_bknholder[galleryid]
if(typeof config_bkn=="undefined"){alert("There's an error with your set up of Carousel Viewer \""+galleryid+"\"!")
return}
stepcarousel.stopautostep(config_bkn)
var direction=(steps>0)?'forward':'back'
var pindex=config_bkn.currentpanel+steps
if(config_bkn.panelbehavior.wraparound==false){pindex=(direction=="back"&&pindex<=0)?0:(direction=="forward")?Math.min(pindex,config_bkn.lastvisiblepanel):pindex
if(config_bkn.defaultbuttons.enable==true){stepcarousel.fadebuttons(config_bkn,pindex)}}
else{if(pindex>config_bkn.lastvisiblepanel&&direction=="forward"){pindex=(config_bkn.currentpanel<config_bkn.lastvisiblepanel)?config_bkn.lastvisiblepanel:0}
else if(pindex<0&&direction=="back"){pindex=(config_bkn.currentpanel>0)?0:config_bkn.lastvisiblepanel}}
var endpoint=config_bkn.paneloffsets[pindex]+(pindex==0?0:config_bkn.beltoffset)
if(pindex==0&&direction=='forward'||config_bkn.currentpanel==0&&direction=='back'&&config_bkn.panelbehavior.wraparound==true){config_bkn.$belt.animate({left:-config_bkn.paneloffsets[config_bkn.currentpanel]-(direction=='forward'?100:-30)+'px'},'normal',function(){config_bkn.$belt.animate({left:-endpoint+'px'},config_bkn.panelbehavior.speed,function(){config_bkn.onslideaction(this)})})}
else
config_bkn.$belt.animate({left:-endpoint+'px'},config_bkn.panelbehavior.speed,function(){config_bkn.onslideaction(this)})
config_bkn.currentpanel=pindex
this.statusreport(galleryid)},autorotate:function(galleryid){var config_bkn=stepcarousel.config_bknholder[galleryid]
if(config_bkn.$gallery.attr('_ismouseover')!="yes"){this.stepBy(galleryid,config_bkn.autostep.moveby)}
config_bkn.steptimer=setTimeout(function(){stepcarousel.autorotate(galleryid)},config_bkn.autostep.pause)},statusreport:function(galleryid){var config_bkn=stepcarousel.config_bknholder[galleryid]
var startpoint=config_bkn.currentpanel
var visiblewidth=0
for(var endpoint=startpoint;endpoint<config_bkn.paneloffsets.length;endpoint++){visiblewidth+=config_bkn.panelwidths[endpoint]
if(visiblewidth>config_bkn.gallerywidth){break}}
startpoint+=1
endpoint=(endpoint+1==startpoint)?startpoint:endpoint
var valuearray=[startpoint,endpoint,config_bkn.panelwidths.length]
for(var i=0;i<config_bkn.statusvars.length;i++){window[config_bkn.statusvars[i]]=valuearray[i]
config_bkn.$statusobjs[i].text(valuearray[i]+" ")}},setup:function(config_bkn){document.write('<style type="text/css">\n#'+config_bkn.galleryid+'{overflow: hidden;}\n</style>')
jQuery(document).ready(function($){config_bkn.$gallery=jQuery('#'+config_bkn.galleryid)
config_bkn.gallerywidth=config_bkn.$gallery.width()
config_bkn.offsets={left:stepcarousel.getoffset(config_bkn.$gallery.get(0),"offsetLeft"),top:stepcarousel.getoffset(config_bkn.$gallery.get(0),"offsetTop")}
config_bkn.$belt=config_bkn.$gallery.find('.'+config_bkn.beltclass)
config_bkn.$panels=config_bkn.$gallery.find('.'+config_bkn.panelclass)
config_bkn.panelbehavior.wraparound=(config_bkn.autostep&&config_bkn.autostep.enable)?true:config_bkn.panelbehavior.wraparound
config_bkn.onpanelclick=(typeof config_bkn.onpanelclick=="undefined")?function(target){}:config_bkn.onpanelclick
config_bkn.onslideaction=(typeof config_bkn.onslide=="undefined")?function(){}:function(beltobj){jQuery(beltobj).stop();config_bkn.onslide()}
config_bkn.oninit=(typeof config_bkn.oninit=="undefined")?function(){}:config_bkn.oninit
config_bkn.beltoffset=stepcarousel.getCSSValue(config_bkn.$belt.css('marginLeft'))
config_bkn.statusvars=config_bkn.statusvars||[]
config_bkn.$statusobjs=[jQuery('#'+config_bkn.statusvars[0]),jQuery('#'+config_bkn.statusvars[1]),jQuery('#'+config_bkn.statusvars[2])]
config_bkn.currentpanel=0
stepcarousel.config_bknholder[config_bkn.galleryid]=config_bkn
if(config_bkn.contenttype[0]=="ajax"&&typeof config_bkn.contenttype[1]!="undefined")
stepcarousel.getremotepanels($,config_bkn)
else
stepcarousel.alignpanels($,config_bkn)})
jQuery(window).bind('unload',function(){if(config_bkn.panelbehavior.persist){stepcarousel.setCookie(window[config_bkn.galleryid+"persist"],config_bkn.currentpanel)}
jQuery.each(config_bkn,function(ai,oi){oi=null})
config_bkn=null})}}
