(function($){function History()
{this._curHash='';this._callback=function(hash){};};$.extend(History.prototype,{init:function(callback){this._callback=callback;this._curHash=location.hash;if($.browser.msie){if(this._curHash==''){this._curHash='#';}
$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');var iframe=$("#jQuery_history")[0].contentWindow.document;iframe.open();iframe.close();iframe.location.hash=this._curHash;}
else if($.browser.safari){this._historyBackStack=[];this._historyBackStack.length=history.length;this._historyForwardStack=[];this._isFirst=true;this._dontCheck=false;}
this._callback(this._curHash.replace(/^#/,''));setInterval(this._check,100);},add:function(hash){this._historyBackStack.push(hash);this._historyForwardStack.length=0;this._isFirst=true;},_check:function(){if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentDocument||ihistory.contentWindow.document;var current_hash=iframe.location.hash;if(current_hash!=$.history._curHash){location.hash=current_hash;$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}else if($.browser.safari){if(!$.history._dontCheck){var historyDelta=history.length-$.history._historyBackStack.length;if(historyDelta){$.history._isFirst=false;if(historyDelta<0){for(var i=0;i<Math.abs(historyDelta);i++)$.history._historyForwardStack.unshift($.history._historyBackStack.pop());}else{for(var i=0;i<historyDelta;i++)$.history._historyBackStack.push($.history._historyForwardStack.shift());}
var cachedHash=$.history._historyBackStack[$.history._historyBackStack.length-1];if(cachedHash!=undefined){$.history._curHash=location.hash;$.history._callback(cachedHash);}}else if($.history._historyBackStack[$.history._historyBackStack.length-1]==undefined&&!$.history._isFirst){if(document.URL.indexOf('#')>=0){$.history._callback(document.URL.split('#')[1]);}else{$.history._callback('');}
$.history._isFirst=true;}}}else{var current_hash=location.hash;if(current_hash!=$.history._curHash){$.history._curHash=current_hash;$.history._callback(current_hash.replace(/^#/,''));}}},load:function(hash){var newhash;if($.browser.safari){newhash=hash;}else{newhash='#'+hash;location.hash=newhash;}
this._curHash=newhash;if($.browser.msie){var ihistory=$("#jQuery_history")[0];var iframe=ihistory.contentWindow.document;iframe.open();iframe.close();iframe.location.hash=newhash;this._callback(hash);}
else if($.browser.safari){this._dontCheck=true;this.add(hash);var fn=function(){$.history._dontCheck=false;};window.setTimeout(fn,200);this._callback(hash);location.hash=newhash;}
else{this._callback(hash);}}});$(document).ready(function(){$.history=new History();});})(jQuery);;(function($){$.event.special.mousewheel={setup:function(){var handler=$.event.special.mousewheel.handler;if($.browser.mozilla)$(this).bind('mousemove.mousewheel',function(event){$.data(this,'mwcursorposdata',{pageX:event.pageX,pageY:event.pageY,clientX:event.clientX,clientY:event.clientY});});if(this.addEventListener)this.addEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=handler;},teardown:function(){var handler=$.event.special.mousewheel.handler;$(this).unbind('mousemove.mousewheel');if(this.removeEventListener)this.removeEventListener(($.browser.mozilla?'DOMMouseScroll':'mousewheel'),handler,false);else
this.onmousewheel=function(){};$.removeData(this,'mwcursorposdata');},handler:function(event){var args=Array.prototype.slice.call(arguments,1);event=$.event.fix(event||window.event);$.extend(event,$.data(this,'mwcursorposdata')||{});var delta=0,returnValue=true;if(event.wheelDelta)delta=event.wheelDelta/120;if(event.detail)delta=-event.detail/3;if($.browser.opera)delta=-event.wheelDelta;event.data=event.data||{};event.type="mousewheel";args.unshift(delta);args.unshift(event);return $.event.handle.apply(this,args);}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel");},unmousewheel:function(fn){return this.unbind("mousewheel",fn);}});})(jQuery);;(function($){function Scrollable(el,config){var self=this;if(!Scrollable.current){Scrollable.current=this;}
var opts={size:5,vertical:false,activeClass:'active',speed:300,onSeek:null,clickable:true,items:'.items',prev:'.prev',next:'.next',navi:'.navi',naviItem:'span',loop:false};this.opts=$.extend(opts,config);this.opts.horizontal=!opts.vertical;this.root=$(el);var root=this.root;var itemRoot=$(opts.items,root);if(!itemRoot.length){itemRoot=root;}
itemRoot.css({position:'relative',overflow:'hidden',visibility:'visible'});itemRoot.children().wrapAll('<div class="__scrollable" style="position:absolute"/>');this.wrap=itemRoot.find(":first");this.wrap.css(opts.horizontal?"width":"height","200000em").after('<br clear="all" />');this.items=this.wrap.children();this.index=0;if(opts.horizontal){itemRoot.width(opts.size*(this.items.eq(1).offset().left-this.items.eq(0).offset().left)-2);}else{itemRoot.height(opts.size*(this.items.eq(1).offset().top-this.items.eq(0).offset().top)-2);}
if($.isFunction($.fn.mousewheel)){root.bind("mousewheel.scrollable",function(e,delta){self.move(-delta,50);return false;});}
if(opts.clickable){this.items.each(function(index,arg){$(this).bind("click.scrollable",function(){self.click(index);});});}
this.activeIndex=0;$(opts.prev,root).click(function(){self.prev();});$(opts.next,root).click(function(){self.next();});$(opts.navi,root).each(function(){var navi=$(this);var status=self.getStatus();if(navi.is(":empty")){for(var i=0;i<status.pages;i++){var item=$("<"+opts.naviItem+"/>").attr("page",i).click(function(e){var el=$(this);el.parent().children().removeClass(opts.activeClass);el.addClass(opts.activeClass);self.setPage(el.attr("page"));e.preventDefault();});if(i===0){item.addClass(opts.activeClass);}
navi.append(item);}}else{var els=navi.find("a");if(!els.length){els=navi.children();}
els.each(function(i){var item=$(this);item.attr("page",i);if(i===0){item.addClass(opts.activeClass);}
item.click(function(){navi.find("."+opts.activeClass).removeClass(opts.activeClass);item.addClass(opts.activeClass);self.setPage(item.attr("page"));});});}});}
$.extend(Scrollable.prototype,{getVersion:function(){return'@VERSION';},click:function(index){var item=this.items.eq(index);var klass=this.opts.activeClass;if(!item.hasClass(klass)&&(index>=0||index<this.items.size())){this.items.removeClass(klass);item.addClass(klass);var delta=Math.floor(this.opts.size/2);var to=index-delta;if(to!==this.activeIndex){this.seekTo(to);}}},getStatus:function(){var len=this.items.size();return{size:this.opts.size,total:len,index:this.index,pages:Math.ceil(len/this.opts.size),page:Math.ceil(this.index/this.opts.size)};},seekTo:function(index,time){if(index<0){index=0;}
var max=Math.min(index,this.items.length-this.opts.size);if(index<=max){var item=this.items.eq(index);this.index=index;if(this.opts.horizontal){var left=this.wrap.offset().left-item.offset().left;this.wrap.animate({left:left},time||this.opts.speed);}else{var top=this.wrap.offset().top-item.offset().top;this.wrap.animate({top:top},time||this.opts.speed);}
Scrollable.current=this;}
if($.isFunction(this.opts.onSeek)){this.opts.onSeek.call(this);}
var navi=$(this.opts.navi,this.root);if(navi.length){var klass=this.opts.activeClass;var page=Math.ceil(index/this.opts.size);page=Math.min(page,navi.children().length-1);navi.children().removeClass(klass).eq(page).addClass(klass);}
this.activeIndex=index;return true;},move:function(offset,time){var to=this.index+offset;if(this.opts.loop&&to>(this.items.length-this.opts.size)){to=0;}
this.seekTo(to,time);},next:function(time){this.move(1,time);},prev:function(time){this.move(-1,time);},movePage:function(offset,time){this.move(this.opts.size*offset,time);},setPage:function(page,time){var size=this.opts.size;var index=size*page;var lastPage=index+size>=this.items.size();if(lastPage){index=this.items.size()-this.opts.size;}
this.seekTo(index,time);},prevPage:function(time){this.setPage(this.getStatus().page-1,time);},nextPage:function(time){this.setPage(this.getStatus().page+1,time);},begin:function(time){this.seekTo(0,time);},end:function(time){this.seekTo(this.items.size()-this.opts.size,time);}});$(window).bind("keypress.scrollable",function(evt){var el=Scrollable.current;if(!el){return;}
if(el.opts.horizontal&&(evt.keyCode==37||evt.keyCode==39)){el.move(evt.keyCode==37?-1:1);return evt.preventDefault();}
if(!el.opts.horizontal&&(evt.keyCode==38||evt.keyCode==40)){el.move(evt.keyCode==38?-1:1);return evt.preventDefault();}
return true;});jQuery.prototype.scrollable=function(opts,arg0,arg1){if(!opts||typeof opts=='number'){var index=opts||0;var el=$.data(this.get()[index],"scrollable");if(el){return el;}}
this.each(function(){if(typeof opts=="string"){var el=$.data(this,"scrollable");el[opts].apply(el,[arg0,arg1]);}else{var instance=new Scrollable(this,opts);$.data(this,"scrollable",instance);}});return this;};})(jQuery);;(function($){$.fn.corner=function(o){var k=$.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);function sz(a,p){return parseInt($.css(a,p))||0};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s};function gpc(a){for(;a&&a.nodeName.toLowerCase()!='html';a=a.parentNode){var v=$.css(a,'backgroundColor');if(v.indexOf('rgb')>=0){if($.browser.safari&&v=='rgba(0, 0, 0, 0)')continue;var b=v.match(/\d+/g);return'#'+hex2(b[0])+hex2(b[1])+hex2(b[2])}if(v&&v!='transparent')return v}return'#ffffff'};function getW(i){switch(t){case'round':return Math.round(q*(1-Math.cos(Math.asin(i/q))));case'cool':return Math.round(q*(1+Math.cos(Math.asin(i/q))));case'sharp':return Math.round(q*(1-Math.cos(Math.acos(i/q))));case'bite':return Math.round(q*(Math.cos(Math.asin((q-i-1)/q))));case'slide':return Math.round(q*(Math.atan2(i,q/i)));case'jut':return Math.round(q*(Math.atan2(q,(q-i-1))));case'curl':return Math.round(q*(Math.atan(i)));case'tear':return Math.round(q*(Math.cos(i)));case'wicked':return Math.round(q*(Math.tan(i)));case'long':return Math.round(q*(Math.sqrt(i)));case'sculpt':return Math.round(q*(Math.log((q-i-1),q)));case'dog':return(i&1)?(i+1):q;case'dog2':return(i&2)?(i+1):q;case'dog3':return(i&3)?(i+1):q;case'fray':return(i%2)*q;case'notch':return q;case'bevel':return i+1}};o=(o||"").toLowerCase();var l=/keep/.test(o);var m=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var n=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var q=parseInt((o.match(/(\d+)px/)||[])[1])||10;var r=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var t=((o.match(r)||['round'])[0]);var u={T:0,B:1};var x={TL:/top|tl/.test(o),TR:/top|tr/.test(o),BL:/bottom|bl/.test(o),BR:/bottom|br/.test(o)};if(!x.TL&&!x.TR&&!x.BL&&!x.BR)x={TL:1,TR:1,BL:1,BR:1};var y=document.createElement('div');y.style.overflow='hidden';y.style.height='1px';y.style.backgroundColor=n||'transparent';y.style.borderStyle='solid';return this.each(function(a){var b={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if($.browser.msie)this.style.zoom=1;if(!l)this.style.border='none';y.style.borderColor=m||gpc(this.parentNode);var c=$.curCSS(this,'height');for(var j in u){var f=u[j];if((f&&(x.BL||x.BR))||(!f&&(x.TL||x.TR))){y.style.borderStyle='none '+(x[j+'R']?'solid':'none')+' none '+(x[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var g=d.style;f?this.appendChild(d):this.insertBefore(d,this.firstChild);if(f&&c!='auto'){if($.css(this,'position')=='static')this.style.position='relative';g.position='absolute';g.bottom=g.left=g.padding=g.margin='0';if($.browser.msie)g.setExpression('width','this.parentNode.offsetWidth');else g.width='100%'}else if(!f&&$.browser.msie){if($.css(this,'position')=='static')this.style.position='relative';g.position='absolute';g.top=g.left=g.right=g.padding=g.margin='0';var h=0;if(k||!$.boxModel)h=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');k?g.setExpression('width','this.parentNode.offsetWidth - '+h+'+ "px"'):g.width='100%'}else{g.margin=!f?'-'+b.T+'px -'+b.R+'px '+(b.T-q)+'px -'+b.L+'px':(b.B-q)+'px -'+b.R+'px -'+b.B+'px -'+b.L+'px'}for(var i=0;i<q;i++){var w=Math.max(0,getW(i));var e=y.cloneNode(false);e.style.borderWidth='0 '+(x[j+'R']?w:0)+'px 0 '+(x[j+'L']?w:0)+'px';f?d.appendChild(e):d.insertBefore(e,d.firstChild)}}}})};$.fn.uncorner=function(o){return $('.jquery-corner',this).remove()}})(jQuery);;function pageload(hash){if(hash){var ha=hash.split(",");var pd=ha[0].split("-")[1];if(ha[1]){var u="chrono_period?period="+pd+"&pg="+ha[1];}else{var u="chrono_period?period="+pd;}
$("#period_results").load(u);}else{$("#period_results").empty();}}
$.fn.slideFadeUp=function(speed,easing,callback){return this.animate({top:0,opacity:1.0,height:'274px'},speed,easing,callback);};$.fn.slideFadeDown=function(speed,easing,callback){return this.animate({top:'274px',opacity:0,height:0},speed,easing,callback);};function blindDown(){$('#blind').slideFadeDown('fast').hide(100);$('#fillwithdata').empty();}
$(document).ready(function(){$.history.init(pageload);$('.period_link').click(function(){var h=$(this).attr('href').substr(1);$.history.load(h);});$("#scrollable").scrollable({size:4,speed:300,next:'a#next',prev:'a#prev',loop:true,clickable:false}).corner("round top 10px");window.api=$("#scrollable").scrollable();$('#blind').hide();$('.chrono_thumb a').click(function(){var qs=$(this).attr('class');$('#blind').css('backgroundImage','url(\"/docs/chronology/primary/'+qs+'-bg.jpg\")').show(100).slideFadeUp('5000');$('#fillwithdata').load('chrono_get_event',{'ei':qs});});$('.closelink').click(blindDown);});