/* jQuery Map Plugin
 * Version 0.6.x beta
 * Author Abel Mohler
 * Originally Developed for Kukio July 2009
 * Released with the MIT License: http://www.opensource.org/licenses/mit-license.php
 */
(function(a){a.fn.mapbox=function(c,i){var e={zoom:true,pan:true,defaultLayer:0,layerSplit:4,mapContent:".mapcontent",defaultX:null,defaultY:null,animate:false,animateSpeed:500,zoomToCursor:true,doubleClickZoom:false,clickZoom:false,doubleClickZoomOut:false,clickZoomOut:false,doubleClickMove:false,clickMove:false,doubleClickDistance:1,clickDistance:1,callBefore:function(o,n,m,l){},callAfter:function(o,n,m,l){},beforeZoom:function(o,n,m,l){},afterZoom:function(o,n,m,l){},mousewheel:false};if(typeof i=="function"){c.callAfter=i}var d,j=arguments;if(typeof c=="string"){d=c}c=a.extend(e,c||{});a(this).css({overflow:"hidden",position:"relative"});function h(r,q){if(!c.zoom){return false}q=q||{};if(r===0){r=0}else{r=r||1}var A={animate:false,speed:600,centerX:false,centerY:false,callback:function(){}};q=a.extend(A,q||{});var v=a(this).find(">div"),I=v.length-1,F=a(this).find(".current-map-layer");if(typeof c.beforeZoom=="function"){c.beforeZoom(F[0],this.xPos,this.yPos,this)}var G=this.visible,P=G;G+=(r/c.layerSplit);if(G<0){G=0}if(G>I){G=I}P=Math.ceil(G);var H=(this.visible==G)?false:true;this.visible=G;var D=F.width(),x=F.height();var m=((a(this).width()/2)+this.xPos)/D,C=((a(this).height()/2)+this.yPos)/x;if((c.layerSplit>1&&P>0)||q.animate){var n=G-(P-1),z=v.eq(P)[0].defaultWidth,y=v.eq(P)[0].defaultHeight,u=v.eq(P-1).width(),t=v.eq(P-1).height();var s=z-u,p=y-t,o=u+(s*n),M=t+(p*n)}if(c.layerSplit>1&&P>0){v.eq(P).width(o).find(".map-layer-mask").width(o).height(M);v.eq(P).height(M).find(c.mapContent).width(o).height(M)}var E=(v.eq(P).width()*m)-(a(this).width()/2),w=(v.eq(P).height()*C)-(a(this).height()/2);E=0-E;w=0-w;var O=a(this).width()-v.eq(P).width(),N=a(this).height()-v.eq(P).height();if(E>0){E=0}if(w>0){w=0}if(E<O){E=O}if(w<N){w=N}this.xPos=0-E;this.yPos=0-w;function l(){if(typeof c.afterZoom=="function"){c.afterZoom(v.eq(P)[0],this.xPos,this.yPos,this)}if(typeof q.callback=="function"){q.callback(v.eq(P)[0],this.xPos,this.yPos,this)}}if(!q.animate){v.removeClass("current-map-layer").hide();v.eq(P).css({left:E+"px",top:w+"px",display:"block"}).addClass("current-map-layer");l()}else{var K;if(r>0){K=v.eq(P)}else{K=F}var B={left:E+"px",top:w+"px",height:M+"px",width:o+"px"};if(q.centerX&&q.centerY){var L=q.centerX-(a(this).width()/2),J=q.centerY-(a(this).height()/2);L=0-L;J=0-J;B.left=L+"px";B.top=J+"px"}if(r>0){F.removeClass("current-map-layer").hide()}K.css({left:F[0].style.left,top:F[0].style.top,width:F.width()+"px",height:F.height()+"px",display:"block"}).addClass("current-map-layer").animate(B,q.speed,function(){if(r<0){F.removeClass("current-map-layer").hide();v.eq(P).addClass("current-map-layer").css("display","block")}v.eq(P).width(o).find(".map-layer-mask").width(o).height(M);l()})}return H}function k(u,t,p){p=p||a(this).find(".current-map-layer");var n=0,m=0,q=a(this).width(),r=a(this).height(),v=a(p).width(),l=a(p).height();if(q<v){n=q-v}if(r<l){m=r-l}var o=0-(this.xPos+u),s=0-(this.yPos+t);o=(o>0)?0:o;o=(o<n)?n:o;s=(s>0)?0:s;s=(s<m)?m:s;this.xPos=0-o;this.yPos=0-s;a(p).css({left:o+"px",top:s+"px"})}function g(l,p,m){m=m||a(this).find(".current-map-layer");l=0-l;p=0-p;var o=0-(a(m).width()-a(this).width());var n=0-(a(m).height()-a(this).height());if(l>0){l=0}if(p>0){p=0}if(l<o){l=o}if(p<n){p=n}this.xPos=0-l;this.yPos=0-p;a(m).css({left:l+"px",top:p+"px"})}function f(l){l=l.replace(/px/,"");l=0-l;return l}var b={zoom:function(l){l=l||1;h.call(this,l)},back:function(l){l=l||1;h.call(this,0-l)},left:function(l){l=l||10;k.call(this,0-l,0)},right:function(l){l=l||10;k.call(this,l,0)},up:function(l){l=l||10;k.call(this,0,0-l)},down:function(l){l=l||10;k.call(this,0,l)},center:function(m){m=m||{x:a(this).find(".current-map-layer").width()/2,y:a(this).find(".current-map-layer").height()/2};var l=a(this).find(".current-map-layer");var o=m.x-(a(this).width()/2),n=m.y-(a(this).height()/2);g.call(this,o,n,l[0])},zoomTo:function(m){var l=Math.round((m-this.visible)/(1/this.layerSplit));h.call(this,l)},animateTo:function(l){var m={speed:600,level:0,centerX:false,centerY:false,callback:function(){}};l=a.extend(m,l||{});var n=Math.round((l.level-this.visible)/(1/this.layerSplit));h.call(this,n,{animate:true,speed:l.speed,centerX:l.centerX,centerY:l.centerY,callback:l.callback})}};return this.each(function(){if(typeof d=="string"){var y=b[d];c.layerSplit=this.layerSplit||c.layerSplit;y.call(this,i)}else{this.visible=c.defaultLayer,this.layerSplit=c.layerSplit;var w=this,q=a(this).find(">div"),v=a(this).height(),s=a(this).width(),r=false,t=true;q.css({position:"absolute"}).eq(c.defaultLayer).css({display:"block",left:"",top:""}).addClass("current-map-layer").find(c.mapContent).css({position:"absolute",left:"0",top:"0",height:v+"px",width:"100%"});q.each(function(){this.defaultWidth=a(this).width();this.defaultHeight=a(this).height();a(this).find(c.mapContent).css({position:"absolute",top:"0",left:"0"});if(a(this).find(c.mapContent).length>0){a(this).find(">img").css({width:"100%",position:"absolute",left:"0",top:"0"}).after('<div class="map-layer-mask"></div>')}});a(this).find(".map-layer-mask").css({position:"absolute",left:"0",top:"0",background:"white",opacity:"0",filter:"alpha(opacity=0)"});if(c.defaultLayer>0){q.eq(c.defaultLayer).find(".map-layer-mask").width(q.eq(c.defaultLayer).width()).height(q.eq(c.defaultLayer).height());q.eq(c.defaultLayer).find(c.mapContent).width(q.eq(c.defaultLayer).width()).height(q.eq(c.defaultLayer).height())}a(this).find(">div:not(.current-map-layer)").hide();if(c.defaultX==null){c.defaultX=Math.floor((s/2)-(a(this).find(".current-map-layer").width()/2));if(c.defaultX>0){c.defaultX=0}}if(c.defaultY==null){c.defaultY=Math.floor((v/2)-(a(this).find(".current-map-layer").height()/2));if(c.defaultY>0){c.defaultY=0}}this.xPos=0-c.defaultX;this.yPos=0-c.defaultY;this.layerSplit=c.layerSplit;var p=c.defaultX;var o=c.defaultY;var n;var l;a(this).find(".current-map-layer").css({left:c.defaultX+"px",top:c.defaultY+"px"});var x=false;a(this).mousedown(function(){var A=a(this).find(".current-map-layer");var z=A[0].style.left,B=A[0].style.top;z=f(z);B=f(B);c.callBefore(A,z,B,w);r=true;t=true;return(c.pan)?false:true});a(document).mouseup(function(){var A=a(w).find(".current-map-layer");var z=A[0].style.left,B=A[0].style.top;z=f(z);B=f(B);c.callAfter(A,z,B,w);r=false;if(x){u=false}x=false;return false});a(document).mousemove(function(E){var B=a(w).find(".current-map-layer");if(r&&c.pan){if(t){n=E.clientX;l=E.clientY;p=B[0].style.left.replace(/px/,"");o=B[0].style.top.replace(/px/,"");t=false}else{x=true}var D=0,C=0;if(s<B.width()){D=s-B.width()}if(v<B.height()){C=v-B.height()}var A=p-(n-E.clientX);A=(A>0)?0:A;A=(A<D)?D:A;var z=o-(l-E.clientY);z=(z>0)?0:z;z=(z<C)?C:z;B.css({left:A+"px",top:z+"px"});w.xPos=f(B[0].style.left);w.yPos=f(B[0].style.top)}});if(c.mousewheel&&typeof a.fn.mousewheel!="undefined"){a(w).mousewheel(function(D,z){if(c.zoomToCursor){var C=a(this).find(".current-map-layer"),E=D.pageY-C.offset().top,A=D.pageX-C.offset().left,B=D.pageY-a(this).offset().top,J=D.pageX-a(this).offset().left,I=E/C.height(),G=A/C.width()}if(h.call(this,z)&&c.zoomToCursor){C=a(this).find(".current-map-layer");var H=C.width()*G,F=C.height()*I;g.call(this,H-J,F-B,C[0])}return false})}var m=setTimeout(function(){},0),u=true;if(c.doubleClickZoom||c.doubleClickZoomOut||c.doubleClickMove){a(w).dblclick(function(F){clearTimeout(m);u=false;var C=a(this).find(".current-map-layer"),D=F.pageY-C.offset().top,A=F.pageX-C.offset().left,B=D/C.height(),E=A/C.width();if(c.doubleClickZoom){distance=c.doubleClickDistance}else{if(c.doubleClickZoomOut){distance=0-c.doubleClickDistance}else{distance=0}}h.call(this,distance);C=a(this).find(".current-map-layer");var z=C.width()*E,G=C.height()*B;b.center.call(this,{x:z,y:G});return false})}if(c.clickZoom||c.clickZoomOut||c.clickMove){a(w).click(function(A){function z(){if(u){var E=a(this).find(".current-map-layer"),F=A.pageY-E.offset().top,C=A.pageX-E.offset().left,D=F/E.height(),G=C/E.width();var I;if(c.clickZoom){I=c.clickDistance}else{if(c.clickZoomOut){I=0-c.clickDistance}else{I=0}}h.call(this,I);E=a(this).find(".current-map-layer");var B=E.width()*G,H=E.height()*D;b.center.call(this,{x:B,y:H})}u=true}if(c.doubleClickZoom||c.doubleClickZoomOut||c.doubleClickMove){m=setTimeout(function(){z.call(w)},400)}else{z.call(this)}})}a(window).load(function(){q.each(function(){var z=a(this).find("img")[0];if(typeof z=="object"){a("<img>").attr("src",z.src)}})})}})}})(jQuery);
/* Wayfarer Tooltip
 * Version 1.0.9
 * Author Abel Mohler
 * URI: http://www.wayfarerweb.com/wtooltip.php
 * Released with the MIT License: http://www.wayfarerweb.com/mit.php
 */
(function(a){a.fn.wTooltip=function(f,r){f=a.extend({content:null,ajax:null,follow:true,auto:true,fadeIn:0,fadeOut:0,appendTip:document.body,degrade:false,offsetY:10,offsetX:1,style:{},className:null,id:null,callBefore:function(t,p,o){},callAfter:function(t,p,o){},clickAction:function(p,o){a(p).hide()},delay:0,timeout:0},f||{});if(!f.style&&typeof f.style!="object"){f.style={};f.style.zIndex="1000"}else{f.style=a.extend({border:"1px solid gray",background:"#edeef0",color:"#000",padding:"10px",zIndex:"1000",textAlign:"left"},f.style||{})}if(typeof r=="function"){f.callAfter=r||f.callAfter}f.style.display="none",f.style.position="absolute";var m,l,q,c,k={},b=true,e=false,n=false,s=document.createElement("div"),g=(typeof document.body.style.maxWidth=="undefined")?true:false,j=(typeof a.talk=="function"&&typeof a.listen=="function")?true:false;if(f.id){s.id=f.id}if(f.className){s.className=f.className}f.degrade=(f.degrade&&g)?true:false;for(var d in f.style){s.style[d]=f.style[d]}function i(o){if(o){if(f.degrade){a(s).html(f.content.replace(/<\/?[^>]+>/gi,""))}else{a(s).html(f.content)}}}if(f.ajax){a.get(f.ajax,function(o){if(o){f.content=o}i(f.content)})}function h(p){function t(u){if(m&&!f.content){m=""}}function o(){if(!e&&f.auto){clearInterval(c);if(f.fadeOut){a(s).fadeOut(f.fadeOut,function(){t(p)})}else{t(p);s.style.display="none"}}if(typeof f.callAfter=="function"){f.callAfter(s,p,f)}if(j){f=a.listen(f)}}if(f.timeout>0){q=setTimeout(function(){o()},f.timeout)}else{o()}}a(s).hover(function(){e=true},function(){e=false;h(k)});if(j){f.key=s;f.plugin="wTooltip";f.channel="wayfarer";a.talk(f)}i(f.content&&!f.ajax);a(s).appendTo(f.appendTip);return this.each(function(){a(this).hover(function(){var p=this;clearTimeout(q);if((this.title||this.titleMemKeep)&&!f.degrade&&!f.content){m=this.title||this.titleMemKeep;if(this.title){this.titleMemKeep=this.title;this.title=""}}if(f.content&&f.degrade){this.title=s.innerHTML}function o(){if(typeof f.callBefore=="function"){f.callBefore(s,p,f)}if(j){f=a.listen(f)}var t;if(f.content){if(!f.degrade){t="block"}}else{if(m&&!f.degrade){a(s).html(unescape(m));t="block";m=""}else{t="none"}}if(f.auto){if(t=="block"&&f.fadeIn){a(s).fadeIn(f.fadeIn)}else{s.style.display=t}}}if(f.delay>0){l=setTimeout(function(){o()},f.delay)}else{o()}},function(){clearTimeout(l);var o=this;b=true;if(!f.follow||n||((f.offsetX<0&&(0-f.offsetX<a(s).outerWidth()))&&(f.offsetY>0&&0-f.offsetY<a(s).outerHeight()))){setTimeout(function(){c=setInterval(function(){h(o)},1)},1)}else{h(this)}});a(this).mousemove(function(v){k=this;if(f.follow||b){var y=a(window).scrollTop(),z=a(window).scrollLeft(),w=v.clientY+y+f.offsetY,t=v.clientX+z+f.offsetX,x=a(f.appendTip).outerHeight(),p=a(f.appendTip).innerHeight(),o=a(window).width()+z-a(s).outerWidth(),u=a(window).height()+y-a(s).outerHeight();w=(x>p)?w-(x-p):w;n=(w>u||t>o)?true:false;if(t-z<=0&&f.offsetX<0){t=z}else{if(t>o){t=o}}if(w-y<=0&&f.offsetY<0){w=y}else{if(w>u){w=u}}s.style.top=w+"px";s.style.left=t+"px";b=false}});if(typeof f.clickAction=="function"){a(this).click(function(){f.clickAction(s,this)})}})}})(jQuery);
/* Mousewheel plugin
 * Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License http://www.opensource.org/licenses/mit-license.php
 *
 * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
 * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
 */
(function(a){a.event.special.mousewheel={setup:function(){var b=a.event.special.mousewheel.handler;if(a.browser.mozilla){a(this).bind("mousemove.mousewheel",function(c){a.data(this,"mwcursorposdata",{pageX:c.pageX,pageY:c.pageY,clientX:c.clientX,clientY:c.clientY})})}if(this.addEventListener){this.addEventListener((a.browser.mozilla?"DOMMouseScroll":"mousewheel"),b,false)}else{this.onmousewheel=b}},teardown:function(){var b=a.event.special.mousewheel.handler;a(this).unbind("mousemove.mousewheel");if(this.removeEventListener){this.removeEventListener((a.browser.mozilla?"DOMMouseScroll":"mousewheel"),b,false)}else{this.onmousewheel=function(){}}a.removeData(this,"mwcursorposdata")},handler:function(d){var b=Array.prototype.slice.call(arguments,1);d=a.event.fix(d||window.event);a.extend(d,a.data(this,"mwcursorposdata")||{});var e=0,c=true;if(d.wheelDelta){e=d.wheelDelta/120}if(d.detail){e=-d.detail/3}d.data=d.data||{};d.type="mousewheel";b.unshift(e);b.unshift(d);return a.event.handle.apply(this,b)}};a.fn.extend({mousewheel:function(b){return b?this.bind("mousewheel",b):this.trigger("mousewheel")},unmousewheel:function(b){return this.unbind("mousewheel",b)}})})(jQuery);
/* jScrollPane
 * Copyright (c) 2009 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * See http://kelvinluck.com/assets/jquery/jScrollPane/
 * $Id: jScrollPane.js 90 2010-01-25 03:52:10Z kelvin.luck $
 */
(function(a){a.jScrollPane={active:[]};a.fn.jScrollPane=function(b){b=a.extend({},a.fn.jScrollPane.defaults,b);var c=function(){return false};return this.each(function(){var ah=a(this);ah.css("overflow","hidden");var B=this;if(a(this).parent().is(".jScrollPaneContainer")){var az=b.maintainPosition?ah.position().top:0;var ak=a(this).parent();var aT=ak.innerWidth();var ax=ak.outerHeight();var aj=ax;a(">.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown",ak).remove();ah.css({top:0})}else{var az=0;this.originalPadding=ah.css("paddingTop")+" "+ah.css("paddingRight")+" "+ah.css("paddingBottom")+" "+ah.css("paddingLeft");this.originalSidePaddingTotal=(parseInt(ah.css("paddingLeft"))||0)+(parseInt(ah.css("paddingRight"))||0);var aT=ah.innerWidth();var ax=ah.innerHeight();var aj=ax;ah.wrap(a("<div></div>").attr({className:"jScrollPaneContainer"}).css({height:ax+"px",width:aT+"px"}));a(document).bind("emchange",function(e,d,f){ah.jScrollPane(b)})}if(b.reinitialiseOnImageLoad){var ai=a.data(B,"jScrollPaneImagesToLoad")||a("img",ah);var ap=[];if(ai.length){ai.each(function(e,d){a(this).bind("load",function(){if(a.inArray(e,ap)==-1){ap.push(d);ai=a.grep(ai,function(f,g){return f!=d});a.data(B,"jScrollPaneImagesToLoad",ai);b.reinitialiseOnImageLoad=false;ah.jScrollPane(b)}}).each(function(g,f){if(this.complete||this.complete===undefined){this.src=this.src}})})}}var aI=this.originalSidePaddingTotal;var aL={height:"auto",width:aT-b.scrollbarWidth-b.scrollbarMargin-aI+"px"};if(b.scrollbarOnLeft){aL.paddingLeft=b.scrollbarMargin+b.scrollbarWidth+"px"}else{aL.paddingRight=b.scrollbarMargin+"px"}ah.css(aL);var aK=ah.outerHeight();var aO=ax/aK;if(aO<0.99){var ao=ah.parent();ao.append(a("<div></div>").attr({className:"jScrollPaneTrack"}).css({width:b.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDrag"}).css({width:b.scrollbarWidth+"px"}).append(a("<div></div>").attr({className:"jScrollPaneDragTop"}).css({width:b.scrollbarWidth+"px"}),a("<div></div>").attr({className:"jScrollPaneDragBottom"}).css({width:b.scrollbarWidth+"px"}))));var au=a(">.jScrollPaneTrack",ao);var ag=a(">.jScrollPaneTrack .jScrollPaneDrag",ao);if(b.showArrows){var aQ;var aB;var ad;var aG;var aN=function(){if(aG>4||aG%4==0){av(aD+aB*aV)}aG++};var al=function(d){a("html").unbind("mouseup",al);aQ.removeClass("jScrollActiveArrowButton");clearInterval(ad)};var p=function(){a("html").bind("mouseup",al);aQ.addClass("jScrollActiveArrowButton");aG=0;aN();ad=setInterval(aN,100)};ao.append(a("<a></a>").attr({href:"javascript:;",className:"jScrollArrowUp"}).css({width:b.scrollbarWidth+"px"}).html("Scroll up").bind("mousedown",function(){aQ=a(this);aB=-1;p();this.blur();return false}).bind("click",c),a("<a></a>").attr({href:"javascript:;",className:"jScrollArrowDown"}).css({width:b.scrollbarWidth+"px"}).html("Scroll down").bind("mousedown",function(){aQ=a(this);aB=1;p();this.blur();return false}).bind("click",c));var af=a(">.jScrollArrowUp",ao);var am=a(">.jScrollArrowDown",ao);if(b.arrowSize){aj=ax-b.arrowSize-b.arrowSize;au.css({height:aj+"px",top:b.arrowSize+"px"})}else{var aF=af.height();b.arrowSize=aF;aj=ax-aF-am.height();au.css({height:aj+"px",top:aF+"px"})}}var ay=a(this).css({position:"absolute",overflow:"visible"});var at;var A;var aV;var aD=0;var aa=aO*ax/2;var aW=function(f,d){var e=d=="X"?"Left":"Top";return f["page"+d]||(f["client"+d]+(document.documentElement["scroll"+e]||document.body["scroll"+e]))||0};var aR=function(){return false};var aA=function(){aJ();at=ag.offset(false);at.top-=aD;A=aj-ag[0].offsetHeight;aV=2*b.wheelSpeed*A/aK};var ar=function(d){aA();aa=aW(d,"Y")-aD-at.top;a("html").bind("mouseup",ac).bind("mousemove",aP);if(a.browser.msie){a("html").bind("dragstart",aR).bind("selectstart",aR)}return false};var ac=function(){a("html").unbind("mouseup",ac).unbind("mousemove",aP);aa=aO*ax/2;if(a.browser.msie){a("html").unbind("dragstart",aR).unbind("selectstart",aR)}};var av=function(e){e=e<0?0:(e>A?A:e);aD=e;ag.css({top:e+"px"});var d=e/A;ay.css({top:((ax-aK)*d)+"px"});ah.trigger("scroll");if(b.showArrows){af[e==0?"addClass":"removeClass"]("disabled");am[e==A?"addClass":"removeClass"]("disabled")}};var aP=function(d){av(aW(d,"Y")-at.top-aa)};var aH=Math.max(Math.min(aO*(ax-b.arrowSize*2),b.dragMaxHeight),b.dragMinHeight);ag.css({height:aH+"px"}).bind("mousedown",ar);var aM;var ae;var an;var aE=function(){if(ae>8||ae%4==0){av((aD-((aD-an)/2)))}ae++};var aC=function(){clearInterval(aM);a("html").unbind("mouseup",aC).unbind("mousemove",aS)};var aS=function(d){an=aW(d,"Y")-at.top-aa};var ab=function(d){aA();aS(d);ae=0;a("html").bind("mouseup",aC).bind("mousemove",aS);aM=setInterval(aE,100);aE()};au.bind("mousedown",ab);ao.bind("mousewheel",function(f,d){aA();aJ();var e=aD;av(aD-d*aV);var g=e!=aD;return !g});var aq;var C;function aU(){var d=(aq-aD)/b.animateStep;if(d>1||d<-1){av(aD+d)}else{av(aq);aJ()}}var aJ=function(){if(C){clearInterval(C);delete aq}};var aw=function(d,f){if(typeof d=="string"){$e=a(d,ah);if(!$e.length){return}d=$e.offset().top-ah.offset().top}ao.scrollTop(0);aJ();var e=-d/(ax-aK)*A;if(f||!b.animateTo){av(e)}else{aq=e;C=setInterval(aU,b.animateInterval)}};ah[0].scrollTo=aw;ah[0].scrollBy=function(d){var e=-parseInt(ay.css("top"))||0;aw(e+d)};aA();aw(-az,true);a("*",this).bind("focus",function(f){var g=a(this);var d=0;while(g[0]!=ah[0]){d+=g.position().top;g=g.offsetParent()}var j=-parseInt(ay.css("top"))||0;var e=j+ax;var h=d>j&&d<e;if(!h){var i=d-b.scrollbarMargin;if(d>j){i+=a(this).height()+15+b.scrollbarMargin-ax}aw(i)}});if(location.hash){aw(location.hash)}a(document).bind("click",function(d){$target=a(d.target);if($target.is("a")){var e=$target.attr("href");if(e.substr(0,1)=="#"){aw(e)}}});a.jScrollPane.active.push(ah[0])}else{ah.css({height:ax+"px",width:aT-this.originalSidePaddingTotal+"px",padding:this.originalPadding});ah.parent().unbind("mousewheel")}})};a.fn.jScrollPane.defaults={scrollbarWidth:10,scrollbarMargin:5,wheelSpeed:18,showArrows:false,arrowSize:0,animateTo:false,dragMinHeight:1,dragMaxHeight:99999,animateInterval:100,animateStep:3,maintainPosition:true,scrollbarOnLeft:false,reinitialiseOnImageLoad:false};a(window).bind("unload",function(){var b=a.jScrollPane.active;for(var c=0;c<b.length;c++){b[c].scrollTo=b[c].scrollBy=null}})})(jQuery);
/* ------------------------------------------------------------------------
 * 	Class: prettyPhoto
 * 	Use: Lightbox clone for jQuery
 * 	Author: Stephane Caron (http://www.no-margin-for-errors.com)
 * 	Version: 2.5.6
 ------------------------------------------------------------------------- */

(function(a){a.prettyPhoto={version:"2.5.6"};a.fn.prettyPhoto=function(u){u=jQuery.extend({animationSpeed:"normal",opacity:0.8,showTitle:true,allowresize:true,default_width:500,default_height:344,counter_separator_label:"/",theme:"light_rounded",hideflash:false,wmode:"opaque",autoplay:true,modal:false,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder"> 						<div class="pp_top"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 						<div class="pp_content_container"> 							<div class="pp_left"> 							<div class="pp_right"> 								<div class="pp_content"> 									<div class="pp_loaderIcon"></div> 									<div class="pp_fade"> 										<a href="#" class="pp_expand" title="Expand the image">Expand</a> 										<div class="pp_hoverContainer"> 											<a class="pp_next" href="#">next</a> 											<a class="pp_previous" href="#">previous</a> 										</div> 										<div id="pp_full_res"></div> 										<div class="pp_details clearfix"> 											<a class="pp_close" href="#">Close</a> 											<p class="pp_description"></p> 											<div class="pp_nav"> 												<a href="#" class="pp_arrow_previous">Previous</a> 												<p class="currentTextHolder">0/0</p> 												<a href="#" class="pp_arrow_next">Next</a> 											</div> 										</div> 									</div> 								</div> 							</div> 							</div> 						</div> 						<div class="pp_bottom"> 							<div class="pp_left"></div> 							<div class="pp_middle"></div> 							<div class="pp_right"></div> 						</div> 					</div> 					<div class="pp_overlay"></div> 					<div class="ppt"></div>',image_markup:'<img id="fullResImage" src="" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline clearfix">{content}</div>'},u);if(a.browser.msie&&parseInt(a.browser.version)==6){u.theme="light_square"}if(a(".pp_overlay").size()==0){v()}var e=true,i=false,t,o,z,c,m,n,s,w,g=a(window).height(),y=a(window).width(),d=0,r=f();a(window).scroll(function(){r=f();j();q()});a(window).resize(function(){j();q()});a(document).keydown(function(A){if(o.is(":visible")){switch(A.keyCode){case 37:a.prettyPhoto.changePage("previous");break;case 39:a.prettyPhoto.changePage("next");break;case 27:if(!u.modal){a.prettyPhoto.close()}break}}});a(this).each(function(){a(this).bind("click",function(){_self=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var A=new Array(),C=new Array(),B=new Array();if(theGallery){a("a[rel*="+theGallery+"]").each(function(D){if(a(this)[0]===a(_self)[0]){d=D}A.push(a(this).attr("href"));C.push(a(this).find("img").attr("alt"));B.push(a(this).attr("title"))})}else{A=a(this).attr("href");C=(a(this).find("img").attr("alt"))?a(this).find("img").attr("alt"):"";B=(a(this).attr("title"))?a(this).attr("title"):""}a.prettyPhoto.open(A,C,B);return false})});a.prettyPhoto.open=function(C,B,A){if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","hidden")}if(u.hideflash){a("object,embed").css("visibility","hidden")}images=a.makeArray(C);titles=a.makeArray(B);descriptions=a.makeArray(A);image_set=(a(images).size()>0)?true:false;h(a(images).size());a(".pp_loaderIcon").show();c.show().fadeTo(u.animationSpeed,u.opacity);o.find(".currentTextHolder").text((d+1)+u.counter_separator_label+a(images).size());if(descriptions[d]){o.find(".pp_description").show().html(unescape(descriptions[d]))}else{o.find(".pp_description").hide().text("")}if(titles[d]&&u.showTitle){hasTitle=true;z.html(unescape(titles[d]))}else{hasTitle=false}movie_width=(parseFloat(b("width",images[d])))?b("width",images[d]):u.default_width.toString();movie_height=(parseFloat(b("height",images[d])))?b("height",images[d]):u.default_height.toString();if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=parseFloat((a(window).height()*parseFloat(movie_height)/100)-100);movie_width=parseFloat((a(window).width()*parseFloat(movie_width)/100)-100);i=true}o.fadeIn(function(){imgPreloader="";switch(x(images[d])){case"image":imgPreloader=new Image();nextImage=new Image();if(image_set&&d>a(images).size()){nextImage.src=images[d+1]}prevImage=new Image();if(image_set&&images[d-1]){prevImage.src=images[d-1]}o.find("#pp_full_res")[0].innerHTML=u.image_markup;o.find("#fullResImage").attr("src",images[d]);imgPreloader.onload=function(){t=k(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.onerror=function(){alert("Image cannot be loaded. Make sure the path is correct and image exist.");a.prettyPhoto.close()};imgPreloader.src=images[d];break;case"youtube":t=k(movie_width,movie_height);movie="http://www.youtube.com/v/"+b("v",images[d]);if(u.autoplay){movie+="&autoplay=1"}toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,movie);break;case"vimeo":t=k(movie_width,movie_height);movie_id=images[d];movie="http://vimeo.com/moogaloop.swf?clip_id="+movie_id.replace("http://vimeo.com/","");if(u.autoplay){movie+="&autoplay=1"}toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,movie);break;case"quicktime":t=k(movie_width,movie_height);t.height+=15;t.contentHeight+=15;t.containerHeight+=15;toInject=u.quicktime_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,images[d]).replace(/{autoplay}/g,u.autoplay);break;case"flash":t=k(movie_width,movie_height);flash_vars=images[d];flash_vars=flash_vars.substring(images[d].indexOf("flashvars")+10,images[d].length);filename=images[d];filename=filename.substring(0,filename.indexOf("?"));toInject=u.flash_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{wmode}/g,u.wmode).replace(/{path}/g,filename+"?"+flash_vars);break;case"iframe":t=k(movie_width,movie_height);frame_url=images[d];frame_url=frame_url.substr(0,frame_url.indexOf("iframe")-1);toInject=u.iframe_markup.replace(/{width}/g,t.width).replace(/{height}/g,t.height).replace(/{path}/g,frame_url);break;case"inline":myClone=a(images[d]).clone().css({width:u.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo(a("body"));t=k(a(myClone).width(),a(myClone).height());a(myClone).remove();toInject=u.inline_markup.replace(/{content}/g,a(images[d]).html());break}if(!imgPreloader){o.find("#pp_full_res")[0].innerHTML=toInject;_showContent()}})};a.prettyPhoto.changePage=function(A){if(A=="previous"){d--;if(d<0){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled")){return}d++}if(!e){e=true}l(function(){a.prettyPhoto.open(images,titles,descriptions)});a("a.pp_expand,a.pp_contract").fadeOut(u.animationSpeed)};a.prettyPhoto.close=function(){o.find("object,embed").css("visibility","hidden");a("div.pp_pic_holder,div.ppt,.pp_fade").fadeOut(u.animationSpeed);c.fadeOut(u.animationSpeed,function(){a("#pp_full_res").html("");o.attr("style","").find("div:not(.pp_hoverContainer)").attr("style","");j();if(a.browser.msie&&a.browser.version==6){a("select").css("visibility","visible")}if(u.hideflash){a("object,embed").css("visibility","visible")}d=0;u.callback()});e=true};_showContent=function(){a(".pp_loaderIcon").hide();projectedTop=r.scrollTop+((g/2)-(t.containerHeight/2));if(projectedTop<0){projectedTop=0+z.height()}o.find(".pp_content").animate({height:t.contentHeight},u.animationSpeed);o.animate({top:projectedTop,left:(y/2)-(t.containerWidth/2),width:t.containerWidth},u.animationSpeed,function(){o.find(".pp_hoverContainer,#fullResImage").height(t.height).width(t.width);o.find(".pp_fade").fadeIn(u.animationSpeed);if(image_set&&x(images[d])=="image"){o.find(".pp_hoverContainer").show()}else{o.find(".pp_hoverContainer").hide()}if(u.showTitle&&hasTitle){z.css({top:o.offset().top-25,left:o.offset().left+20,display:"none"});z.fadeIn(u.animationSpeed)}if(t.resized){a("a.pp_expand,a.pp_contract").fadeIn(u.animationSpeed)}u.changepicturecallback()})};function l(A){o.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");o.find(".pp_fade").fadeOut(u.animationSpeed,function(){a(".pp_loaderIcon").show();if(A){A()}});z.fadeOut(u.animationSpeed)}function h(A){if(d==A-1){o.find("a.pp_next").css("visibility","hidden");o.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{o.find("a.pp_next").css("visibility","visible");o.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("next");return false})}if(d==0){o.find("a.pp_previous").css("visibility","hidden");o.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{o.find("a.pp_previous").css("visibility","visible");o.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("previous");return false})}if(A>1){a(".pp_nav").show()}else{a(".pp_nav").hide()}}function k(B,A){hasBeenResized=false;p(B,A);imageWidth=B;imageHeight=A;if(((w>y)||(s>g))&&e&&u.allowresize&&!i){hasBeenResized=true;notFitting=true;while(notFitting){if((w>y)){imageWidth=(y-200);imageHeight=(A/B)*imageWidth}else{if((s>g)){imageHeight=(g-200);imageWidth=(B/A)*imageHeight}else{notFitting=false}}s=imageHeight;w=imageWidth}p(imageWidth,imageHeight)}return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(s),containerWidth:Math.floor(w)+20,contentHeight:Math.floor(m),contentWidth:Math.floor(n),resized:hasBeenResized}}function p(B,A){B=parseFloat(B);A=parseFloat(A);$pp_details=o.find(".pp_details");$pp_details.width(B);detailsHeight=parseFloat($pp_details.css("marginTop"))+parseFloat($pp_details.css("marginBottom"));$pp_details=$pp_details.clone().appendTo(a("body")).css({position:"absolute",top:-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if(a.browser.msie&&a.browser.version==7){detailsHeight+=8}$pp_details.remove();m=A+detailsHeight;n=B;s=m+z.height()+o.find(".pp_top").height()+o.find(".pp_bottom").height();w=B}function x(A){if(A.match(/youtube\.com\/watch/i)){return"youtube"}else{if(A.match(/vimeo\.com/i)){return"vimeo"}else{if(A.indexOf(".mov")!=-1){return"quicktime"}else{if(A.indexOf(".swf")!=-1){return"flash"}else{if(A.indexOf("iframe")!=-1){return"iframe"}else{if(A.substr(0,1)=="#"){return"inline"}else{return"image"}}}}}}}function j(){if(e){titleHeight=z.height();contentHeight=o.height();contentwidth=o.width();projectedTop=(g/2)+r.scrollTop-((contentHeight+titleHeight)/2);o.css({top:projectedTop,left:(y/2)+r.scrollLeft-(contentwidth/2)});z.css({top:projectedTop-titleHeight,left:(y/2)+r.scrollLeft-(contentwidth/2)+20})}}function f(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset}}else{if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft}}else{if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft}}}}}function q(){g=a(window).height();y=a(window).width();c.css({height:a(document).height()})}function v(){a("body").append(u.markup);o=a(".pp_pic_holder");z=a(".ppt");c=a("div.pp_overlay");o.attr("class","pp_pic_holder "+u.theme);c.css({opacity:0,height:a(document).height()}).bind("click",function(){if(!u.modal){a.prettyPhoto.close()}});a("a.pp_close").bind("click",function(){a.prettyPhoto.close();return false});a("a.pp_expand").bind("click",function(){$this=a(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");e=false}else{$this.removeClass("pp_contract").addClass("pp_expand");e=true}l(function(){a.prettyPhoto.open(images,titles,descriptions)});o.find(".pp_fade").fadeOut(u.animationSpeed);return false});o.find(".pp_previous, .pp_arrow_previous").bind("click",function(){a.prettyPhoto.changePage("previous");return false});o.find(".pp_next, .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");return false})}j()};function b(e,d){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var c="[\\?&]"+e+"=([^&#]*)";var g=new RegExp(c);var f=g.exec(d);if(f==null){return""}else{return f[1]}}})(jQuery);

function getCenter(sameLayer) {
    var centerX = (this.width() / 2) + this.position().left,
    centerY = (this.height() / 2) + this.position().top;
    if(!sameLayer) {
        centerX *= 3.4;//the big layer is 3.4 x larger than the starting layer
        centerY *= 3.4;
    }
    return {centerX: centerX, centerY: centerY}
}
function diffuseNodeId(id) {
    var node = $('#' + id), title = node.find('span.title').text();
    node.attr('id', '');
    window.location.hash = id;
    node.attr('id', id);
    if(title)
        document.title = title;
    else
        document.title = id;
}
