/**
 * list of jQuery plugins:
 * 
 * 1. jquery.lightbox.min
 *    @see http://plugins.jquery.com/project/jquerylightbox_bal
 *    code changed: files:{compressed:{scripts:{lightbox:"js/plugins.js"....
 * 
 * 2. jquery.tablesorter
 *    @see http://tablesorter.com/docs/
 */

/*
 * 1. jquery.lightbox.min
 * GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 * @example Visit {@link http://www.balupton.com/projects/jquery-lightbox} for more information.
 * MIT License - {@link http://opensource.org/licenses/mit-license.php}
 * GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html}
 */
(function(b){if(typeof window.console!=="object"||typeof window.console.emulated==="undefined"){if(typeof window.console!=="object"||!(typeof window.console.log==="function"||typeof window.console.log==="object")){window.console={};window.console.log=window.console.debug=window.console.warn=window.console.trace=function(){};window.console.error=function(){for(var a="An error has occured. More information will be available in the console log.",c=0;c<arguments.length;++c){if(typeof arguments[c]!=="string")break;
a+="\n"+arguments[c]}if(typeof Error!=="undefined")throw Error(a);else throw a;}}else{if(typeof window.console.debug==="undefined")window.console.debug=function(){for(var a=["console.debug:"],c=0;c<arguments.length;c++)a.push(arguments[c]);window.console.log.apply(window.console,a)};if(typeof window.console.warn==="undefined")window.console.warn=function(){for(var a=["console.warn:"],c=0;c<arguments.length;c++)a.push(arguments[c]);window.console.log.apply(window.console,a)};if(typeof window.console.error===
"undefined")window.console.error=function(){for(var a=["console.error"],c=0;c<arguments.length;c++)a.push(arguments[c]);window.console.log.apply(window.console,a)};if(typeof window.console.trace==="undefined")window.console.trace=function(){window.console.error.apply(window.console,["console.trace does not exist"])}}window.console.emulated=true}String.prototype.queryStringToJSON=String.prototype.queryStringToJSON||function(){var a=String(this);a=a.substring(a.indexOf("?")+1);a=a.replace(/\+/g,"%20");
if(a.substring(0,1)==="{"&&a.substring(a.length-1)==="}")return eval(decodeURIComponent(a));a=a.split(/\&(amp\;)?/);for(var c={},d=0,e=a.length;d<e;++d){var f=a[d]||null;if(f!==null){f=f.split("=");if(f!==null){var i=f[0]||null;if(i!==null)if(typeof f[1]!=="undefined"){f=f[1];i=decodeURIComponent(i);f=decodeURIComponent(f);try{f=eval(f)}catch(g){}var h=i.split(".");if(h.length===1)c[i]=f;else{var j="",k="";b.each(h,function(l,m){j+='["'+m.replace(/"/g,'\\"')+'"]';jsonCLOSUREGLOBAL=c;k="if ( typeof jsonCLOSUREGLOBAL"+
j+' === "undefined" ) jsonCLOSUREGLOBAL'+j+" = {}";eval(k);c=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL});jsonCLOSUREGLOBAL=c;valueCLOSUREGLOBAL=f;k="jsonCLOSUREGLOBAL"+j+" = valueCLOSUREGLOBAL";eval(k);c=jsonCLOSUREGLOBAL;delete jsonCLOSUREGLOBAL;delete valueCLOSUREGLOBAL}}}}}return c};Array.prototype.remove=function(a,c){var d=this.slice((c||a)+1||this.length);this.length=a<0?this.length+a:a;return this.push.apply(this,d)};Array.prototype.get=function(a,c){if(a==="first")a=0;else if(a==="last")a=
this.length-1;else if(a==="prev")a=this.index-1;else if(a==="next")a=this.index+1;else if(!a&&a!==0)a=this.index;c&&this.setIndex(a);return this.exists(a)?this[a]:undefined};Array.prototype.each=function(a){for(var c=0;c<this.length;++c)if(a(c,this[c],this)===false)break;return this};Array.prototype.validIndex=function(a){return a>=0&&a<this.length};Array.prototype.setIndex=function(a){this.index=this.validIndex(a)?a:null;return this};Array.prototype.current=function(a){return this.get(a,true)};Array.prototype.isEmpty=
function(){return this.length===0};Array.prototype.isSingle=function(){return this.length===1};Array.prototype.isNotEmpty=function(){return this.length!==0};Array.prototype.isNotEmpty=function(){return this.length>1};Array.prototype.isLast=function(a){a=typeof a==="undefined"?this.index:a;return!this.isEmpty()&&a===this.length-1};Array.prototype.isFirst=function(a){a=typeof a==="undefined"?this.index:a;return!this.isEmpty()&&a===0};Array.prototype.clear=function(){this.length=0};Array.prototype.next=
function(a){return this.get(this.index+1,a)};Array.prototype.prev=function(a){return this.get(this.index-1,a)};Array.prototype.reset=function(){this.index=null;return this};Array.prototype.set=function(a,c){if(a<this.length&&a>=0)this[a]=c;else throw Error("Array.prototype.set: [index] above this.length");return this};Array.prototype.loop=function(){if(!this.index&&this.index!==0)return this.current(0);return this.next()};Array.prototype.add=function(){this.push.apply(this,arguments);return this};
Array.prototype.insert=function(a,c){if(typeof a!=="number")a=this.length;a=a<=this.length?a:this.length;var d=this.slice(a);this.length=a;this.push(c);this.push.apply(this,d);return this};Array.prototype.exists=Array.prototype.exists||function(a){return typeof this[a]!=="undefined"};Array.prototype.has=Array.prototype.has||function(a){for(var c=false,d=0,e=this.length;d<e;++d)if(a==this[d]){c=true;break}return c};b.fn.once=b.fn.once||function(a,c,d){var e=b(this);if(d){e.unbind(a,d);e.bind(a,c,d)}else{d=
c;e.unbind(a,d);e.bind(a,d)}return e};b.fn.binder=b.fn.binder||function(a,c,d){var e=b(this);if(d)e.bind(a,c,d);else{d=c;e.bind(a,d)}return e};b.fn.lastclick=b.fn.lastclick||function(a,c){return b(this).binder("lastclick",a,c)};b.event.special.lastclick=b.event.special.lastclick||{setup:function(){b(this).bind("click",b.event.special.lastclick.handler)},teardown:function(){b(this).unbind("click",b.event.special.lastclick.handler)},handler:function(a){var c=function(){var d=b(this),e=d.data("lastclick-timeout")||
false;e&&clearTimeout(e);e=false;d.data("lastclick-timeout",e)};(function(d){var e=this;c.call(e);var f=b(e);f.data("lastclick-clicks",(f.data("lastclick-clicks")||0)+1);var i=setTimeout(function(){var g=f.data("lastclick-clicks");c.apply(e,[d]);f.data("lastclick-clicks",0);d.type="lastclick";b.event.handle.apply(e,[d,g])},300);f.data("lastclick-timeout",i)}).apply(this,[a])}};b.fn.preventDefault=b.fn.preventDefault||function(){return b(this).click(function(a){a.preventDefault();return false})};b.LightboxClass=
function(){this.construct()};b.fn.lightbox=function(a){b.Lightbox=b.Lightbox||new b.LightboxClass;if(b.Lightbox.ie6&&!b.Lightbox.ie6_support)return this;a=b.extend({start:false,events:true},a);var c=b(this);if(a.events){c.preventDefault().once("lastclick",function(d){var e=b(this);e=c.index(e);if(!b.Lightbox.init(e,c))return false;if(!b.Lightbox.start())return false;d.preventDefault();return false});c.addClass("lightbox-enabled")}if(a.start){b(this);if(!b.Lightbox.init(0,c))return this;if(!b.Lightbox.start())return this}return this};
b.extend(b.LightboxClass.prototype,{images:[],constructed:false,compressed:null,src:null,baseurl:null,files:{compressed:{scripts:{lightbox:"js/plugins.js",colorBlend:"scripts/jquery.color.min.js"},styles:{lightbox:"styles/jquery.lightbox.min.css"}},uncompressed:{scripts:{lightbox:"scripts/jquery.lightbox.js",colorBlend:"scripts/jquery.color.js"},styles:{lightbox:"styles/jquery.lightbox.css"}},images:{prev:"images/prev.gif",next:"images/next.gif",blank:"images/blank.gif",loading:"images/loading.gif"}},
text:{image:"Image",of:"of",close:"Close X",closeInfo:"You can also click anywhere outside the image to close.",download:"Download.",help:{close:"Click to close",interact:"Hover to interact"},about:{text:"jQuery Lightbox Plugin (balupton edition)",title:"Licenced under the GNU Affero General Public License.",link:"http://www.balupton.com/projects/jquery-lightbox"}},keys:{close:"c",prev:"p",next:"n"},handlers:{show:null},opacity:0.9,padding:null,speed:400,rel:"lightbox",auto_relify:true,auto_scroll:"follow",
auto_resize:true,ie6:null,ie6_support:true,colorBlend:null,download_link:true,show_helper_text:true,show_linkback:true,show_info:"auto",show_extended_info:"auto",options:["show_helper_text","auto_scroll","auto_resize","download_link","show_info","show_extended_info","ie6_support","colorBlend","baseurl","files","text","show_linkback","keys","opacity","padding","speed","rel","auto_relify"],construct:function(a){var c=typeof this.constructed==="undefined"||this.constructed===false;this.constructed=true;
var d=c;a=a||{};var e=function(g,h){if(typeof g==="object")for(var j in g)g[j]=e(g[j],h);else if(typeof h==="array"){j=0;for(var k=g.length;j<k;++j)g[j]=e(g[j],h)}else g=h+g;return g};if(c&&typeof a.files==="undefined"){this.compressed=null;var f=b("script[src*="+this.files.compressed.scripts.lightbox+"]:first");if(f.length!==0){b.extend(true,this.files,this.files.compressed);this.compressed=true}else{f=b("script[src*="+this.files.uncompressed.scripts.lightbox+"]:first");if(f.length!==0){b.extend(true,
this.files,this.files.uncompressed);this.compressed=false}}if(this.compressed===null){window.console.error("Lightbox was not able to find it's javascript script tag necessary for auto-inclusion.");d=false}else{this.src=f.attr("src");this.baseurl=this.src.substring(0,this.src.indexOf(this.files.scripts.lightbox));this.files=e(this.files,this.baseurl);a=b.extend(a,this.src.queryStringToJSON())}this.images.image={src:"",title:"Untitled",description:"",name:"",color:null,width:null,height:null,id:null,
image:true};this.images.prepare=function(g){var h=b.extend({},this.image);if(g.tagName){g=b(g);if(g.attr("src")||g.attr("href")){h.src=g.attr("src")||g.attr("href");h.title=g.attr("title")||g.attr("alt")||h.title;h.name=g.attr("name")||"";h.color=g.css("backgroundColor");g=h.title.indexOf(": ");if(g>0){h.description=h.title.substring(g+2)||h.description;h.title=h.title.substring(0,g)||h.title}}else h=null}else h=g.src?b.extend(this.image,g):null;if(h)h.id=h.id||h.src+h.title+h.description;return h};
this.images.create=function(g){var h=this;if(g.each)g.each(function(k,l){h.create(l)});else{var j=h.prepare(g);j?h.push(j):window.console.error("We dont know what we have:",g,j);return h}}}else if(typeof a.files==="object")a.files=e(a.files,this.baseurl);else d=false;for(var i in this.options){f=this.options[i];if(typeof a[f]==="object"&&typeof this[f]==="object")this[f]=b.extend(true,this[f],a[f]);else if(typeof a[f]!=="undefined")this[f]=a[f]}delete i;this.ie6=c&&navigator.userAgent.indexOf("MSIE 6")>=
0?true:false;if(d||typeof a.download_link!=="undefined"||typeof a.colorBlend!=="undefined"||typeof a.files==="object"||typeof a.text==="object"||typeof a.show_linkback!=="undefined"||typeof a.scroll_with!=="undefined")b(function(){b.Lightbox.domReady()});return true},domReady:function(){var a=document.getElementsByTagName(b.browser.safari?"head":"body")[0],c=this.files.styles,d=this.files.scripts;if(this.colorBlend===true&&typeof b.colorBlend==="undefined")this.colorBlend=true;else{this.colorBlend=
typeof b.colorBlend!=="undefined";delete d.colorBlend}for(stylesheet in c){var e=document.createElement("link");e.type="text/css";e.rel="stylesheet";e.media="screen";e.href=c[stylesheet];e.id="lightbox-stylesheet-"+stylesheet.replace(/[^a-zA-Z0-9]/g,"");b("#"+e.id).remove();a.appendChild(e)}delete d.lightbox;for(script in d){e=document.createElement("script");e.type="text/javascript";e.src=d[script];e.id="lightbox-script-"+script.replace(/[^a-zA-Z0-9]/g,"");b("#"+e.id).remove();a.appendChild(e)}delete d;
delete c;delete a;b("#lightbox,#lightbox-overlay").remove();b("body").append('<div id="lightbox-overlay"><div id="lightbox-overlay-text">'+(this.show_linkback?'<p><span id="lightbox-overlay-text-about"><a href="#" title="'+this.text.about.title+'">'+this.text.about.text+"</a></span></p><p>&nbsp;</p>":"")+(this.show_helper_text?'<p><span id="lightbox-overlay-text-close">'+this.text.help.close+'</span><br/>&nbsp;<span id="lightbox-overlay-text-interact">'+this.text.help.interact+"</span></p>":"")+'</div></div><div id="lightbox"><div id="lightbox-imageBox"><div id="lightbox-imageContainer"><img id="lightbox-image" /><div id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+
this.files.images.loading+'" /></a></div></div></div><div id="lightbox-infoBox"><div id="lightbox-infoContainer"><div id="lightbox-infoHeader"><span id="lightbox-caption">'+(this.download_link?'<a href="#" title="'+this.text.download+'" id="lightbox-caption-title"></a>':'<span id="lightbox-caption-title"></span>')+'<span id="lightbox-caption-seperator"></span><span id="lightbox-caption-description"></span></span></div><div id="lightbox-infoFooter"><span id="lightbox-currentNumber"></span><span id="lightbox-close"><a href="#" id="lightbox-close-button" title="'+
this.text.closeInfo+'">'+this.text.close+'</a></span></div><div id="lightbox-infoContainer-clear"></div></div></div></div>');this.resizeBoxes();this.repositionBoxes();b("#lightbox,#lightbox-overlay,#lightbox-overlay-text-interact").hide();this.ie6&&this.ie6_support&&b("#lightbox-overlay").css({position:"absolute",top:"0px",left:"0px"});b.each(this.files.images,function(){var f=new Image;f.onload=function(){f=f.onload=null};f.src=this});b(window).unbind("resize").resize(function(){b.Lightbox.resizeBoxes("resized")});
this.scroll==="follow"&&b(window).scroll(function(){b.Lightbox.repositionBoxes()});b("#lightbox-nav-btnPrev").unbind().preventDefault().hover(function(){b(this).css({background:"url("+b.Lightbox.files.images.prev+") left 45% no-repeat"})},function(){b(this).css({background:"transparent url("+b.Lightbox.files.images.blank+") no-repeat"})}).lastclick(function(){b.Lightbox.showImage("prev");return false});b("#lightbox-nav-btnNext").unbind().preventDefault().hover(function(){b(this).css({background:"url("+
b.Lightbox.files.images.next+") right 45% no-repeat"})},function(){b(this).css({background:"transparent url("+b.Lightbox.files.images.blank+") no-repeat"})}).lastclick(function(){b.Lightbox.showImage("next");return false});this.show_linkback&&b("#lightbox-overlay-text-about a").preventDefault().lastclick(function(){window.open(b.Lightbox.text.about.link);return false});b("#lightbox-overlay-text-close").unbind().hover(function(){b("#lightbox-overlay-text-interact").fadeIn()},function(){b("#lightbox-overlay-text-interact").fadeOut()});
this.download_link&&b("#lightbox-caption-title").preventDefault().lastclick(function(){window.open(b(this).attr("href"));return false});b("#lightbox-overlay, #lightbox, #lightbox-loading-link, #lightbox-btnClose").unbind().preventDefault().lastclick(function(){b.Lightbox.finish();return false});this.auto_relify&&this.relify();return true},relify:function(){var a={},c=0,d=this.rel;b.each(b("[rel*="+d+"]"),function(e,f){var i=b(f).attr("rel");if(i===d)i=c;if(typeof a[i]==="undefined"){a[i]=[];c++}a[i].push(f)});
b.each(a,function(e,f){b(f).lightbox()});return true},init:function(a,c){if(typeof c==="undefined"){c=a;a=0}this.images.clear();this.images.create(c);if(this.images.isEmpty()){window.console.warn("WARNING","Lightbox started, but no images: ",a,c);return false}if(!this.images.current(a)){window.console.warn("WARNING","Could not find current image: ",a,this.images);return false}return true},start:function(){this.visible=true;this.scroll==="disable"&&b(document.body).css("overflow","hidden");b("embed, object, select").css("visibility",
"hidden");this.resizeBoxes("general");this.repositionBoxes({speed:0});b("#lightbox-infoFooter").hide();b("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();b("#lightbox-overlay").css("opacity",this.opacity).fadeIn(400,function(){b("#lightbox").fadeIn(300);if(!b.Lightbox.showImage()){b.Lightbox.finish();return false}});return true},finish:function(){b("#lightbox").hide();b("#lightbox-overlay").fadeOut(function(){b("#lightbox-overlay").hide()});b("embed, object, select").css({visibility:"visible"});
this.images.reset();this.scroll==="disable"&&b(document.body).css("overflow","visible");this.visible=false},resizeBoxes:function(a){if(a!=="transition"){var c=b(this.ie6?document.body:document);b("#lightbox-overlay").css({width:c.width(),height:c.height()});delete c}switch(a){case "general":return true;case "resized":if(this.auto_resize===false){this.repositionBoxes({nHeight:g,speed:this.speed});return true}case "transition":default:break}var d=this.images.current();if(!d||!d.width||!this.visible)return false;
c=d.width;d=d.height;g=b(window).width();var e=b(window).height();if(this.auto_resize!==false){g=Math.floor(g*0.8);e=Math.floor(e*0.8);for(var f;c>g||d>e;){if(c>g){f=g/c;c=g;d=Math.floor(d*f)}if(d>e){f=e/d;d=e;c=Math.floor(c*f)}}}var i=b("#lightbox-imageBox").width();f=b("#lightbox-imageBox").height();e=c+this.padding*2;var g=d+this.padding*2;i=i-e;f=f-g;b("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css("height",g);b("#lightbox-infoBox").css("width",e);if(a==="transition")if(i===0&&f===0){this.pause(this.speed/
3);this.showImage(null,3)}else{b("#lightbox-image").width(c).height(d);b("#lightbox-imageBox").animate({width:e,height:g},this.speed,function(){b.Lightbox.showImage(null,3)})}else{b("#lightbox-image").animate({width:c,height:d},this.speed);b("#lightbox-imageBox").animate({width:e,height:g},this.speed)}this.repositionBoxes({nHeight:g,speed:this.speed});return true},repositioning:false,reposition_failsafe:false,repositionBoxes:function(a){if(this.repositioning){this.reposition_failsafe=true;return null}this.repositioning=
true;a=b.extend({},a);a.callback=a.callback||null;a.speed=a.speed||"slow";var c=this.getPageScroll(),d=a.nHeight||parseInt(b("#lightbox").height(),10);d=c.yScroll+(b(window).height()-d)/2.5;c={left:c.xScroll,top:d};if(a.speed)b("#lightbox").animate(c,"slow",function(){if(b.Lightbox.reposition_failsafe){b.Lightbox.repositioning=b.Lightbox.reposition_failsafe=false;b.Lightbox.repositionBoxes(a)}else{b.Lightbox.repositioning=false;a.callback&&a.callback()}});else{b("#lightbox").css(c);if(this.reposition_failsafe){this.repositioning=
this.reposition_failsafe=false;this.repositionBoxes(a)}else this.repositioning=false}return true},visible:false,showImage:function(a,c){c=c||1;if(a=this.images.current(a)||this.images.get("first",true)){switch(c){case 1:this.KeyboardNav_Disable();b("#lightbox-loading").show();b("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();b("#lightbox-imageBox").unbind();if(a.width&&a.height)this.showImage(null,2);else{var d=new Image;d.onload=function(){a.width=
d.width;a.height=d.height;b.Lightbox.showImage(null,2);d=d.onload=null};d.src=a.src}break;case 2:b("#lightbox-image").attr("src",a.src);if(typeof this.padding==="undefined"||this.padding===null||isNaN(this.padding))this.padding=parseInt(b("#lightbox-imageContainer").css("padding-left"),10)||parseInt(b("#lightbox-imageContainer").css("padding"),10)||0;if(this.colorBlend){b("#lightbox-overlay").animate({backgroundColor:a.color},this.speed*2);b("#lightbox-imageBox").css("borderColor",a.color)}this.resizeBoxes("transition");
break;case 3:b("#lightbox-loading").hide();b("#lightbox-image").fadeIn(this.speed*1.5,function(){b.Lightbox.showImage(null,4)});this.preloadNeighbours();this.handlers.show!==null&&this.handlers.show(a);break;case 4:var e=b("#lightbox-caption-title").html(a.title||"Untitled");if(this.download_link)e.attr("href",this.download_link?a.src:"");delete e;b("#lightbox-caption-seperator").html(a.description?": ":"");b("#lightbox-caption-description").html(a.description||"&nbsp;");this.images.length>1?b("#lightbox-currentNumber").html(this.text.image+
"&nbsp;"+(this.images.index+1)+"&nbsp;"+this.text.of+"&nbsp;"+this.images.length):b("#lightbox-currentNumber").html("&nbsp;");b("#lightbox-imageBox").unbind("mouseover").mouseover(function(){b("#lightbox-infoBox:not(:visible)").stop().slideDown("fast")});b("#lightbox-infoBox").unbind("mouseover").mouseover(function(){b("#lightbox-infoFooter:not(:visible)").stop().slideDown("fast")});if(this.show_extended_info===true){b("#lightbox-imageBox").trigger("mouseover");b("#lightbox-infoBox").trigger("mouseover")}else this.show_info===
true&&b("#lightbox-imageBox").trigger("mouseover");b("#lightbox-nav-btnPrev, #lightbox-nav-btnNext").css({background:"transparent url("+this.files.images.blank+") no-repeat"});this.images.isFirst()||b("#lightbox-nav-btnPrev").show();this.images.isLast()||b("#lightbox-nav-btnNext").show();b("#lightbox-nav").show();this.KeyboardNav_Enable();break;default:window.console.error("Don't know what to do: ",a,c);return this.showImage(a,1)}return true}},preloadNeighbours:function(){if(this.images.isSingle()||
this.images.isEmpty())return true;var a=this.images.current(),c=this.images.index;if(!a)return a;var d=this.images.prev();if(d){a=new Image;a.src=d.src}this.images.setIndex(c);if(d=this.images.next()){a=new Image;a.src=d.src}this.images.setIndex(c)},KeyboardNav_Enable:function(){b(document).keydown(function(a){b.Lightbox.KeyboardNav_Action(a)})},KeyboardNav_Disable:function(){b(document).unbind("keydown")},KeyboardNav_Action:function(a){a=a||window.event;var c=a.keyCode;a=a.DOM_VK_ESCAPE||27;var d=
String.fromCharCode(c).toLowerCase();if(d===this.keys.close||c===a)return b.Lightbox.finish();if(d===this.keys.prev||c===37)return b.Lightbox.showImage("prev");if(d===this.keys.next||c===39)return b.Lightbox.showImage("next");return true},getPageScroll:function(){var a,c;if(self.pageYOffset){c=self.pageYOffset;a=self.pageXOffset}else if(document.documentElement&&document.documentElement.scrollTop){c=document.documentElement.scrollTop;a=document.documentElement.scrollLeft}else if(document.body){c=
document.body.scrollTop;a=document.body.scrollLeft}return{xScroll:a,yScroll:c}},pause:function(a){var c=new Date,d=null;do d=new Date;while(d-c<a)}});if(typeof b.Lightbox==="undefined")b.Lightbox=new b.LightboxClass})(jQuery);


/*
 * 2. jquery.tablesorter
 */
(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,cells[i]);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,node){var l=parsers.length;for(var i=1;i<l;i++){if(parsers[i].is($.trim(getElementText(table.config,node)),table,node)){return parsers[i];}}return parsers[0];}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=table.tBodies[0].rows[i],cols=[];cache.row.push($(c));for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c.cells[j]),table,c.cells[j]));}cols.push(i);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){if(!node)return"";var t="";if(config.textExtraction=="simple"){if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){t=node.childNodes[0].innerHTML;}else{t=node.innerHTML;}}else{if(typeof(config.textExtraction)=="function"){t=config.textExtraction(node);}else{t=$(node).text();}}return t;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){rows.push(r[n[i][checkCell]]);if(!table.config.appender){var o=r[n[i][checkCell]];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false,tableHeadersRows=[];for(var i=0;i<table.tHead.rows.length;i++){tableHeadersRows[i]=0;};$tableHeaders=$("thead th",table);$tableHeaders.each(function(index){this.count=0;this.column=index;this.order=formatSortingOrder(table.config.sortInitialOrder);if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(!this.sortDisabled){$(this).addClass(table.config.cssHeader);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){i=(v.toLowerCase()=="desc")?1:0;}else{i=(v==(0||1))?v:0;}return i;}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(getCachedSortType(table.config.parsers,c)=="text")?((order==0)?"sortText":"sortTextDesc"):((order==0)?"sortNumeric":"sortNumericDesc");var e="e"+i;dynamicExp+="var "+e+" = "+s+"(a["+c+"],b["+c+"]); ";dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function sortText(a,b){return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var 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(var j=0;j<config.sortList.length;j++){var 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]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){var DECIMAL='\\'+config.decimal;var exp='/(^[+]?0('+DECIMAL+'0+)?$)|(^([-+]?[1-9][0-9]*)$)|(^([-+]?((0?|[1-9][0-9]*)'+DECIMAL+'(0*[1-9][0-9]*)))$)|(^[-+]?[1-9]+[0-9]*'+DECIMAL+'0+$)/';return RegExp(exp).test($.trim(s));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[^0-9.]/g),""));},type:"numeric"});ts.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 a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.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"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.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"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.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"});ts.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"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}$("tr:visible",table.tBodies[0]).filter(':even').removeClass(table.config.widgetZebra.css[1]).addClass(table.config.widgetZebra.css[0]).end().filter(':odd').removeClass(table.config.widgetZebra.css[0]).addClass(table.config.widgetZebra.css[1]);if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
