
jQuery.easing['jswing']=jQuery.easing['swing'];jQuery.extend(jQuery.easing,{def:'easeOutQuad',swing:function(x,t,b,c,d){return jQuery.easing[jQuery.easing.def](x,t,b,c,d);},easeInQuad:function(x,t,b,c,d){return c*(t/=d)*t+b;},easeOutQuad:function(x,t,b,c,d){return-c*(t/=d)*(t-2)+b;},easeInOutQuad:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;},easeInCubic:function(x,t,b,c,d){return c*(t/=d)*t*t+b;},easeOutCubic:function(x,t,b,c,d){return c*((t=t/d-1)*t*t+1)+b;},easeInOutCubic:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t+b;return c/2*((t-=2)*t*t+2)+b;},easeInQuart:function(x,t,b,c,d){return c*(t/=d)*t*t*t+b;},easeOutQuart:function(x,t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b;},easeInOutQuart:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t+b;return-c/2*((t-=2)*t*t*t-2)+b;},easeInQuint:function(x,t,b,c,d){return c*(t/=d)*t*t*t*t+b;},easeOutQuint:function(x,t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},easeInOutQuint:function(x,t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;},easeInSine:function(x,t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b;},easeOutSine:function(x,t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b;},easeInOutSine:function(x,t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b;},easeInExpo:function(x,t,b,c,d){return(t==0)?b:c*Math.pow(2,10*(t/d-1))+b;},easeOutExpo:function(x,t,b,c,d){return(t==d)?b+c:c*(-Math.pow(2,-10*t/d)+1)+b;},easeInOutExpo:function(x,t,b,c,d){if(t==0)return b;if(t==d)return b+c;if((t/=d/2)<1)return c/2*Math.pow(2,10*(t-1))+b;return c/2*(-Math.pow(2,-10*--t)+2)+b;},easeInCirc:function(x,t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b;},easeOutCirc:function(x,t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b;},easeInOutCirc:function(x,t,b,c,d){if((t/=d/2)<1)return-c/2*(Math.sqrt(1-t*t)-1)+b;return c/2*(Math.sqrt(1-(t-=2)*t)+1)+b;},easeInElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;},easeOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b;},easeInOutElastic:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;},easeInBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},easeOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},easeInOutBack:function(x,t,b,c,d,s){if(s==undefined)s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},easeInBounce:function(x,t,b,c,d){return c-jQuery.easing.easeOutBounce(x,d-t,0,c,d)+b;},easeOutBounce:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}},easeInOutBounce:function(x,t,b,c,d){if(t<d/2)return jQuery.easing.easeInBounce(x,t*2,0,c,d)*.5+b;return jQuery.easing.easeOutBounce(x,t*2-d,0,c,d)*.5+c*.5+b;}});(function($){$.fn.center=function(el)
{var height=$(this).innerHeight();var width=$(this).innerWidth();if(el)
{var left=($(el).innerWidth()-width)/2;var top=($(el).innerHeight()-height)/2;}
else
{var scroll=$(window).scrollTop();var left=($(window).width()-width)/2;var top=(($(window).height()-height)/2)+scroll;}
if(top<50)
{top=50;}
$(this).css({left:left,top:top});return this;};})(jQuery);(function($){var useAjax=false;var resizeTimer=null;var inlineContentWidth=675;var inlineContentHeight=450;$.fn.lightbox=function(){$(this).click(initLightbox);};function initLightbox(event)
{event.preventDefault();var source=$(this).attr('href');if(source.substring(0,1)=='#')
{showLightbox($(source).html());}
else if(source.substring(0,7)=='http://'||source.substring(0,1)=='/')
{if(isImage(source))
{loadImage($(this));}
else
{if(useAjax)
{$.get(source,function(html){showLightbox(html);});}
else
{showLightbox('<p class="bar"></p><iframe width="'+inlineContentWidth+'" height="'+inlineContentHeight+'" src="'+source+'"></iframe>',{width:inlineContentWidth,height:inlineContentHeight});}}}
else
{showLightbox('?????');}}
function showLightbox(content,size)
{if($('#lightbox').length>0)
{if(size!==undefined)
{$('#lightbox_content').css({width:size.width});}
$('#lightbox_content').html(content);$('.lightbox_nav').css({height:($('#lightbox').outerHeight()-$('#lightbox .caption').outerHeight())+'px'});$('#lightbox a.previous, #lightbox a.next').click(loadGalleryImage);$('#lightbox').center();}
else
{var html='<div id="lightbox_overlay"></div>';html+='<div id="lightbox" style="display:none;">';if(size!==undefined)
{html+='<div id="lightbox_content" style="height:'+(size.height+20)+'px; width:'+size.width+'px;">';}
else
{html+='<div id="lightbox_content">';}
html+=content;html+='</div>';html+='<a href="#" id="lightbox_close" title="Close">close</a>';html+='</div>';$('body').append(html);$('.lightbox_nav').css({height:($('#lightbox').outerHeight()-$('#lightbox .caption').outerHeight())+'px'});$('#lightbox a.previous, #lightbox a.next').click(loadGalleryImage);$('#lightbox_close').click(closeLightbox);$('#lightbox_overlay').css({opacity:0}).one('click',closeLightbox);$('#lightbox_overlay').animate({opacity:0.75},350);$('#lightbox').center().fadeIn(250);$('body').keydown(keyboardListener);}
$(window).resize(resizeWindow);}
function keyboardListener(event)
{if(event.which==27)
{closeLightbox(event);}}
function loadImage(element)
{var url=element.attr('href');var caption=element.attr('title');var gallery=$('a[rel='+element.attr('rel')+']');var image=new Image();image.onload=function(){var size=resizeImage({width:image.width,height:image.height});var html='<img src="'+url+'" width="'+size.width+'" height="'+size.height+'" alt="" />';html+='<br /><p class="caption" style="width: '+(size.width-170)+'px">'+caption+'</p>';if(gallery.length>0)
{var current=gallery.index(element)+1;var previous=(current==0)?gallery.length:current-1;var next=(current==gallery.length)?1:current+1;html+='<span class="lightbox_position">'+current+' of '+gallery.length+'</span>';html+='<div class="lightbox_nav">';html+='<a href="#'+element.attr('rel')+'" rel="'+previous+'" class="previous">&lsaquo; Previous</a>';html+='<a href="#'+element.attr('rel')+'" rel="'+next+'" class="next">Next &rsaquo;</a>';html+='</div>';}
showLightbox(html,size);}
image.src=url;}
function loadGalleryImage(event)
{var href=$(this).attr('href');var rel=href.substr(href.indexOf('#')+1);var gallery=$('a[rel='+rel+']');var index=$(this).attr('rel')-1;loadImage(gallery.eq(index));return false;}
function closeLightbox(event)
{$(window).unbind('resize');$('body').unbind('keydown');$('#lightbox, #lightbox_overlay').fadeOut(250,function()
{$(this).remove();});return false;}
function resizeImage(size)
{var windowWidth=$(window).width();var windowHeight=$(window).height();var ratio=1;var padding=200;var imgWidth=size.width;var imgHeight=size.height;if((size.width+padding)>=windowWidth&&(size.height+padding)>=windowHeight)
{if(size.width>size.height)
{ratio=imgHeight/imgWidth;imgWidth=windowWidth-padding;imgHeight=ratio*imgWidth;}
else
{ratio=imgWidth/imgHeight;imgHeight=$(window).height()-padding;imgWidth=ratio*imgHeight;}}
else if((size.width+padding)>=windowWidth)
{ratio=imgHeight/imgWidth;imgWidth=windowWidth-padding;imgHeight=ratio*imgWidth;}
else if((size.height+padding)>=windowHeight)
{ratio=imgWidth/imgHeight;imgHeight=windowHeight-padding;imgWidth=ratio*imgHeight;}
return{width:parseInt(imgWidth),height:parseInt(imgHeight)};}
function isImage(url)
{url=url.toLowerCase();if(url.indexOf('png')!=-1||url.indexOf('jpg')!=-1||url.indexOf('gif')!=-1)
{return true;}
else
{return false;}}
function resizeWindow()
{if(resizeTimer)
{clearTimeout(resizeTimer);}
resizeTimer=setTimeout(resizeLightbox,100);}
function resizeLightbox()
{$('#lightbox').center();}})(jQuery);(function($){$.fn.divLink=function()
{$(this).click(function(){window.location=$(this).find('a.divLink').attr('href');return false;});}})(jQuery);jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return!!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return!(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return!this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;(function($){$.widget("ui.scrollbar",{_init:function()
{var self=this,options=this.options;this._isDragging=false;this._wasDragging=false;this._handleOffset=0;this._scrollbarContents=this.element.find('.ui-scrollbar-contents');this._timer=null;this.element.addClass('ui-scrollable').css('overflow',options.overflow);if(options.vertical)
{this._initVertical();}
else
{this._initHorizontal();}},_initVertical:function()
{var self=this;var windowHeight=this.element.innerHeight();this._windowHeight=windowHeight;var contentsHeight=this._scrollbarContents.outerHeight(true);this._contentsHeight=contentsHeight;if(contentsHeight>windowHeight)
{var trackHeight=windowHeight-(this.options.buttonHeight*2);var handleHeight=(windowHeight/contentsHeight)*trackHeight;var scrollbar='<div class="ui-scrollbar ui-scrollbar-vertical">';scrollbar+='<a href="#" class="ui-scrollbar-button-up"></a>';scrollbar+='<div class="ui-scrollbar-track" style="top:'+this.options.buttonHeight+'px;height:'+trackHeight+'px;">';scrollbar+='<div class="ui-scrollbar-handle" style="height:'+handleHeight+'px;"></div>';scrollbar+='</div>';scrollbar+='<a href="#" class="ui-scrollbar-button-down"></a>';scrollbar+='</div>';this._scrollbarContents.css({position:'absolute',top:0});this.element.prepend(scrollbar);this._scrollbar=$('.ui-scrollbar',this.element);this._scrollbarTrack=$('.ui-scrollbar-track',this.element);this._scrollbarHandle=$('.ui-scrollbar-handle',this.element);this._scrollbarTrack.mousedown(function(event){return self._start(event);});this.element.mousewheel(function(event,delta){return self._scrollWheelVertical(event,delta);});this.element.find('.ui-scrollbar-button-up').mousedown(function(event){return self._goUp();}).mouseup(function(){return self._clearTimer();}).click(function(){return false;});this.element.find('.ui-scrollbar-button-down').mousedown(function(event){return self._goDown();}).mouseup(function(){return self._clearTimer();}).click(function(){return false;});}},_initHorizontal:function()
{var self=this;var windowWidth=this.element.innerWidth();this._windowWidth=windowWidth;var contentsWidth=this._scrollbarContents.find('li').outerWidth(true)*this._scrollbarContents.find('li').length;this._scrollbarContents.css('width',contentsWidth);this._contentsWidth=contentsWidth;if(contentsWidth>windowWidth)
{var trackWidth=windowWidth-(this.options.buttonWidth*2);var handleWidth=41;var scrollbar='<div class="ui-scrollbar ui-scrollbar-horizontal">';scrollbar+='<a href="#" class="ui-scrollbar-button-left"></a>';scrollbar+='<div class="ui-scrollbar-track" style="left:'+this.options.buttonWidth+'px;width:'+trackWidth+'px;">';scrollbar+='<div class="ui-scrollbar-handle" style="width:'+handleWidth+'px;"></div>';scrollbar+='</div>';scrollbar+='<a href="#" class="ui-scrollbar-button-right"></a>';scrollbar+='</div>';this._scrollbarContents.css({position:'absolute',left:0})
this.element.prepend(scrollbar);this._scrollbar=$('.ui-scrollbar',this.element);this._scrollbarTrack=$('.ui-scrollbar-track',this.element);this._scrollbarHandle=$('.ui-scrollbar-handle',this.element);this._scrollbarTrack.mousedown(function(event){return self._start(event);});this.element.mousewheel(function(event,delta){return self._scrollWheelHorizontal(event,delta);});this.element.find('.ui-scrollbar-button-left').mousedown(function(event){return self._goLeft();}).mouseup(function(){return self._clearTimer();});this.element.find('.ui-scrollbar-button-right').mousedown(function(event){return self._goRight();}).mouseup(function(){return self._clearTimer();});}},_start:function(event)
{var self=this;$('html').mouseup(function(event){return self._stop(event);}).mousemove(function(event){return self._drag(event);}).mouseleave(function(event){return self._stop(event);});if(event.target==this._scrollbarTrack.get(0))
{var offset=this._relativeMousePosition(event)-this._scrollbarHandle.outerWidth()/2;if(this.options.vertical)
{this._scrollVertical(offset);}
else
{this._scrollHorizontal(offset);}}
else
{this._handleOffset=this._calcHandleOffset(event);}
this._isDragging=true;return false;},_drag:function(event)
{if(this._isDragging)
{this._wasDragging=true;var position=this._relativeMousePosition(event)-this._handleOffset;if(this.options.vertical)
{this._scrollVertical(position);}
else
{this._scrollHorizontal(position);}}
return false;},_stop:function(event)
{if(this._isDragging)
{$('html').unbind('mouseup').unbind('mousemove').unbind('mouseleave');this._isDragging=false;}
return false;},_scrollVertical:function(top)
{if(top<0)
{top=0;}
else if(top>=(this._scrollbarTrack.height()-this._scrollbarHandle.height()))
{top=this._scrollbarTrack.height()-this._scrollbarHandle.height();}
this._scrollbarHandle.css({top:top});this._scrollContentsVertical(top);},_scrollHorizontal:function(left)
{if(left<0)
{left=0;}
else if(left>=(this._scrollbarTrack.width()-this._scrollbarHandle.width()))
{left=this._scrollbarTrack.width()-this._scrollbarHandle.width();}
this._scrollbarHandle.css({left:left});this._scrollContentsHorizontal(left);},_scrollContentsVertical:function(top)
{var scrollbar_height=this._scrollbarTrack.height()-this._scrollbarHandle.height();var percent=top/scrollbar_height;var contents_top=(this._contentsHeight-this.element.height())*percent*-1;this._scrollbarContents.css({top:contents_top});},_scrollContentsHorizontal:function(left)
{var scrollbar_width=this._scrollbarTrack.width()-this._scrollbarHandle.width();var percent=left/scrollbar_width;var contents_left=(this._contentsWidth-10-this.element.width())*percent*-1;this._scrollbarContents.css({left:contents_left});},_goLeft:function()
{var self=this;this._scrollHorizontal(parseInt(this._scrollbarHandle.css('left'))-this.options.scrollInterval);this._timer=setInterval(function(){self._scrollHorizontal(parseInt(self._scrollbarHandle.css('left'))-self.options.scrollInterval);},50);return false;},_goRight:function()
{var self=this;this._scrollHorizontal(parseInt(this._scrollbarHandle.css('left'))+this.options.scrollInterval);this._timer=setInterval(function(){self._scrollHorizontal(parseInt(self._scrollbarHandle.css('left'))+self.options.scrollInterval);},50);return false;},_goUp:function()
{var self=this;this._scrollVertical(parseInt(this._scrollbarHandle.css('top'))-this.options.scrollInterval);this._timer=setInterval(function(){self._scrollVertical(parseInt(self._scrollbarHandle.css('top'))-self.options.scrollInterval);},50);return false;},_goDown:function()
{var self=this;this._scrollVertical(parseInt(this._scrollbarHandle.css('top'))+this.options.scrollInterval);this._timer=setInterval(function(){self._scrollVertical(parseInt(self._scrollbarHandle.css('top'))+self.options.scrollInterval);},50);return false;},_clearTimer:function()
{clearInterval(this._timer);return false;},_scrollWheelVertical:function(event,delta)
{var top;if(delta>0)
{top=parseInt(this._scrollbarHandle.css('top'));top-=(delta*this.options.scrollInterval);}
else
{top=parseInt(this._scrollbarHandle.css('top'));top+=(delta*-1*this.options.scrollInterval);}
this._scrollVertical(top);return false;},_scrollWheelHorizontal:function(event,delta)
{var left;if(delta>0)
{left=parseInt(this._scrollbarHandle.css('left'));left-=(delta*this.options.scrollInterval);}
else
{left=parseInt(this._scrollbarHandle.css('left'));left+=(delta*-1*this.options.scrollInterval);}
this._scrollHorizontal(left);return false;},_relativeMousePosition:function(event)
{if(this.options.vertical)
{return event.pageY-this.element.offset().top-this.options.buttonWidth;}
else
{return event.pageX-this.element.offset().left-this.options.buttonWidth;}},_calcHandleOffset:function(event)
{var position=(this.options.vertical)?'top':'left';return this._relativeMousePosition(event)-parseInt(this._scrollbarHandle.css(position));}});})(jQuery);$.extend($.ui.scrollbar,{version:"1.7.1",defaults:{vertical:true,buttonWidth:18,buttonHeight:18,scrollInterval:30,overflow:'hidden'}});(function($){var types=['DOMMouseScroll','mousewheel'];$.event.special.mousewheel={setup:function(){if(this.addEventListener)
for(var i=types.length;i;)
this.addEventListener(types[--i],handler,false);else
this.onmousewheel=handler;},teardown:function(){if(this.removeEventListener)
for(var i=types.length;i;)
this.removeEventListener(types[--i],handler,false);else
this.onmousewheel=null;}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});function handler(event){var args=[].slice.call(arguments,1),delta=0,returnValue=true;event=$.event.fix(event||window.event);event.type="mousewheel";if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;args.unshift(event,delta);return $.event.handle.apply(this,args);}})(jQuery);if(window.console===undefined)
{window.console={log:function(){}};}
var ANIMATION_SPEED=500;var DELAY_SPEED=100;var AUTO_SPEED=12000;var homeAnimating=false;var sideAnimating=false;var caseAnimating=false;var animating=false;var featureCount;var featuresLoaded;var currentFeature=0;var featureClicked=false;var autoScroll;$(document).ready(function(){initHomeFeature();$('.blocks_mask').scrollbar({vertical:false,buttonWidth:0});$('.case_studies .tabs li').click(swapCaseStudy).hover(function(){$(this).find('.cover').css({display:'none'});},function(){if(!$(this).hasClass('selected'))
{$(this).find('.cover').css({display:'block'});}});$('.home_bar.inside a.lightbox').lightbox({useAjax:true});$('.home_bar.expertise li').divLink();if($('.case_study .column.wide').outerHeight()<$('.case_study .column.thin').outerHeight())
{$('.case_study .column.wide').css({height:$('.case_study .column.thin').outerHeight()+'px'});}
if($('.gallery .images li').length>1)
{$('.gallery .controls a').not('.case_study .gallery .controls a').click(scrollSideGallery);}
else
{$('.gallery .controls').not('.case_study .gallery .controls').hide();}
$('.case_study .gallery .controls a').click(scrollCasestudy);$('.people .full .inner p').css({opacity:0});$('.people li a, .people li img').click(togglePeople);$('.home_bar.fresh a.lightbox').lightbox();$('#content.contact, #footer').find('.email a').each(function(){var href=$(this).attr('href');var html=$(this).html();if(href.substring(0,7)=='mailto:')
{$(this).attr('href',href+'@ncmark.com');$(this).html(html+'@ncmark.com');}});$('.tweet').each(function(){$(this).html(checkForLink($(this).html()));});});function checkForLink(text)
{return text.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/,function(t){return t.link(t);});}
function initHomeFeature()
{featureCount=$('#home_feature .features li').length;featuresLoaded=0;$('#home_feature .feature_images').find('img').each(function(){if(!this.complete){$(this).load(function(){checkLoadedFeatures();});}else{checkLoadedFeatures();}});$('#home_feature .feature_images li:last').prependTo('#home_feature .feature_images');$('#home_feature .feature_images').css({left:'-960px'});$('#home_feature .features li').not(':eq('+currentFeature+')').css({zIndex:1}).find('h3, p, .more').css({opacity:0});$('#home_feature .controls a').click(scrollHomeClick);$('#home_feature .feature_images li:eq(0)').addClass('previous').one('click',scrollHomeClick);$('#home_feature .feature_images li:eq(2)').addClass('next').one('click',scrollHomeClick);autoScroll=setTimeout(function(){scrollHomeFeature('next')},AUTO_SPEED);}
function checkLoadedFeatures()
{featuresLoaded++;if(featuresLoaded==featureCount)
{$('#home_feature_cover').animate({opacity:0},ANIMATION_SPEED*2,function(){$(this).remove();});}}
function scrollHomeClick()
{if(!featureClicked)
{clearTimeout(autoScroll);featureClicked=true;}
scrollHomeFeature($(this).attr('class'));return false;}
function scrollHomeFeature(direction)
{if(homeAnimating)
{return false;}
homeAnimating=true;var currentPos=parseInt($('#home_feature .feature_images').css('left'));var featureImages=$('#home_feature .feature_images');var featureText=$('#home_feature .features');$('#home_feature .feature_images .previous').attr('class','');$('#home_feature .feature_images .next').attr('class','');featureText.find('li').eq(currentFeature).find('h3, p, .more').animate({opacity:0},ANIMATION_SPEED/2,function(){featureText.find('li').eq(currentFeature).css({zIndex:1});});if(direction=='next')
{featureImages.find('li:first').clone().appendTo('#home_feature .feature_images');currentPos-=960;}
else
{featureImages.find('li:last').clone().prependTo('#home_feature .feature_images');featureImages.css({left:(currentPos-960)+'px'});}
featureImages.animate({left:currentPos+'px'},ANIMATION_SPEED*2,'easeOutQuint',function(){if(direction=='next')
{featureImages.find('li:first').remove();featureImages.css({left:(currentPos+960)+'px'});currentFeature++;}
else
{featureImages.find('li:last').remove();currentFeature--;}
if(currentFeature==featureCount)
{currentFeature=0;}
if(currentFeature<0)
{currentFeature=featureCount-1;}
featureText.find('li').eq(currentFeature).css({zIndex:30}).find('h3, p, .more').animate({opacity:1},ANIMATION_SPEED/2,function(){homeAnimating=false;$('#home_feature .feature_images li:eq(0)').addClass('previous').one('click',scrollHomeClick);$('#home_feature .feature_images li:eq(2)').addClass('next').one('click',scrollHomeClick);});});if(!featureClicked)
{autoScroll=setTimeout(function(){scrollHomeFeature('next')},AUTO_SPEED);}
return false;}
function swapCaseStudy(event)
{$('.case_studies .tabs li.selected').removeClass('selected').find('.cover').css({display:'block'});$(this).addClass('selected').find('.cover').css({display:'none'});var index=$('.case_studies .tabs li.selected').index();$('.case_studies .panels li.active').removeClass('active');$('.case_studies .panels li').eq(index).addClass('active');return false;}
function scrollSideGallery()
{if(sideAnimating)
{return false;}
sideAnimating=true;var images=$(this).parents('.images').find('ul');var caption=$(this).parents('.gallery').find('.caption p');var currentPos=parseInt(images.css('left'));var direction=$(this).attr('class');if(direction=='next')
{var captionText=images.find('li:eq(1) img').attr('title');caption.html(captionText);images.find('li:first').clone().appendTo(images);currentPos-=355;}
else
{var captionText=images.find('li:last img').attr('title');caption.html(captionText);images.find('li:last').clone().prependTo(images);images.css({left:(currentPos-355)+'px'});}
images.animate({left:currentPos+'px'},ANIMATION_SPEED*2,'easeOutQuint',function()
{sideAnimating=false;if(direction=='next')
{images.find('li:first').remove();images.css({left:(currentPos+355)+'px'});}
else
{images.find('li:last').remove();}});return false;}
function togglePeople()
{var parent=$(this).parents('li');var fullText=parent.find('.full');if(parseInt(fullText.css('height'))==0)
{var fullHeight=fullText.find('.inner').outerHeight();fullText.find('p').css({opacity:0});parent.find('.more').fadeOut(ANIMATION_SPEED);fullText.animate({height:fullHeight+'px'},ANIMATION_SPEED);fullText.find('p').animate({opacity:1},ANIMATION_SPEED);}
else
{parent.find('.more').fadeIn(ANIMATION_SPEED);fullText.animate({height:'0px'},ANIMATION_SPEED);fullText.find('p').animate({opacity:0},ANIMATION_SPEED);}
return false;}
function scrollCasestudy()
{if(caseAnimating)
{return false;}
caseAnimating=true;var images=$(this).parents('.images').find('ul');var caption=$(this).parents('.gallery').find('.caption p');var currentPos=parseInt(images.css('left'));var direction=$(this).attr('class');if(direction=='next')
{var captionText=images.find('li:eq(1) img').attr('title');caption.html(captionText);images.find('li:first').clone().appendTo(images);currentPos-=790;}
else
{var captionText=images.find('li:last img').attr('title');caption.html(captionText);images.find('li:last').clone().prependTo(images);images.css({left:(currentPos-790)+'px'});}
images.animate({left:currentPos+'px'},ANIMATION_SPEED*2,'easeOutQuint',function(){caseAnimating=false;if(direction=='next')
{images.find('li:first').remove();images.css({left:(currentPos+790)+'px'});}
else
{images.find('li:last').remove();}});return false;}