
(function(h){var m=h.scrollTo=function(b,c,g){h(window).scrollTo(b,c,g)};m.defaults={axis:'y',duration:1};m.window=function(b){return h(window).scrollable()};h.fn.scrollable=function(){return this.map(function(){var b=this.parentWindow||this.defaultView,c=this.nodeName=='#document'?b.frameElement||b:this,g=c.contentDocument||(c.contentWindow||c).document,i=c.setInterval;return c.nodeName=='IFRAME'||i&&h.browser.safari?g.body:i?g.documentElement:this})};h.fn.scrollTo=function(r,j,a){if(typeof j=='object'){a=j;j=0}if(typeof a=='function')a={onAfter:a};a=h.extend({},m.defaults,a);j=j||a.speed||a.duration;a.queue=a.queue&&a.axis.length>1;if(a.queue)j/=2;a.offset=n(a.offset);a.over=n(a.over);return this.scrollable().each(function(){var k=this,o=h(k),d=r,l,e={},p=o.is('html,body');switch(typeof d){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(d)){d=n(d);break}d=h(d,this);case'object':if(d.is||d.style)l=(d=h(d)).offset()}h.each(a.axis.split(''),function(b,c){var g=c=='x'?'Left':'Top',i=g.toLowerCase(),f='scroll'+g,s=k[f],t=c=='x'?'Width':'Height',v=t.toLowerCase();if(l){e[f]=l[i]+(p?0:s-o.offset()[i]);if(a.margin){e[f]-=parseInt(d.css('margin'+g))||0;e[f]-=parseInt(d.css('border'+g+'Width'))||0}e[f]+=a.offset[i]||0;if(a.over[i])e[f]+=d[v]()*a.over[i]}else e[f]=d[i];if(/^\d+$/.test(e[f]))e[f]=e[f]<=0?0:Math.min(e[f],u(t));if(!b&&a.queue){if(s!=e[f])q(a.onAfterFirst);delete e[f]}});q(a.onAfter);function q(b){o.animate(e,j,a.easing,b&&function(){b.call(this,r,a)})};function u(b){var c='scroll'+b,g=k.ownerDocument;return p?Math.max(g.documentElement[c],g.body[c]):k[c]}}).end()};function n(b){return typeof b=='object'?b:{top:b,left:b}}})(jQuery);(function($){var g=location.href.replace(/#.*/,''),h=$.localScroll=function(a){$('body').localScroll(a)};h.defaults={duration:1e3,axis:'y',event:'click',stop:1};h.hash=function(a){a=$.extend({},h.defaults,a);a.hash=0;if(location.hash)setTimeout(function(){i(0,location,a)},0)};$.fn.localScroll=function(b){b=$.extend({},h.defaults,b);return(b.persistent||b.lazy)?this.bind(b.event,function(e){var a=$([e.target,e.target.parentNode]).filter(c)[0];a&&i(e,a,b)}):this.find('a,area').filter(c).bind(b.event,function(e){i(e,this,b)}).end().end();function c(){var a=this;return!!a.href&&!!a.hash&&a.href.replace(a.hash,'')==g&&(!b.filter||$(a).is(b.filter))}};function i(e,a,b){var c=a.hash.slice(1),d=document.getElementById(c)||document.getElementsByName(c)[0],f;if(d){e&&e.preventDefault();f=$(b.target||$.scrollTo.window());if(b.lock&&f.is(':animated')||b.onBefore&&b.onBefore.call(a,e,d,f)===!1)return;if(b.stop)f.queue('fx',[]).stop();f.scrollTo(d,b).trigger('notify.serialScroll',[d]);if(b.hash)f.queue(function(){location=a.hash;$(this).dequeue()})}}})(jQuery);$(document).ready(function(){$('.container').attr({scrollTop:0,scrollLeft:0});$.localScroll.hash({target:'',axis:'xy',queue:true,duration:500});var $last=$([]);$.localScroll({target:'',axis:'xy',queue:true,duration:2000,hash:true,onBefore:function(e,anchor,$target){$last.removeClass('scrolling');$last=$(this).addClass('scrolling');if(this.blur)
this.blur();},onAfter:function(anchor){$last.removeClass('scrolling');}});});var featuredcontentglider={csszindex:100,ajaxloadingmsg:'<b>Fetching Content. Please wait...</b>',glide:function(config,showpage,isprev){var selected=parseInt(showpage)
if(selected>=config.$contentdivs.length){alert("No content exists at page "+(selected+1)+"! Loading 1st page instead.")
selected=0}
var $target=config.$contentdivs.eq(selected)
if(config.$togglerdiv.attr('lastselected')==null||parseInt(config.$togglerdiv.attr('lastselected'))!=selected){var $selectedlink=config.$toc.eq(selected)
config.$next.attr('loadpage',(selected<config.$contentdivs.length-1)?selected+1+'pg':0+'pg')
config.$prev.attr('loadpage',(selected==0)?config.$contentdivs.length-1+'pg':selected-1+'pg')
var startpoint=(isprev=="previous")?-config.startpoint:config.startpoint
$target.css(config.leftortop,startpoint).css("zIndex",this.csszindex++)
var endpoint=(config.leftortop=="left")?{left:0}:{top:0}
$target.animate(endpoint,config.speed,function(){$target.siblings().css(config.leftortop,config.startpoint);})
config.$toc.removeClass('selected')
$selectedlink.addClass('selected')
config.$togglerdiv.attr('lastselected',selected+'pg')}},getremotecontent:function(config){config.$glider.html(this.ajaxloadingmsg)
$.ajax({url:config.remotecontent,error:function(ajaxrequest){config.$glider.html('Error fetching content.<br />Server Response: '+ajaxrequest.responseText)},success:function(content){config.$glider.html(content)
featuredcontentglider.setuptoggler(config)}})},aligncontents:function(config){config.$contentdivs=$("#"+config.gliderid+" ."+config.contentclass)
config.$contentdivs.css(config.leftortop,config.startpoint).css({height:config.$glider.height(),visibility:'visible'})},setuptoggler:function(config){this.aligncontents(config)
config.$togglerdiv.hide()
config.$toc.each(function(index){$(this).attr('pagenumber',index+'pg')
if(index>(config.$contentdivs.length-1))
$(this).css({display:'none'})})
var $nextandprev=$("#"+config.togglerid+" .next, #"+config.togglerid+" .prev")
$nextandprev.click(function(event){featuredcontentglider.glide(config,this.getAttribute('loadpage'),this.getAttribute('buttontype'))
event.preventDefault()})
config.$toc.click(function(event){featuredcontentglider.glide(config,this.getAttribute('pagenumber'))
event.preventDefault()})
config.$togglerdiv.fadeIn(1000,function(){featuredcontentglider.glide(config,config.selected)
if(config.autorotate==true){config.stepcount=0
config.totalsteps=config.$contentdivs.length*config.autorotateconfig[1]
featuredcontentglider.autorotate(config)}})
config.$togglerdiv.click(function(){featuredcontentglider.cancelautorotate(config.togglerid)})},autorotate:function(config){var rotatespeed=config.speed+config.autorotateconfig[0]
window[config.togglerid+"timer"]=setInterval(function(){if(config.totalsteps>0&&config.stepcount>=config.totalsteps){clearInterval(window[config.togglerid+"timer"])}
else{config.$next.click()
config.stepcount++}},rotatespeed)},cancelautorotate:function(togglerid){if(window[togglerid+"timer"])
clearInterval(window[togglerid+"timer"])},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},init:function(config){$(document).ready(function(){config.$glider=$("#"+config.gliderid)
config.$togglerdiv=$("#"+config.togglerid)
config.$toc=config.$togglerdiv.children('.toc')
config.$next=config.$togglerdiv.children('.next')
config.$prev=config.$togglerdiv.children('.prev')
config.$prev.attr('buttontype','previous')
var selected=(config.persiststate)?featuredcontentglider.getCookie(config.gliderid):config.selected
config.selected=(isNaN(parseInt(selected)))?config.selected:selected
config.leftortop=(/up/i.test(config.direction))?"top":"left"
config.heightorwidth=(/up/i.test(config.direction))?config.$glider.height():config.$glider.width()
config.startpoint=(/^(left|up)/i.test(config.direction))?-config.heightorwidth:config.heightorwidth
if(typeof config.remotecontent!="undefined"&&config.remotecontent.length>0)
featuredcontentglider.getremotecontent(config)
else
featuredcontentglider.setuptoggler(config)
$(window).bind('unload',function(){config.$togglerdiv.unbind('click')
config.$toc.unbind('click')
config.$next.unbind('click')
config.$prev.unbind('click')
if(config.persiststate)
featuredcontentglider.setCookie(config.gliderid,config.$togglerdiv.attr('lastselected'))
config=null})})}}