/*! * jQuery blockUI plugin * Version 2.38 (29-MAR-2011) * @requires jQuery v1.2.3 or later * * Examples at: http://malsup.com/jquery/block/ * Copyright (c) 2007-2010 M. Alsup * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Thanks to Amir-Hossein Sobhi for some excellent contributions! */;(function($) {if (/1\.(0|1|2)\.(0|1|2)/.test($.fn.jquery) || /^1.1/.test($.fn.jquery)) {	alert('blockUI requires jQuery v1.2.3 or later!  You are using v' + $.fn.jquery);	return;}$.fn._fadeIn = $.fn.fadeIn;var noOp = function() {};// this bit is to ensure we don't call setExpression when we shouldn't (with extra muscle to handle// retarded userAgent strings on Vista)var mode = document.documentMode || 0;var setExpr = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);var ie6 = $.browser.msie && /MSIE 6.0/.test(navigator.userAgent) && !mode;// global $ methods for blocking/unblocking the entire page$.blockUI   = function(opts) { install(window, opts); };$.unblockUI = function(opts) { remove(window, opts); };// convenience method for quick growl-like notifications  (http://www.google.com/search?q=growl)$.growlUI = function(title, message, timeout, onClose) {	var $m = $('<div class="growlUI"></div>');	if (title) $m.append('<h1>'+title+'</h1>');	if (message) $m.append('<h2>'+message+'</h2>');	if (timeout == undefined) timeout = 3000;	$.blockUI({		message: $m, fadeIn: 700, fadeOut: 1000, centerY: false,		timeout: timeout, showOverlay: false,		onUnblock: onClose, 		css: $.blockUI.defaults.growlCSS	});};// plugin method for blocking element content$.fn.block = function(opts) {	return this.unblock({ fadeOut: 0 }).each(function() {		if ($.css(this,'position') == 'static')			this.style.position = 'relative';		if ($.browser.msie)			this.style.zoom = 1; // force 'hasLayout'		install(this, opts);	});};// plugin method for unblocking element content$.fn.unblock = function(opts) {	return this.each(function() {		remove(this, opts);	});};$.blockUI.version = 2.38; // 2nd generation blocking at no extra cost!// override these in your code to change the default behavior and style$.blockUI.defaults = {	// message displayed when blocking (use null for no message)	message:  '<h1>Please wait...</h1>',	title: null,	  // title string; only used when theme == true	draggable: true,  // only used when theme == true (requires jquery-ui.js to be loaded)		theme: false, // set to true to use with jQuery UI themes		// styles for the message when blocking; if you wish to disable	// these and use an external stylesheet then do this in your code:	// $.blockUI.defaults.css = {};	css: {		padding:	0,		margin:		0,		//width:		'30%',		top:		'40%',		left:		'35%',		textAlign:	'center',		color:		'#000',		border:		'3px solid #aaa',		backgroundColor:'#fff',		cursor:		'wait'	},		// minimal style set used when themes are used	themedCSS: {		width:	'30%',		top:	'40%',		left:	'35%'	},	// styles for the overlay	overlayCSS:  {		backgroundColor: '#000',		opacity:	  	 0.6,		cursor:		  	 'wait'	},	// styles applied when using $.growlUI	growlCSS: {		width:  	'350px',		top:		'10px',		left:   	'',		right:  	'10px',		border: 	'none',		padding:	'5px',		opacity:	0.6,		cursor: 	'default',		color:		'#fff',		backgroundColor: '#000',		'-webkit-border-radius': '10px',		'-moz-border-radius':	 '10px',		'border-radius': 		 '10px'	},		// IE issues: 'about:blank' fails on HTTPS and javascript:false is s-l-o-w	// (hat tip to Jorge H. N. de Vasconcelos)	iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank',	// force usage of iframe in non-IE browsers (handy for blocking applets)	forceIframe: false,	// z-index for the blocking overlay	baseZ: 1000,	// set these to true to have the message automatically centered	centerX: true, // <-- only effects element blocking (page block controlled via css above)	centerY: true,	// allow body element to be stetched in ie6; this makes blocking look better	// on "short" pages.  disable if you wish to prevent changes to the body height	allowBodyStretch: true,	// enable if you want key and mouse events to be disabled for content that is blocked	bindEvents: true,	// be default blockUI will supress tab navigation from leaving blocking content	// (if bindEvents is true)	constrainTabKey: true,	// fadeIn time in millis; set to 0 to disable fadeIn on block	fadeIn:  200,	// fadeOut time in millis; set to 0 to disable fadeOut on unblock	fadeOut:  400,	// time in millis to wait before auto-unblocking; set to 0 to disable auto-unblock	timeout: 0,	// disable if you don't want to show the overlay	showOverlay: true,	// if true, focus will be placed in the first available input field when	// page blocking	focusInput: true,	// suppresses the use of overlay styles on FF/Linux (due to performance issues with opacity)	applyPlatformOpacityRules: true,		// callback method invoked when fadeIn has completed and blocking message is visible	onBlock: null,	// callback method invoked when unblocking has completed; the callback is	// passed the element that has been unblocked (which is the window object for page	// blocks) and the options that were passed to the unblock call:	//	 onUnblock(element, options)	onUnblock: null,	// don't ask; if you really must know: http://groups.google.com/group/jquery-en/browse_thread/thread/36640a8730503595/2f6a79a77a78e493#2f6a79a77a78e493	quirksmodeOffsetHack: 4,	// class name of the message block	blockMsgClass: 'overlayContainer'};// private data and functions follow...var pageBlock = null;var pageBlockEls = [];function install(el, opts) {	var full = (el == window);	var msg = opts && opts.message !== undefined ? opts.message : undefined;	opts = $.extend({}, $.blockUI.defaults, opts || {});	opts.overlayCSS = $.extend({}, $.blockUI.defaults.overlayCSS, opts.overlayCSS || {});	var css = $.extend({}, $.blockUI.defaults.css, opts.css || {});	var themedCSS = $.extend({}, $.blockUI.defaults.themedCSS, opts.themedCSS || {});	msg = msg === undefined ? opts.message : msg;	// remove the current block (if there is one)	if (full && pageBlock)		remove(window, {fadeOut:0});	// if an existing element is being used as the blocking content then we capture	// its current place in the DOM (and current display style) so we can restore	// it when we unblock	if (msg && typeof msg != 'string' && (msg.parentNode || msg.jquery)) {		var node = msg.jquery ? msg[0] : msg;		var data = {};		$(el).data('blockUI.history', data);		data.el = node;		data.parent = node.parentNode;		data.display = node.style.display;		data.position = node.style.position;		if (data.parent)			data.parent.removeChild(node);	}	var z = opts.baseZ;	// blockUI uses 3 layers for blocking, for simplicity they are all used on every platform;	// layer1 is the iframe layer which is used to supress bleed through of underlying content	// layer2 is the overlay layer which has opacity and a wait cursor (by default)	// layer3 is the message content that is displayed while blocking	var lyr1 = ($.browser.msie || opts.forceIframe) 		? $('<iframe class="blockUI" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+opts.iframeSrc+'"></iframe>')		: $('<div class="blockUI" style="display:none"></div>');		var lyr2 = opts.theme 	 	? $('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+ (z++) +';display:none"></div>')	 	: $('<div class="blockUI blockOverlay" style="z-index:'+ (z++) +';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');	var lyr3, s;	if (opts.theme && full) {		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:fixed">' +				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +				'<div class="ui-widget-content ui-dialog-content"></div>' +			'</div>';	}	else if (opts.theme) {		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+z+';display:none;position:absolute">' +				'<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(opts.title || '&nbsp;')+'</div>' +				'<div class="ui-widget-content ui-dialog-content"></div>' +			'</div>';	}	else if (full) {		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockPage" style="z-index:'+z+';display:none;position:fixed"></div>';	}				else {		s = '<div class="blockUI ' + opts.blockMsgClass + ' blockElement" style="z-index:'+z+';display:none;position:absolute"></div>';	}	lyr3 = $(s);	// if we have a message, style it	if (msg) {		if (opts.theme) {			lyr3.css(themedCSS);			lyr3.addClass('ui-widget-content');		}		else 			lyr3.css(css);	}	// style the overlay	if (!opts.theme && (!opts.applyPlatformOpacityRules || !($.browser.mozilla && /Linux/.test(navigator.platform))))		lyr2.css(opts.overlayCSS);	lyr2.css('position', full ? 'fixed' : 'absolute');	// make iframe layer transparent in IE	if ($.browser.msie || opts.forceIframe)		lyr1.css('opacity',0.0);	//$([lyr1[0],lyr2[0],lyr3[0]]).appendTo(full ? 'body' : el);	var layers = [lyr1,lyr2,lyr3], $par = full ? $('body') : $(el);	$.each(layers, function() {		this.appendTo($par);	});		if (opts.theme && opts.draggable && $.fn.draggable) {		lyr3.draggable({			handle: '.ui-dialog-titlebar',			cancel: 'li'		});	}	// ie7 must use absolute positioning in quirks mode and to account for activex issues (when scrolling)	var expr = setExpr && (!$.boxModel || $('object,embed', full ? null : el).length > 0);	if (ie6 || expr) {		// give body 100% height		if (full && opts.allowBodyStretch && $.boxModel)			$('html,body').css('height','100%');		// fix ie6 issue when blocked element has a border width		if ((ie6 || !$.boxModel) && !full) {			var t = sz(el,'borderTopWidth'), l = sz(el,'borderLeftWidth');			var fixT = t ? '(0 - '+t+')' : 0;			var fixL = l ? '(0 - '+l+')' : 0;		}		// simulate fixed position		$.each([lyr1,lyr2,lyr3], function(i,o) {			var s = o[0].style;			s.position = 'absolute';			if (i < 2) {				full ? s.setExpression('height','Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:'+opts.quirksmodeOffsetHack+') + "px"')					 : s.setExpression('height','this.parentNode.offsetHeight + "px"');				full ? s.setExpression('width','jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"')					 : s.setExpression('width','this.parentNode.offsetWidth + "px"');				if (fixL) s.setExpression('left', fixL);				if (fixT) s.setExpression('top', fixT);			}			else if (opts.centerY) {				if (full) s.setExpression('top','(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');				s.marginTop = 0;			}			else if (!opts.centerY && full) {				var top = (opts.css && opts.css.top) ? parseInt(opts.css.top) : 0;				var expression = '((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + '+top+') + "px"';				s.setExpression('top',expression);			}		});	}	// show the message	if (msg) {		if (opts.theme)			lyr3.find('.ui-widget-content').append(msg);		else			lyr3.append(msg);		if (msg.jquery || msg.nodeType)			$(msg).show();	}	if (($.browser.msie || opts.forceIframe) && opts.showOverlay)		lyr1.show(); // opacity is zero	if (opts.fadeIn) {		var cb = opts.onBlock ? opts.onBlock : noOp;		var cb1 = (opts.showOverlay && !msg) ? cb : noOp;		var cb2 = msg ? cb : noOp;		if (opts.showOverlay)			lyr2._fadeIn(opts.fadeIn, cb1);		if (msg)			lyr3._fadeIn(opts.fadeIn, cb2);	}	else {		if (opts.showOverlay)			lyr2.show();		if (msg)			lyr3.show();		if (opts.onBlock)			opts.onBlock();	}	// bind key and mouse events	bind(1, el, opts);	if (full) {		pageBlock = lyr3[0];		pageBlockEls = $(':input:enabled:visible',pageBlock);		if (opts.focusInput)			setTimeout(focus, 20);	}	else		center(lyr3[0], opts.centerX, opts.centerY);	if (opts.timeout) {		// auto-unblock		var to = setTimeout(function() {			full ? $.unblockUI(opts) : $(el).unblock(opts);		}, opts.timeout);		$(el).data('blockUI.timeout', to);	}};// remove the blockfunction remove(el, opts) {	var full = (el == window);	var $el = $(el);	var data = $el.data('blockUI.history');	var to = $el.data('blockUI.timeout');	if (to) {		clearTimeout(to);		$el.removeData('blockUI.timeout');	}	opts = $.extend({}, $.blockUI.defaults, opts || {});	bind(0, el, opts); // unbind events		var els;	if (full) // crazy selector to handle odd field errors in ie6/7		els = $('body').children().filter('.blockUI').add('body > .blockUI');	else		els = $('.blockUI', el);	if (full)		pageBlock = pageBlockEls = null;	if (opts.fadeOut) {		els.fadeOut(opts.fadeOut);		setTimeout(function() { reset(els,data,opts,el); }, opts.fadeOut);	}	else		reset(els, data, opts, el);};// move blocking element back into the DOM where it startedfunction reset(els,data,opts,el) {	els.each(function(i,o) {		// remove via DOM calls so we don't lose event handlers		if (this.parentNode)			this.parentNode.removeChild(this);	});	if (data && data.el) {		data.el.style.display = data.display;		data.el.style.position = data.position;		if (data.parent)			data.parent.appendChild(data.el);		$(el).removeData('blockUI.history');	}	if (typeof opts.onUnblock == 'function')		opts.onUnblock(el,opts);};// bind/unbind the handlerfunction bind(b, el, opts) {	var full = el == window, $el = $(el);	// don't bother unbinding if there is nothing to unbind	if (!b && (full && !pageBlock || !full && !$el.data('blockUI.isBlocked')))		return;	if (!full)		$el.data('blockUI.isBlocked', b);	// don't bind events when overlay is not in use or if bindEvents is false	if (!opts.bindEvents || (b && !opts.showOverlay)) 		return;	// bind anchors and inputs for mouse and key events	var events = 'mousedown mouseup keydown keypress';	b ? $(document).bind(events, opts, handler) : $(document).unbind(events, handler);// former impl...//	   var $e = $('a,:input');//	   b ? $e.bind(events, opts, handler) : $e.unbind(events, handler);};// event handler to suppress keyboard/mouse events when blockingfunction handler(e) {	// allow tab navigation (conditionally)	if (e.keyCode && e.keyCode == 9) {		if (pageBlock && e.data.constrainTabKey) {			var els = pageBlockEls;			var fwd = !e.shiftKey && e.target === els[els.length-1];			var back = e.shiftKey && e.target === els[0];			if (fwd || back) {				setTimeout(function(){focus(back)},10);				return false;			}		}	}	var opts = e.data;	// allow events within the message content	if ($(e.target).parents('div.' + opts.blockMsgClass).length > 0)		return true;	// allow events for content that is not being blocked	return $(e.target).parents().children().filter('div.blockUI').length == 0;};function focus(back) {	if (!pageBlockEls)		return;	var e = pageBlockEls[back===true ? pageBlockEls.length-1 : 0];	if (e)		e.focus();};function center(el, x, y) {	var p = el.parentNode, s = el.style;	var l = ((p.offsetWidth - el.offsetWidth)/2) - sz(p,'borderLeftWidth');	var t = ((p.offsetHeight - el.offsetHeight)/2) - sz(p,'borderTopWidth');	if (x) s.left = l > 0 ? (l+'px') : '0';	if (y) s.top  = t > 0 ? (t+'px') : '0';};function sz(el, p) {	return parseInt($.css(el,p))||0;};})(jQuery);/* OVERLAYS ----------- */function overlay(divId) {    $.blockUI.defaults.css = {};    $.blockUI({		message: $('#' + divId),		css: {			marginLeft: '-' + Math.floor(320 / 2 + 15 + 3) + 'px', marginTop: '-' + ($('#' + divId).height() / 2 + 15 + 3) + 'px',			width: '320px'		}	});}function overlayClose(divId) {    $.unblockUI();}/* TOOLTIPS ---------- *//*! * jQuery Tools v1.2.5 - The missing UI library for the Web *  * tooltip/tooltip.js * tooltip/tooltip.dynamic.js * tooltip/tooltip.slide.js *  * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE. *  * http://flowplayer.org/tools/ *  */(function(a){a.tools=a.tools||{version:"v1.2.5"},a.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:!1,cancelDefault:!0,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,c,d){b[a]=[c,d]}};var b={toggle:[function(a){var b=this.getConf(),c=this.getTip(),d=b.opacity;d<1&&c.css({opacity:d}),c.show(),a.call()},function(a){this.getTip().hide(),a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};function c(b,c,d){var e=d.relative?b.position().top:b.offset().top,f=d.relative?b.position().left:b.offset().left,g=d.position[0];e-=c.outerHeight()-d.offset[0],f+=b.outerWidth()+d.offset[1],/iPad/i.test(navigator.userAgent)&&(e-=a(window).scrollTop());var h=c.outerHeight()+b.outerHeight();g=="center"&&(e+=h/2),g=="bottom"&&(e+=h),g=d.position[1];var i=c.outerWidth()+b.outerWidth();g=="center"&&(f-=i/2),g=="left"&&(f-=i);return{top:e,left:f}}function d(d,e){var f=this,g=d.add(f),h,i=0,j=0,k=d.attr("title"),l=d.attr("data-tooltip"),m=b[e.effect],n,o=d.is(":input"),p=o&&d.is(":checkbox, :radio, select, :button, :submit"),q=d.attr("type"),r=e.events[q]||e.events[o?p?"widget":"input":"def"];if(!m)throw"Nonexistent effect \""+e.effect+"\"";r=r.split(/,\s*/);if(r.length!=2)throw"Tooltip: bad events configuration for "+q;d.bind(r[0],function(a){clearTimeout(i),e.predelay?j=setTimeout(function(){f.show(a)},e.predelay):f.show(a)}).bind(r[1],function(a){clearTimeout(j),e.delay?i=setTimeout(function(){f.hide(a)},e.delay):f.hide(a)}),k&&e.cancelDefault&&(d.removeAttr("title"),d.data("title",k)),a.extend(f,{show:function(b){if(!h){l?h=a(l):e.tip?h=a(e.tip).eq(0):k?h=a(e.layout).addClass(e.tipClass).appendTo(document.body).hide().append(k):(h=d.next(),h.length||(h=d.parent().next()));if(!h.length)throw"Cannot find tooltip for "+d}if(f.isShown())return f;h.stop(!0,!0);var o=c(d,h,e);e.tip&&h.html(d.data("title")),b=b||a.Event(),b.type="onBeforeShow",g.trigger(b,[o]);if(b.isDefaultPrevented())return f;o=c(d,h,e),h.css({position:"absolute",top:o.top,left:o.left}),n=!0,m[0].call(f,function(){b.type="onShow",n="full",g.trigger(b)});var p=e.events.tooltip.split(/,\s*/);h.data("__set")||(h.bind(p[0],function(){clearTimeout(i),clearTimeout(j)}),p[1]&&!d.is("input:not(:checkbox, :radio), textarea")&&h.bind(p[1],function(a){a.relatedTarget!=d[0]&&d.trigger(r[1].split(" ")[0])}),h.data("__set",!0));return f},hide:function(c){if(!h||!f.isShown())return f;c=c||a.Event(),c.type="onBeforeHide",g.trigger(c);if(!c.isDefaultPrevented()){n=!1,b[e.effect][1].call(f,function(){c.type="onHide",g.trigger(c)});return f}},isShown:function(a){return a?n=="full":n},getConf:function(){return e},getTip:function(){return h},getTrigger:function(){return d}}),a.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(b,c){a.isFunction(e[c])&&a(f).bind(c,e[c]),f[c]=function(b){b&&a(f).bind(c,b);return f}})}a.fn.tooltip=function(b){var c=this.data("tooltip");if(c)return c;b=a.extend(!0,{},a.tools.tooltip.conf,b),typeof b.position=="string"&&(b.position=b.position.split(/,?\s/)),this.each(function(){c=new d(a(this),b),a(this).data("tooltip",c)});return b.api?c:this}})(jQuery);(function(a){var b=a.tools.tooltip;b.dynamic={conf:{classNames:"top right bottom left"}};function c(b){var c=a(window),d=c.width()+c.scrollLeft(),e=c.height()+c.scrollTop();return[b.offset().top<=c.scrollTop(),d<=b.offset().left+b.width(),e<=b.offset().top+b.height(),c.scrollLeft()>=b.offset().left]}function d(a){var b=a.length;while(b--)if(a[b])return!1;return!0}a.fn.dynamic=function(e){typeof e=="number"&&(e={speed:e}),e=a.extend({},b.dynamic.conf,e);var f=e.classNames.split(/\s/),g;this.each(function(){var b=a(this).tooltip().onBeforeShow(function(b,h){var i=this.getTip(),j=this.getConf();g||(g=[j.position[0],j.position[1],j.offset[0],j.offset[1],a.extend({},j)]),a.extend(j,g[4]),j.position=[g[0],g[1]],j.offset=[g[2],g[3]],i.css({visibility:"hidden",position:"absolute",top:h.top,left:h.left}).show();var k=c(i);if(!d(k)){k[2]&&(a.extend(j,e.top),j.position[0]="top",i.addClass(f[0])),k[3]&&(a.extend(j,e.right),j.position[1]="right",i.addClass(f[1])),k[0]&&(a.extend(j,e.bottom),j.position[0]="bottom",i.addClass(f[2])),k[1]&&(a.extend(j,e.left),j.position[1]="left",i.addClass(f[3]));if(k[0]||k[2])j.offset[0]*=-1;if(k[1]||k[3])j.offset[1]*=-1}i.css({visibility:"visible"}).hide()});b.onBeforeShow(function(){var a=this.getConf(),b=this.getTip();setTimeout(function(){a.position=[g[0],g[1]],a.offset=[g[2],g[3]]},0)}),b.onHide(function(){var a=this.getTip();a.removeClass(e.classNames)}),ret=b});return e.api?ret:this}})(jQuery);(function(a){var b=a.tools.tooltip;a.extend(b.conf,{direction:"up",bounce:!1,slideOffset:10,slideInSpeed:200,slideOutSpeed:200,slideFade:!a.browser.msie});var c={up:["-","top"],down:["+","top"],left:["-","left"],right:["+","left"]};b.addEffect("slide",function(a){var b=this.getConf(),d=this.getTip(),e=b.slideFade?{opacity:b.opacity}:{},f=c[b.direction]||c.up;e[f[1]]=f[0]+"="+b.slideOffset,b.slideFade&&d.css({opacity:0}),d.show().animate(e,b.slideInSpeed,a)},function(b){var d=this.getConf(),e=d.slideOffset,f=d.slideFade?{opacity:0}:{},g=c[d.direction]||c.up,h=""+g[0];d.bounce&&(h=h=="+"?"-":"+"),f[g[1]]=h+"="+e,this.getTip().animate(f,d.slideOutSpeed,function(){a(this).hide(),b.call()})})})(jQuery);/** TableSorter 2.0 - Client-side table sorting with ease!* Version 2.0.20.1 Minified using http://dean.edwards.name/packer/* Copyright (c) 2007 Christian Bachhttp://mottie.github.com/tablesorter/docs/*/(function($){$.extend({tablesorter:new function(){var g=[],widgets=[],tbl;this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:false,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",onRenderHeader:null,selectorHeaders:'thead th',tableClass:'tablesorter',debug:false};function log(s){if(typeof console!=="undefined"&&typeof console.debug!=="undefined"){console.log(s)}else{alert(s)}}function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms")}this.benchmark=benchmark;function getElementText(a,b,c){var d="",te=a.textExtraction;if(!b){return""}if(!a.supportsTextContent){a.supportsTextContent=b.textContent||false}if(te==="simple"){if(a.supportsTextContent){d=b.textContent}else{if(b.childNodes[0]&&b.childNodes[0].hasChildNodes()){d=b.childNodes[0].innerHTML}else{d=b.innerHTML}}}else{if(typeof(te)==="function"){d=te(b)}else if(typeof(te)==="object"&&te.hasOwnProperty(c)){d=te[c](b)}else{d=$(b).text()}}return d}function getParserById(a){var i,l=g.length;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===a.toLowerCase()){return g[i]}}return false}function getNodeFromRowAndCellIndex(a,b,c){return a[b].cells[c]}function trimAndGetNodeText(a,b,c){return $.trim(getElementText(a,b,c))}function detectParserForColumn(a,b,c,d){var i,l=g.length,node=false,nodeValue='',keepLooking=true;while(nodeValue===''&&keepLooking){c++;if(b[c]){node=getNodeFromRowAndCellIndex(b,c,d);nodeValue=trimAndGetNodeText(a.config,node,d);if(a.config.debug){log('Checking if value was empty on row:'+c)}}else{keepLooking=false}}for(i=1;i<l;i++){if(g[i].is(nodeValue,a,node)){return g[i]}}return g[0]}function buildParserCache(a,b){if(a.tBodies.length===0){return}var c=a.tBodies[0].rows,list,cells,l,h,i,p,parsersDebug="";if(c[0]){list=[];cells=c[0].cells;l=cells.length;for(i=0;i<l;i++){p=false;h=$(b[i]);if($.metadata&&(h.metadata()&&h.metadata().sorter)){p=getParserById(h.metadata().sorter)}else if((a.config.headers[i]&&a.config.headers[i].sorter)){p=getParserById(a.config.headers[i].sorter)}else if(h.attr('class')&&h.attr('class').match('sorter-')){p=getParserById(h.attr('class').match(/sorter-(\w+)/)[1]||'')}if(!p){p=detectParserForColumn(a,c,-1,i)}if(a.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n"}list.push(p)}}if(a.config.debug){log(parsersDebug)}return list}function buildCache(a){var b=a.tBodies[0],totalRows=(b&&b.rows.length)||0,totalCells=(b.rows[0]&&b.rows[0].cells.length)||0,g=a.config.parsers,cache={row:[],normalized:[]},i,j,c,cols,cacheTime;if(a.config.debug){cacheTime=new Date()}for(i=0;i<totalRows;++i){c=$(b.rows[i]);cols=[];if(c.hasClass(a.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue}cache.row.push(c);for(j=0;j<totalCells;++j){cols.push(g[j].format(getElementText(a.config,c[0].cells[j],j),a,c[0].cells[j]))}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null}if(a.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime)}a.config.cache=cache;return cache}function getWidgetById(a){var i,w,l=widgets.length;for(i=0;i<l;i++){w=widgets[i];if(w&&w.hasOwnProperty('id')&&w.id.toLowerCase()===a.toLowerCase()){return w}}}function applyWidget(a){var c=a.config.widgets,i,w,l=c.length;for(i=0;i<l;i++){w=getWidgetById(c[i]);if(w&&w.hasOwnProperty('format')){w.format(a)}}}function appendToTable(a,b){var c=a.config,r=b.row,n=b.normalized,totalRows=n.length,checkCell=totalRows?(n[0].length-1):0,rows=[],i,j,l,pos,appendTime;if(c.debug){appendTime=new Date()}for(i=0;i<totalRows;i++){pos=n[i][checkCell];rows.push(r[pos]);if(!c.appender){l=r[pos].length;for(j=0;j<l;j++){a.tBodies[0].appendChild(r[pos][j])}}}if(c.appender){c.appender(a,rows)}rows=null;if(c.debug){benchmark("Rebuilt table:",appendTime)}applyWidget(a);setTimeout(function(){$(a).trigger("sortEnd",a)},0)}function computeTableHeaderCellIndexes(t){var a=[],lookup={},thead=t.getElementsByTagName('THEAD')[0],trs=thead.getElementsByTagName('TR'),i,j,k,l,c,cells,rowIndex,cellId,rowSpan,colSpan,firstAvailCol,matrixrow;for(i=0;i<trs.length;i++){cells=trs[i].cells;for(j=0;j<cells.length;j++){c=cells[j];rowIndex=c.parentNode.rowIndex;cellId=rowIndex+"-"+c.cellIndex;rowSpan=c.rowSpan||1;colSpan=c.colSpan||1;if(typeof(a[rowIndex])==="undefined"){a[rowIndex]=[]}for(k=0;k<a[rowIndex].length+1;k++){if(typeof(a[rowIndex][k])==="undefined"){firstAvailCol=k;break}}lookup[cellId]=firstAvailCol;for(k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(a[k])==="undefined"){a[k]=[]}matrixrow=a[k];for(l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x"}}}}return lookup}function formatSortingOrder(v){if(typeof(v)!=="number"){return(v.toLowerCase().charAt(0)==="d")?1:0}else{return(v===1)?1:0}}function checkHeaderMetadata(a){return(($.metadata)&&($(a).metadata().sorter===false))}function checkHeaderOptions(a,i){return((a.config.headers[i])&&(a.config.headers[i].sorter===false))}function checkHeaderLocked(a,i){if((a.config.headers[i])&&(a.config.headers[i].lockedOrder!==null)){return a.config.headers[i].lockedOrder}return false}function checkHeaderOrder(a,i){if((a.config.headers[i])&&(a.config.headers[i].sortInitialOrder)){return a.config.headers[i].sortInitialOrder}return a.config.sortInitialOrder}function buildHeaders(b){var d=($.metadata)?true:false,header_index=computeTableHeaderCellIndexes(b),$th,lock,time,$tableHeaders,c=b.config;c.headerList=[];if(c.debug){time=new Date()}$tableHeaders=$(c.selectorHeaders,b).wrapInner("<span/>").each(function(a){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(checkHeaderOrder(b,a));this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(b,a)||$(this).is('.sorter-false')){this.sortDisabled=true}this.lockedOrder=false;lock=checkHeaderLocked(b,a);if(typeof(lock)!=='undefined'&&lock!==false){this.order=this.lockedOrder=formatSortingOrder(lock)}if(!this.sortDisabled){$th=$(this).addClass(c.cssHeader);if(c.onRenderHeader){c.onRenderHeader.apply($th,[a])}}c.headerList[a]=this});if(c.debug){benchmark("Built headers:",time);log($tableHeaders)}return $tableHeaders}function checkCellColSpan(a,b,d){var i,cell,arr=[],r=a.tHead.rows,c=r[d].cells;for(i=0;i<c.length;i++){cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(a,b,d++))}else{if(a.tHead.length===1||(cell.rowSpan>1||!r[d+1])){arr.push(cell)}}}return arr}function isValueInArray(v,a){var i,l=a.length;for(i=0;i<l;i++){if(a[i][0]===v){return true}}return false}function setHeadersCss(b,c,d,e){c.removeClass(e[0]).removeClass(e[1]);var h=[],i,l;c.each(function(a){if(!this.sortDisabled){h[this.column]=$(this)}});l=d.length;for(i=0;i<l;i++){h[d[i][0]].addClass(e[d[i][1]])}}function fixColumnWidth(a,b){if(a.config.widthFixed){var c=$('<colgroup>');$("tr:first td",a.tBodies[0]).each(function(){c.append($('<col>').css('width',$(this).width()))});$(a).prepend(c)}}function updateHeaderSortCount(a,b){var i,s,o,c=a.config,l=b.length;for(i=0;i<l;i++){s=b[i];o=c.headerList[s[0]];o.count=s[1];o.count++}}function getCachedSortType(a,i){return(a)?a[i].type:''}function multisort(a,b,d){var f="var sortWrapper = function(a,b) {",col,mx=0,dir=0,tc=a.config,lc=d.normalized.length,l=b.length,sortTime,i,j,c,s,e,order,orgOrderCol;if(tc.debug){sortTime=new Date()}for(i=0;i<l;i++){c=b[i][0];order=b[i][1];s=(getCachedSortType(tc.parsers,c)==="text")?((order===0)?"sortText":"sortTextDesc"):((order===0)?"sortNumeric":"sortNumericDesc");e="e"+i;if(/Numeric/.test(s)&&tc.headers[c]&&tc.headers[c].string){for(j=0;j<lc;j++){col=Math.abs(parseFloat(d.normalized[j][c]));mx=Math.max(mx,isNaN(col)?0:col)}dir=(tc.headers[c])?tc.string[tc.headers[c].string]||0:0}f+="var "+e+" = "+s+"(a["+c+"],b["+c+"],"+mx+","+dir+"); ";f+="if ("+e+") { return "+e+"; } ";f+="else { "}orgOrderCol=(d.normalized&&d.normalized[0])?d.normalized[0].length-1:0;f+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(i=0;i<l;i++){f+="}; "}f+="return 0; ";f+="}; ";eval(f);d.normalized.sort(sortWrapper);if(tc.debug){benchmark("Sorting on "+b.toString()+" and dir "+order+" time:",sortTime)}return d}function sortText(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare){return a.localeCompare(b)}if(a===b){return 0}try{var c=0,ax,t,x=/^(\.)?\d/,L=Math.min(a.length,b.length)+1;while(c<L&&a.charAt(c)===b.charAt(c)&&x.test(b.substring(c))===false&&x.test(a.substring(c))===false){c++}a=a.substring(c);b=b.substring(c);if(x.test(a)||x.test(b)){if(x.test(a)===false){return(a)?1:-1}else if(x.test(b)===false){return(b)?-1:1}else{t=parseFloat(a)-parseFloat(b);if(t!==0){return t}else{t=a.search(/[^\.\d]/)}if(t===-1){t=b.search(/[^\.\d]/)}a=a.substring(t);b=b.substring(t)}}return(a>b)?1:-1}catch(er){return 0}}function sortTextDesc(a,b){if($.data(tbl[0],"tablesorter").sortLocaleCompare){return b.localeCompare(a)}return-sortText(a,b)}function getTextValue(a,b,d){if(a===''){return(d||0)*Number.MAX_VALUE}if(b){var i,l=a.length,n=b+d;for(i=0;i<l;i++){n+=a.charCodeAt(i)}return d*n}return 0}function sortNumeric(a,b,c,d){if(a===''||isNaN(a)){a=getTextValue(a,c,d)}if(b===''||isNaN(b)){b=getTextValue(b,c,d)}return a-b}function sortNumericDesc(a,b,c,d){if(a===''||isNaN(a)){a=getTextValue(a,c,d)}if(b===''||isNaN(b)){b=getTextValue(b,c,d)}return b-a}this.construct=function(d){return this.each(function(){if(!this.tHead||!this.tBodies){return}var c,$document,$headers,cache,config,shiftDown=0,sortOrder,sortCSS,totalRows,$cell,i,j,a,s,o;this.config={};config=$.extend(this.config,$.tablesorter.defaults,d);tbl=c=$(this).addClass(this.config.tableClass);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);this.config.string={max:1,'max+':1,'max-':-1,none:0};cache=buildCache(this);sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){totalRows=(c[0].tBodies[0]&&c[0].tBodies[0].rows.length)||0;if(!this.sortDisabled){c.trigger("sortStart",tbl[0]);$cell=$(this);i=this.column;this.order=this.count++%2;if(typeof(this.lockedOrder)!=="undefined"&&this.lockedOrder!==false){this.order=this.lockedOrder}if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!==null){a=config.sortForce;for(j=0;j<a.length;j++){if(a[j][0]!==i){config.sortList.push(a[j])}}}config.sortList.push([i,this.order])}else{if(isValueInArray(i,config.sortList)){for(j=0;j<config.sortList.length;j++){s=config.sortList[j];o=config.headerList[s[0]];if(s[0]===i){o.count=s[1];o.count++;s[1]=o.count%2}}}else{config.sortList.push([i,this.order])}}if(config.sortAppend!==null){a=config.sortAppend;for(j=0;j<a.length;j++){if(a[j][0]!==i){config.sortList.push(a[j])}}}setTimeout(function(){setHeadersCss(c[0],$headers,config.sortList,sortCSS);appendToTable(c[0],multisort(c[0],config.sortList,cache))},1);return false}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false}});c.bind("update",function(){var a=this;setTimeout(function(){a.config.parsers=buildParserCache(a,$headers);cache=buildCache(a);c.trigger("sorton",[a.config.sortList])},1)}).bind("updateCell",function(e,a){var b=this.config,pos=[(a.parentNode.rowIndex-1),a.cellIndex];cache.normalized[pos[0]][pos[1]]=b.parsers[pos[1]].format(getElementText(b,a,pos[1]),a);this.config.cache=cache;c.trigger("sorton",[b.sortList])}).bind("addRows",function(e,a){var i,config=this.config,rows=a.filter('tr').length,dat=[],l=a[0].cells.length;for(i=0;i<rows;i++){for(j=0;j<l;j++){dat[j]=config.parsers[j].format(getElementText(config,a[i].cells[j],j),a[i].cells[j])}dat.push(cache.row.length);cache.row.push([a[i]]);cache.normalized.push(dat);dat=[]}config.cache=cache;c.trigger("sorton",[config.sortList])}).bind("sorton",function(e,a){$(this).trigger("sortStart",tbl[0]);config.sortList=a;var b=config.sortList;updateHeaderSortCount(this,b);setHeadersCss(this,$headers,b,sortCSS);appendToTable(this,multisort(this,b,cache))}).bind("appendCache",function(){appendToTable(this,cache)}).bind("applyWidgetId",function(e,a){getWidgetById(a).format(this)}).bind("applyWidgets",function(){applyWidget(this)});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist}if(config.sortList.length>0){c.trigger("sorton",[config.sortList])}applyWidget(this)})};this.addParser=function(b){var i,l=g.length,a=true;for(i=0;i<l;i++){if(g[i].id.toLowerCase()===b.id.toLowerCase()){a=false}}if(a){g.push(b)}};this.addWidget=function(a){widgets.push(a)};this.formatFloat=function(s){var i=parseFloat(s);return isNaN(i)?$.trim(s):i};this.isDigit=function(s){return(/^[\-+]?\d*$/).test($.trim(s.replace(/[,.']/g,'')))};this.clearTableBody=function(a){if($.browser.msie){var b=function(){while(this.firstChild){this.removeChild(this.firstChild)}};b.apply(a.tBodies[0])}else{a.tBodies[0].innerHTML=""}}}})();$.fn.extend({tablesorter:$.tablesorter.construct});var m=$.tablesorter;m.addParser({id:"text",is:function(s){return true},format:function(s){return $.trim(s.toLocaleLowerCase())},type:"text"});m.addParser({id:"digit",is:function(s){return $.tablesorter.isDigit(s.replace(/,/g,""))},format:function(s){return $.tablesorter.formatFloat(s.replace(/,/g,""))},type:"numeric"});m.addParser({id:"currency",is:function(s){return(/^[\u00a3$\u20ac\u00a4\u00a5\u00a2?.]/).test(s)},format:function(s){return $.tablesorter.formatFloat(s.replace(/\,/g,'.').replace(new RegExp(/[^0-9. \-]/g),""))},type:"numeric"});m.addParser({id:"ipAddress",is:function(s){return(/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/).test(s)},format:function(s){var i,item,a=s.split("."),r="",l=a.length;for(i=0;i<l;i++){item=a[i];if(item.length===2){r+="0"+item}else{r+=item}}return $.tablesorter.formatFloat(r)},type:"numeric"});m.addParser({id:"url",is:function(s){return(/^(https?|ftp|file):\/\/$/).test(s)},format:function(s){return $.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''))},type:"text"});m.addParser({id:"isoDate",is:function(s){return(/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/).test(s)},format:function(s){return $.tablesorter.formatFloat((s!=="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0")},type:"numeric"});m.addParser({id:"percent",is:function(s){return(/\%$/).test($.trim(s))},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""))},type:"numeric"});m.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/))},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"shortDate",is:function(s){return(/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/).test(s)},format:function(s,a){var c=a.config;s=s.replace(/\-/g,"/");if(c.dateFormat==="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2")}else if(c.dateFormat==="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1")}else if(c.dateFormat==="dd/mm/yy"||c.dateFormat==="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3")}return $.tablesorter.formatFloat(new Date(s).getTime())},type:"numeric"});m.addParser({id:"time",is:function(s){return(/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/).test(s)},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime())},type:"numeric"});m.addParser({id:"metadata",is:function(s){return false},format:function(s,a,b){var c=a.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(b).metadata()[p]},type:"numeric"});m.addWidget({id:"zebra",format:function(a){var b,row=-1,odd,time;if(a.config.debug){time=new Date()}$("tr:visible",a.tBodies[0]).each(function(i){b=$(this);if(!b.hasClass(a.config.cssChildRow)){row++}odd=(row%2===0);b.removeClass(a.config.widgetZebra.css[odd?0:1]).addClass(a.config.widgetZebra.css[odd?1:0])});if(a.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time)}}})})(jQuery);// initialize$(document).ready(function() {    //tooltips    $("div#uniform_number, div#player_name, div#g, div#pa, div#ab, div#h, div#do, div#tr, div#hr, div#r, div#rbi, div#bb, div#ibb, div#so, div#sh, div#sf, div#hbp, div#sb, div#cs, div#gdp, div#avg, div#obp, div#slg, div#bsr, div#bsr_pa, div#pog").tooltip({        effect: 'slide',        offset: [-20, -180],        predelay: 2000    }).dynamic({        bottom: {            bounce: true,            direction: 'down',            offset: [20, -180]        }    });    //default striping	//$('table.striped').trigger('applyWidgetId', ['zebra']);     $("table.striped tbody tr:nth-child(even)").addClass("even");    $("table.striped tbody tr:nth-child(odd)").addClass("odd");    //default sorting	$("table.sortable.game, table.sortable.player, table.sortable.history").tablesorter({		widgets: ['zebra']     });    $("table.sortable.softball.team").tablesorter({        sortList: [            [18,1]        ],		widgets: ['zebra']     });	$("table.sortable.baseball.team").tablesorter({        sortList: [            [23,1]        ],		widgets: ['zebra']     });});
