/*
 * jQuery Address Plugin v1.2.2
 * http://www.asual.com/jquery/address/
 *
 * Copyright (c) 2009-2010 Rostislav Hristov
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Date: 2010-07-19 11:12:48 +0300 (Mon, 19 Jul 2010)
 */
(function(c){c.address=function(){var t=function(a){c(c.address).trigger(c.extend(c.Event(a),function(){for(var b={},h=c.address.parameterNames(),i=0,q=h.length;i<q;i++)b[h[i]]=c.address.parameter(h[i]);return{value:c.address.value(),path:c.address.path(),pathNames:c.address.pathNames(),parameterNames:h,parameters:b,queryString:c.address.queryString()}}.call(c.address)))},u=function(a,b,h){c(c.address).bind(a,b,h);return c.address},p=function(){var a=d.href.indexOf("#");return a!=-1?W(I(r(d.href.substr(a+
1),j))):""},X=function(){return"javascript"},Y=function(a,b){if(f.strict)a=b?a.substr(0,1)!="/"?"/"+a:a:a==""?"/":a;return a},J=function(a,b){return s&&d.protocol=="file:"?b?g.replace(/\?/,"%3F"):g.replace(/%253F/,"?"):a},r=function(a,b){if(f.crawlable&&b)return(a!=""?"!":"")+a;return a.replace(/^\!/,"")},v=function(a,b){return parseInt(a.css(b),10)},Z=function(a){for(var b,h,i=0,q=a.childNodes.length;i<q;i++){if(a.childNodes[i].src)b=String(a.childNodes[i].src);if(h=Z(a.childNodes[i]))b=h}return b},
F=function(){if(!K){var a=p(),b=g!=a;if(w&&m<523){if(A!=D.length){A=D.length;if(typeof x[A-1]!=y)g=x[A-1];E(j)}}else if(s&&m<7&&b)d.reload();else if(b){g=a;E(j)}}},E=function(a){t($);t(a?aa:ba);B(ca,10)},ca=function(){if(f.tracker!=="null"&&f.tracker!==null){var a=n[f.tracker],b=(d.pathname+(c.address?c.address.value():"")).replace(/\/\//,"/").replace(/^\/$/,"");if(typeof a==L)a(b);else if(typeof urchinTracker==L)urchinTracker(b);else if(typeof pageTracker!=y&&typeof pageTracker._trackPageview==L)pageTracker._trackPageview(b);
else typeof _gaq!=y&&typeof _gaq.push==L&&_gaq.push(["_trackPageview",b])}},da=function(){var a=l.contentWindow.document;a.open();a.write("<html><head><title>"+k.title+"</title><script>var "+o+' = "'+p()+'";<\/script></head></html>');a.close()},fa=function(){if(G&&ea!=-1){var a,b=G.substr(ea+1).split("&");for(C=0;C<b.length;C++){a=b[C].split("=");if(/^(autoUpdate|crawlable|history|strict|wrap)$/.test(a[0]))f[a[0]]=isNaN(a[1])?/^(true|yes)$/i.test(a[1]):parseInt(a[1],10)!==0;if(/^tracker$/.test(a[0]))f[a[0]]=
a[1]}G=null}},ia=function(){if(!ga){ga=e;fa();var a=c("body").ajaxComplete(function(){ha.call(this);ma.call(this)}).trigger("ajaxComplete");if(f.wrap){c("body > *").wrapAll('<div style="padding:'+(v(a,"marginTop")+v(a,"paddingTop"))+"px "+(v(a,"marginRight")+v(a,"paddingRight"))+"px "+(v(a,"marginBottom")+v(a,"paddingBottom"))+"px "+(v(a,"marginLeft")+v(a,"paddingLeft"))+'px;" />').parent().wrap('<div id="'+o+'" style="height:100%; overflow:auto;'+(w?window.statusbar.visible&&!/chrome/i.test(O)?"":
" resize:both;":"")+'" />');c("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"});w&&c('<style type="text/css" />').appendTo("head").text("#"+o+"::-webkit-resizer { background-color: #fff; }")}if(s&&m<8){a=k.getElementsByTagName("frameset")[0];l=k.createElement((a?"":"i")+"frame");if(a){a.insertAdjacentElement("beforeEnd",l);a[a.cols?"cols":"rows"]+=",0";l.src=X()+":"+j;l.noResize=e;l.frameBorder=l.frameSpacing=0}else{l.src=X()+":"+j;l.style.display="none";k.body.insertAdjacentElement("afterBegin",
l)}B(function(){c(l).bind("load",function(){var b=l.contentWindow;g=typeof b[o]!=y?b[o]:"";if(g!=p()){E(j);d.hash=J(r(g,e),e)}});typeof l.contentWindow[o]==y&&da()},50)}else if(w){if(m<418){c(k.body).append('<form id="'+o+'" style="position:absolute;top:-9999px;" method="get"></form>');P=k.getElementById(o)}if(typeof d[o]==y)d[o]={};if(typeof d[o][d.pathname]!=y)x=d[o][d.pathname].split(",")}B(function(){t("init");E(j)},1);if(s&&m>7||!s&&"on"+H in n)if(n.addEventListener)n.addEventListener(H,F,false);
else n.attachEvent&&n.attachEvent("on"+H,F);else na(F,50);ha()}},ha=function(){c("a").filter("[rel*=address:]").address()},oa=function(){if(n.removeEventListener)n.removeEventListener(H,F,false);else n.detachEvent&&n.detachEvent("on"+H,F)},ma=function(){var a=d.pathname.replace(/\/$/,"");c("body").html().indexOf("_escaped_fragment_")!=-1&&c("a[href]:not([href^=http]), , a[href*="+document.domain+"]",this).each(function(){var b=c(this).attr("href").replace(/^http:/,"").replace(new RegExp(a+"/?$"),
"");if(b==""||b.indexOf("_escaped_fragment_")!=-1)c(this).attr("href","#"+decodeURIComponent(b.replace(/\/(.*)\?_escaped_fragment_=(.*)$/,"!$2")))})},o="jQueryAddress",L="function",y="undefined",H="hashchange",$="change",aa="internalChange",ba="externalChange",e=true,j=false,f={autoUpdate:e,crawlable:j,history:e,strict:e,wrap:j},M=c.browser,m=parseFloat(c.browser.version),ja=M.mozilla,s=M.msie,ka=M.opera,w=M.safari,Q=j,n=function(){try{return top.document!==undefined?top:window}catch(a){return window}}(),
k=n.document,D=n.history,d=n.location,na=setInterval,B=setTimeout,I=decodeURI,W=encodeURI,O=navigator.userAgent,l,P,G=Z(document),ea=G?G.indexOf("?"):-1,R=k.title,A=D.length,K=j,ga=j,S=e,la=e,N=j,x=[],g=p();if(s){m=parseFloat(O.substr(O.indexOf("MSIE")+4));if(k.documentMode&&k.documentMode!=m)m=k.documentMode!=8?7:8;c(document).bind("propertychange",function(){if(k.title!=R&&k.title.indexOf("#"+p())!=-1)k.title=R})}if(Q=ja&&m>=1||s&&m>=6||ka&&m>=9.5||w&&m>=312){for(var C=1;C<A;C++)x.push("");x.push(g);
if(ka)history.navigationMode="compatible";if(document.readyState=="complete")var pa=setInterval(function(){if(c.address){ia();clearInterval(pa)}},50);else{fa();c(ia)}if(s&&d.hash!=g)d.hash="#"+J(r(g,e),e);c(window).bind("unload",oa)}else if(!Q&&p()!=""||w&&m<418&&p()!=""&&d.search!=""){k.open();k.write('<html><head><meta http-equiv="refresh" content="0;url='+encodeURI(d.href.substr(0,d.href.indexOf("#")))+'" /></head></html>');k.close()}else ca();return{bind:function(a,b,h){return u(a,b,h)},init:function(a){return u("init",
a)},change:function(a){return u($,a)},internalChange:function(a){return u(aa,a)},externalChange:function(a){return u(ba,a)},baseURL:function(){var a=d.href;if(a.indexOf("#")!=-1)a=a.substr(0,a.indexOf("#"));if(/\/$/.test(a))a=a.substr(0,a.length-1);return a},autoUpdate:function(a){if(a!==undefined){f.autoUpdate=a;return this}return f.autoUpdate},crawlable:function(a){if(a!==undefined){f.crawlable=a;return this}return f.crawlable},history:function(a){if(a!==undefined){f.history=a;return this}return f.history},
strict:function(a){if(a!==undefined){f.strict=a;return this}return f.strict},tracker:function(a){if(a!==undefined){f.tracker=a;return this}return f.tracker},wrap:function(a){if(a!==undefined){f.wrap=a;return this}return f.wrap},update:function(){N=e;this.value(g);N=j;return this},title:function(a){if(a!==undefined){a=I(a);B(function(){R=k.title=a;if(la&&l&&l.contentWindow&&l.contentWindow.document){l.contentWindow.document.title=a;la=j}if(!S&&ja)d.replace(d.href.indexOf("#")!=-1?d.href:d.href+"#");
S=j},50);return this}return k.title},value:function(a){if(a!==undefined){a=W(I(Y(a,e)));if(a=="/")a="";if(g==a&&!N)return;S=e;g=a;if(f.autoUpdate||N){K=e;E(e);x[D.length]=g;if(w)if(f.history){d[o][d.pathname]=x.toString();A=D.length+1;if(m<418){if(d.search==""){P.action="#"+r(g,e);P.submit()}}else if(m<523||g==""){a=k.createEvent("MouseEvents");a.initEvent("click",e,e);var b=k.createElement("a");b.href="#"+r(g,e);b.dispatchEvent(a)}else d.hash="#"+r(g,e)}else d.replace("#"+r(g,e));else if(g!=p())if(f.history)d.hash=
"#"+J(r(g,e),e);else d.replace("#"+r(g,e));s&&m<8&&f.history&&B(da,50);if(w)B(function(){K=j},1);else K=j}return this}if(!Q)return null;return I(Y(J(g,j),j))},path:function(a){if(a!==undefined){var b=this.queryString(),h=this.hash();this.value(a+(b?"?"+b:"")+(h?"#"+h:""));return this}return this.value().split("#")[0].split("?")[0]},queryString:function(a){if(a!==undefined){var b=this.hash();this.value(this.path()+(a?"?"+a:"")+(b?"#"+b:""));return this}a=this.value().split("?");return a.slice(1,a.length).join("?").split("#")[0]},
parameter:function(a,b,h){var i,q;if(b!==undefined){var T=this.parameterNames();q=[];for(i=0;i<T.length;i++){var U=T[i],z=this.parameter(U);if(typeof z=="string")z=[z];if(U==a)z=b===null||b===""?[]:h?z.concat([b]):[b];for(var V=0;V<z.length;V++)q.push(U+"="+z[V])}c.inArray(a,T)==-1&&b!==null&&b!==""&&q.push(a+"="+b);this.queryString(q.join("&"));return this}if(b=this.queryString()){q=b.split("&");b=[];for(i=0;i<q.length;i++){h=q[i].split("=");h[0]==a&&b.push(h[1])}if(b.length!==0)return b.length!=
1?b:b[0]}},pathNames:function(){var a=this.path(),b=a.replace(/\/{2,9}/g,"/").split("/");if(a.substr(0,1)=="/"||a.length===0)b.splice(0,1);a.substr(a.length-1,1)=="/"&&b.splice(b.length-1,1);return b},parameterNames:function(){var a=this.queryString(),b=[];if(a&&a.indexOf("=")!=-1){a=a.split("&");for(var h=0;h<a.length;h++){var i=a[h].split("=")[0];c.inArray(i,b)==-1&&b.push(i)}}return b},hash:function(a){if(a!==undefined){this.value(this.value().split("#")[0]+(a?"#"+a:""));return this}a=this.value().split("#");
return a.slice(1,a.length).join("#")}}}();c.fn.address=function(t){if(!c(this).attr("address")){var u=function(){if(c(this).is("a")){var p=t?t.call(this):/address:/.test(c(this).attr("rel"))?c(this).attr("rel").split("address:")[1].split(" ")[0]:c(this).attr("href").replace(/^#\!?/,"");c.address.value(p);return false}};c(this).click(u).live("click",u).submit(function(){if(c(this).is("form")){var p=t?t.call(this):c(this).attr("action")+"?"+c(this).serialize();c.address.value(p);return false}}).attr("address",
true)}return this}})(jQuery);

// TIMELINE
var timeline = {
	init: function() {
		// No Timeline? No runny-runny.
		if (!$('.timeline').length) {return;}
		var self = this; // keep context in closures

		// Set up pointers to elements for speed
		timeline.view = $('.timeline');

		// Fix width of years, so they don't spill into the next year
		$('.year > span').each( function() {
			$(this).width( $(this).parents('.year').width() - 4 );
		});

		// Get an array of posts per month
		timeline.monthData = [0];
		timeline.monthWidths = [0];
		timeline.totalCount = 0;
		$('.years .months span').each(function(i) {
			timeline.monthData[i] = $(this).width();
			timeline.monthWidths[i] = $(this).parent().width() + 1; // 1px border
			timeline.totalCount += timeline.monthData[i];
		});

		// manually set the timelineWidth to contain its children for IE7
		var timelineWidth = 0;
		if ( $.browser.msie ) {
			jQuery(timeline.monthWidths).each(function() { timelineWidth += this; } );
			$('.years').width(timelineWidth);
		} else {
			timelineWidth = $('.years').width();
		}
		// check for a timeline larger than its view
		// timeline.overhang = ( timelineWidth > viewWidth ) ? timelineWidth - viewWidth : 0;
		var viewWidth = $('.timeline').width();
		timeline.overhang = ( timelineWidth > viewWidth ) ? timelineWidth - viewWidth : 0;

		// Find the width which makes the loupe select 20 items
		var handleWidth = timelineWidth - timeline.positionFromIndex( timeline.totalCount - 20 );

		// Make the slider bounded by the view
		var maxSliderValue = Math.min( viewWidth, timelineWidth ) - handleWidth;

		// Initialize the timeline handle
		timeline.handle = new timelineHandle( '.handle', handleWidth, maxSliderValue );
		$('.track')
			.width( $('.years').width() - timeline.overhang )
			.bind('dblclick', function(e) { // Double-clicking on either side of the handle moves the handle to the clicked position.
				// Dismiss clicks on handle
				if ($(e.target).add($(e.target).parents()).is('.handle')) {return false;}
				timeline.handle.value( e.pageX - $('.track').offset().left - (timeline.handle.width()/2) );
				clearTimeout(timeline.t1);
				timeline.change();
			})
			.bind('click', function(e) { // Clicking either side of the handle moves the handle its own length to that side.
				// Dismiss clicks on handle
				if ( $(e.target).add($(e.target).parents()).is('.handle') ) {return false;}
				// Click to left or right of handle?
				clearTimeout(timeline.t1);
				if ( e.pageX - $('.track').offset().left < timeline.handle.value() ) {
					timeline.t1 = setTimeout(timeline.skipLoupeLeft, 300);
				} else {
					timeline.t1 = setTimeout(timeline.skipLoupeRight, 300);
				}
			});

		timeline.updateLoupeInfo();
	},
	setLoupe: function(position, offset) {
		
	},
	change: function() {
		var loupeInfo = timeline.getLoupeInfo();
		//itemManage.fetch( loupeInfo.offset, loupeInfo.limit, false );
		//alert(String(loupeInfo.start)+'-'+String(loupeInfo.end));
		timeline.updateLoupeInfo();
	},
	skipLoupeLeft: function(e) {
		timeline.updateView();
		timeline.handle.value( timeline.handle.value() - timeline.handle.width() )
		timeline.change();
	},
	skipLoupeRight: function(e) {
		timeline.updateView();
		timeline.handle.value( timeline.handle.value() + timeline.handle.width() );
		timeline.change();
	},
	updateView: function() {
		if ( ! timeline.overhang ) { return; }
		if ( timeline.handle.offset().left <= timeline.view.offset().left + 5) {
			// timeline needs to slide right if we are within 5px of edge
			$('.years').css( 'right', Math.max( parseInt($('.years').css('right'),10) - timeline.handle.width(), 0 - timeline.overhang ) );
		}
		else if ( timeline.handle.offset().left + timeline.handle.width() + 5 >= timeline.view.offset().left + timeline.view.width() ) {
			// slide the timeline to the left
			$('.years').css( 'right', Math.min( parseInt($('.years').css('right'),10) + timeline.handle.width(), 0 ) );
		}
	},
	indexFromPosition: function(pos) {
		var monthBoundary = 0;
		var monthIndex = 1;
		var month = 0;
		var i;

		// get the index of the first post in the month that the handle is over

		for ( i = 0; i < timeline.monthWidths.length && monthBoundary + timeline.monthWidths[i] < pos; i++ ) {
			monthBoundary += timeline.monthWidths[i];
			monthIndex += timeline.monthData[i];
			month = i + 1;
		}

		// the index is the offset from this boundary, but it cannot be greater than
		// the number of posts in the month (the month has some extra padding which
		// increases its width).
		var padding = parseInt( $('.years span').css('margin-left'),10);
		padding = padding ? padding : 0;
		return monthIndex + Math.min(
						Math.max( pos - ( monthBoundary + padding ), 0 ),
						timeline.monthData[month] - 1 );
	},
	/* the inverse of the above function */
	positionFromIndex: function(index) {
		var month = 0;
		var position = 0;
		var positionIndex = 1;

		if ( index < 1 ) {return 0;}

		for ( i = 0; i < timeline.monthWidths.length && positionIndex + timeline.monthData[i] < index; i++ ) {
			position+= timeline.monthWidths[i];
			positionIndex+= timeline.monthData[i];
			month = i + 1;
		}

		var padding = parseInt( $('.years .months span').css('margin-left'), 10 );
		padding = padding ? padding : 0;
		return position + padding + ( index - positionIndex );
	},
	getLoupeInfo: function() {
		var cur_overhang = $('.track').offset().left - $('.years').offset().left;
		var loupeStartPosition = timeline.indexFromPosition( timeline.handle.value() + cur_overhang);
		var loupeEndPosition = timeline.indexFromPosition( timeline.handle.value() + timeline.handle.width() + cur_overhang );

		var loupeInfo = {
			start: loupeStartPosition,
			end: loupeEndPosition,
			offset: parseInt(timeline.totalCount, 10) - parseInt(loupeEndPosition, 10),
			limit: 1 + parseInt(loupeEndPosition, 10) - parseInt(loupeStartPosition, 10)
			};
		return loupeInfo;
	},
	updateLoupeInfo: function() {
		var loupeInfo = timeline.getLoupeInfo();
		$('.currentposition').html( loupeInfo.start +'-'+ loupeInfo.end +' of <span class="total inline">'+ timeline.totalCount + '</span>');

		// Hide 'newer' and 'older' links as necessary
		if (loupeInfo.start == 1) {$('.navigator .older').animate({opacity: '0'}, 200);} 
		else {$('.navigator .older').animate({opacity: '1'}, 200);}
		if (loupeInfo.end == timeline.totalCount) {$('.navigator .newer').animate({opacity: '0'}, 200); }
		else {$('.navigator .newer').animate({opacity: '1'}, 200);}
	},
	reset: function (offset, limit) {
		// update the arrays of posts per month
		timeline.monthData = [0];
		timeline.monthWidths = [0];
		timeline.totalCount = 0;
		$('.years .months span').each( function(i) {
			timeline.monthData[i] = $(this).width();
			timeline.monthWidths[i] = $(this).parent().width() + 1; // 1px border
			timeline.totalCount += timeline.monthData[i];
		});

		// manually set the timelineWidth to contain its children for IE7
		var timelineWidth = 0;
		if ( $.browser.msie ) {
			jQuery(timeline.monthWidths).each(function() { timelineWidth += this; } );
			$('.years').width( timelineWidth );
		}
		else {
			timelineWidth = $('.years').width();
		}
		// check for a timeline larger than its view
		// timeline.overhang = ( timelineWidth > viewWidth ) ? timelineWidth - viewWidth : 0;
		var viewWidth = $('.timeline').width();
		timeline.overhang = ( timelineWidth > viewWidth ) ? timelineWidth - viewWidth : 0;

		// find the width which makes the loupe select 20 items
		var handleWidth = timelineWidth - timeline.positionFromIndex( timeline.totalCount - parseInt(limit) );
		//var handleWidth = timelineWidth - timeline.positionFromIndex( timeline.totalCount - 20 );
		
		// make the slider bounded by the view
		//timeline.handle.max = Math.min( viewWidth, (offset)?parseInt(offset):timelineWidth ) - handleWidth;
		timeline.handle.max = Math.min( viewWidth, timelineWidth ) - handleWidth;
		
		// reset the widths
		$('.track').width( $('.years').width() - timeline.overhang );
		$('.handle').width( handleWidth + 'px' );

		// Fix width of years, so they don't spill into the next year
		$('.year > span').each( function() {
			$(this).width( $(this).parents('.year').width() - 4 );
		});

		// move the handle to the max value
		timeline.handle.value( timeline.handle.max );
		timeline.updateLoupeInfo();
	}
};


// TIMELINE SLIDER
function timelineHandle( id, width, maxvalue ) {
	this.handle = $(id, timeline.view);
	this.max = maxvalue;
	this.value( maxvalue );

	this.handle.css( 'width', width + 'px');
	/* force 'right' property to 'auto' so we can check in doDragLeft if we have fixed the
	 * right side of the handle */
	this.handle.css( 'right', 'auto' );

	// this is required to keep context
	var self = this;
	
	this.handle.mousedown(function(e) {
		return self.mouseDown(e);
	});

	// Resize handles
	$('.resizehandleleft').mousedown(function(e) {
		return self.resize(e, 'left');
	});

	$('.resizehandleright').mousedown(function(e) {
		return self.resize(e, 'right');
	});
}

timelineHandle.prototype = {
	mouseDown: function(e) {
		this.initialpos = e.pageX;
		
		// keep context in closures
		var self = this;
		$(document)
			.bind( 'mousemove.timeline', function(e) {
				return self.mouseMove.call( self, e );
			})
			.bind( 'mouseup.timeline', function(e) {
				return self.mouseUp.call( self, e );
			});
		return false;
	},
	mouseMove: function(e) {
		var new_value = this.value() + (e.pageX - this.initialpos);
		new_value = ( new_value < 0 ) ? 0 : new_value;
		new_value = ( new_value > this.max ) ? this.max : new_value;
		if ( new_value != this.value() ) {
			this.initialpos = e.pageX;
			this.value( new_value );
		}
		timeline.updateView();
		return false;
	},
	mouseUp: function(e) {
		$(document).unbind('mousemove.timeline').unbind('mouseup.timeline');
		timeline.change();
		return false;
	},
	value: function(value) {
			if ( arguments.length ) {
				 value = ( value < 0 ) ? 0 : value;
				 value = ( value > this.max ) ? this.max : value;
				 this.val = parseInt( value, 10 );
				 this.handle.css( 'left', this.val + 'px' );
			}
			return this.val;
	},
	width: function() {
		return this.handle.width();
	},
	resize: function(e, direction) {
		this.initialSize = this.handle.width();
		this.firstMousePos = e.clientX;

		// setup functions to keep context
		var self = this;
		if ( direction == 'left' ) {
			this.dragDelegate = function(e) {
				return self.doDragLeft(e);
			};
		}
		else {
			this.dragDelegate = function(e) {
				return self.doDragRight(e);
			};
		}
		this.endDragDelegate = function(e) {
			return self.endDrag(e);
		};
		$(document).bind('mousemove.timeline', this.dragDelegate)
			.bind('mouseup.timeline', this.endDragDelegate);
		return false;	
	},
	doDragLeft: function(e) {
		var h = this.handle;
		var track = h.parents('.track');
		// fix the right side
		h.css({
			'left':	'auto',
			'right': track.width() - ( parseInt(h.css('left'), 10) + h.width() )
		});

		// Set Loupe Width. Min 20, Max 200, no spilling to the left
		h.css( 'width',
			Math.min(
				Math.max( this.initialSize - (e.clientX - this.firstMousePos), 20 ),
				Math.min( track.width() - parseInt(h.css('right'),10 ), 200 )
			)
		);

		return false;
	},
	doDragRight: function(e) {
		var h = this.handle;
		var track = h.parents('.track');
		// fix the left side
		h.css({
			'left': h.offset().left - track.offset().left,
			'right': 'auto'
		});

		// Set Loupe Width. Min 20, Max 200, no spilling to the right
		h.css( 'width',
			Math.min(
				Math.max( this.initialSize + (e.clientX - this.firstMousePos), 20),
				Math.min( track.width() - parseInt(h.css('left'), 10), 200 )
			)
		);

		return false;
	},
	endDrag: function(e) {
		// Reset to using 'left'.
		this.handle.css({
			'left':	this.handle.offset().left - $('.track').offset().left,
			'right': 'auto'
		});

		// update slider max value for the new handle width
		this.max = Math.min( $('.timeline').width(), $('.years').width() ) - this.handle.width();

		// update slider value
		this.value( parseInt( this.handle.css('left'), 10 ) );
		timeline.change();

		$(document).unbind('mousemove.timeline').unbind('mouseup.timeline');

		return false;
	},
	offset: function(){
		return this.handle.offset();
	}
};

