/* humanservices.gov.au JavaScript */


/* Listen to this page */

var rs={selectedString:"",getSelectedHTML:function(){rs.selectedString="";var a=undefined;if(window.getSelection){selobj=window.getSelection();if(!selobj.isCollapsed){if(selobj.getRangeAt){a=selobj.getRangeAt(0)}else{a=document.createRange();a.setStart(selobj.anchorNode,selobj.anchorOffset);a.setEnd(selobj.focusNode,selobj.focusOffset)}if(a){DOM=a.cloneContents();object=document.createElement("div");object.appendChild(DOM.cloneNode(true));rs.selectedString=object.innerHTML}else{rs.selectedString=selobj}}}else{if(document.selection){selobj=document.selection;a=selobj.createRange();if(a&&a.htmlText){rs.selectedString=a.htmlText}else{if(a&&a.text){rs.selectedString=a.text}}}else{if(document.getSelection){selectedString=document.getSelection()}}}},issuePOST:function(d){var g=document.createElement("form");g.target="rs";g.method="post";g.style.display="none";var c=d.split("?");g.action="http://app.readspeaker.com/cgi-bin/rsent";var f=c[1].split("&");var e;for(e=0;e<f.length;e++){var b=f[e].split("=");var h=document.createElement("input");h.setAttribute("name",unescape(b[0]));h.setAttribute("value",unescape(b[1]));g.appendChild(h)}if(rs.selectedString.length>0){var h=document.createElement("input");h.setAttribute("name","selectedhtml_base64");h.setAttribute("value",rs.base64Encode(rs.selectedString));g.appendChild(h)}document.body.appendChild(g);var a=window.open("","rs","width=310,height=120,toolbar=0");g.submit();document.body.removeChild(g)},base64Encode:function(f){newdata=encodeURIComponent(f);var g=0;var e=0;var b=[];for(;g<newdata.length;g++){if(newdata.charCodeAt(g)!="%".charCodeAt(0)){b[e]=newdata.charCodeAt(g)}else{b[e]=parseInt("0x"+newdata.charAt(g+1)+""+newdata.charAt(g+2));g=g+2}e++}var l=b.length;var c=4*parseInt((l+2)/3);var h=new String();var k=parseInt(l/3);var a;var d=l-3*k;g=0;for(;g<3*k;g+=3){a=rs.base64Char(b[g]>>2);h+=a;a=rs.base64Char(((b[g]&3)<<4)|(b[g+1]>>4));h+=a;a=rs.base64Char(((b[g+1]&15)<<2)|(b[g+2]>>6));h+=a;a=rs.base64Char(b[g+2]&63);h+=a}if(d==1){h+=rs.base64Char(b[g]>>2);h+=rs.base64Char((b[g]&3)<<4);h+="=";h+="="}if(d==2){h+=rs.base64Char(b[g]>>2);h+=rs.base64Char(((b[g]&3)<<4)|(b[g+1]>>4));h+=rs.base64Char((b[g+1]&15)<<2);h+="="}return h},base64Char:function(a){if(a<26){return String.fromCharCode(a+"A".charCodeAt(0))}else{if(a<52){return String.fromCharCode(a+"a".charCodeAt(0)-26)}else{if(a<62){return String.fromCharCode(a+"0".charCodeAt(0)-52)}else{if(a==62){return"+"}else{if(a==63){return"/"}else{return String.fromCharCode(0)}}}}}},copyselected:function(){setTimeout("rs.getSelectedHTML()",50);return true}};function openAndRead(b){if(!b){var a=document.getElementById("rs_button");if(a){b=a.getAttribute("href")}else{return true}}rs.issuePOST(b)}if(document.addEventListener){document.addEventListener("mouseup",rs.copyselected,false);document.addEventListener("keyup",rs.copyselected,false)}else if(document.attachEvent){document.attachEvent("onmouseup",rs.copyselected);document.attachEvent("onkeyup",rs.copyselected)}else{document.onmouseup=rs.copyselected;document.onkeyup=rs.copyselected}


/* DOCUMENT READY */

$(document).ready(function(){

	/* IE6 no nav fix */

	if (($.browser.msie && $.browser.version < 7) && ($(".navigation").length == 0)) {
		$('.content-grid').addClass('ie-width-fix');
		$('p.top').addClass('ie-width-fix');
		$('.actions').addClass('ie-width-fix');
	}
	
	
	/* background images in IE6 should cache */
	
	if($.browser.msie && $.browser.version<7){
		try {
			document.execCommand("BackgroundImageCache",false,true);
		} catch(err) { }
	}
	
	
	/* Slideshow */

	$('.slideshow').each(function(){
		var counter = 1;
		var n = $('.photos li').length;
		createControls();
		$('.slideshow').css('overflow', 'hidden');
		$('ul.controls').show();
		gotoPhoto(1);
		play();	
		
		function createControls() {
			
			$('.slideshow').append("<div class='control-container'><ul class=\"controls\"><\/ul></div>");

			$("<li class='backArrow'><a href='javascript:;'>&lt;<\/a><\/li>").appendTo("ul.controls");
			for (var i=1;i<=n;i++){	
				$("<li class='num'><a href='javascript:;'>"+i+"<\/a><\/li>").appendTo("ul.controls");
			}
			$("<li class='fwdArrow'><a href='javascript:;'>&gt;<\/a><\/li>").appendTo("ul.controls");
			$('.num').each(function(index) {
			
				$(this).bind("click", function(){
					gotoPhoto(index+1);
					if ($(".play-pause").hasClass('pause')) {
						pause();
						$(".play-pause").removeClass("pause").addClass("play");
					}
				});
			});
			
			$("<li class='play-pause pause'><a href='javascript:;'></a><\/li>").appendTo("ul.controls");

			$(".play-pause").bind("click", function(){
				if ($(this).hasClass('play')) {
					play();
					$(this).removeClass("play").addClass("pause");
				} else {
					pause();
					$(this).removeClass("pause").addClass("play");
				}
			});
			
			$('.num').first().addClass("on");
			$('.backArrow').bind("click", function(){
				if ($(".play-pause").hasClass('pause')) {
					pause();
					$(".play-pause").removeClass("pause").addClass("play");
				}
				previousPhoto();
			});
			
			$('.fwdArrow').bind("click", function(){
				if ($(".play-pause").hasClass('pause')) {
					pause();
					$(".play-pause").removeClass("pause").addClass("play");
				}
				nextPhoto();
			});	

		}
		function gotoPhoto(z) {
			counter = z;
			$("li.on").removeClass("on");
			$(".controls li.num:nth-child(" + (z+1) + ")").addClass("on");
			$('.photos li').hide();
			$(".photos li:nth-child(" + (z) + ")").show();
			
		}
		function nextPhoto() {

			if (counter < n) {
				counter++;
			} else {
				counter = 1;
			}
			gotoPhoto(counter);
		}
		function previousPhoto() {

			if (counter > 1) {
				counter--;
			} else {
				counter = n;
			}
			gotoPhoto(counter);
		}
		function pause(){
			clearInterval(timerInterval);
		}
		function play() {
			timerInterval = setInterval(nextPhoto, 6000); 
		}
	
	});

	
	/* Corporate navigation */

	$('#corp-navigation').each(function(){
		var c, a, d = true;
		$(this).find('ul').hide(); // close all
		c = String(window.location.pathname); // get the current URL: http://www.humanservices.gov.au/corporate/media/media-releases/2011/index
		c = c.replace(window.location.protocol + "//" + window.location.hostname, ""); // remove host info: /corporate/media/media-releases/2011/index
		c = c.split("/")[2]; // get the second directory/item: media
		$(this).find('ul').each(function(i){ // loop through each nested ul
			a = $($(this).closest('li').find('a').get(0)).attr("href"); // gets the top link in the nav: http://www.humanservices.gov.au/corporate/media/index
			//a = $(this).children('a').attr('href');  // gets the top link in the nav: http://www.humanservices.gov.au/corporate/media/index
			a = a.replace(window.location.protocol + "//" + window.location.hostname, ""); // remove host info: /corporate/media/index
			a = a.split("/")[2]; // get second directory/item: media
			if (c === a){
				$(this).show(); // show the ul
				$(this).addClass("expanded-nav");
				$(this).prev().addClass("selected-nav");
			}
		});
	});
	
	
	/* Share links */

	$(".delicious").attr("href", "http://del.icio.us/post?url=" + $.URLEncode(document.URL) + "&title=" + $("title").text());
	$(".facebook").attr("href", "http://www.facebook.com/sharer.php?u=" + $.URLEncode(document.URL) + "&t=" + $("title").text());
	$(".linkedin").attr("href", "http://www.linkedin.com/shareArticle?mini=true&url=" + $.URLEncode(document.URL) + "&title=" + $("title").text() + "&source=" + window.location.hostname);
	$(".stumbleupon").attr("href", "http://www.stumbleupon.com/submit?url=" + $.URLEncode(document.URL) + "&title=" + $("title").text());
	$(".twitter").attr("href", "http://twitter.com/home?status=Is%20currently%20reading%20http%3A%2F%2F" + $.URLEncode(document.URL));
	
	
	/* Orgchart: show\hide */

	$('#orgchart').each(function() {
		$('.showhide').hide();
		$('.toggle').show();
		$('.toggle').toggle(
			  function () {
				$(this).html('-');
				$(this).next().animate( { opacity: "toggle", height: "toggle", marginTop: "toggle", marginBottom: "toggle", paddingTop: "toggle", paddingBottom: "toggle" }, 600);
			  },
			  function () {
				$(this).html('+');
				$(this).next().animate( { opacity: "toggle", height: "toggle", marginTop: "toggle", marginBottom: "toggle", paddingTop: "toggle", paddingBottom: "toggle" }, 600);
			  }
		);
	});
	
	
	/* Page last updated */
	
	if (($('meta[name|="DC.Date.Modified"]').length > 0) && ($('meta[name|="DC.Date.Modified"]').attr('content') !== "--")) {
		
		var date = $('meta[name|="DC.Date.Modified"]').attr('content').split("-"),
			d = new Date(date[0], date[1] -1, date[2]);

		if (isNaN(d.getDay()) === false){
			var weekday = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
			month = ["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
			
			$('#sub-footer ul').append('<li class="page-last-updated"><span>Page last updated: ' + weekday[d.getDay()] + ' ' + d.getDate() + ' ' + month[d.getMonth()] + ' ' + d.getFullYear() + '</span></li>');
			
		}
	}
	
	
	/* Large print */

	$('#footer-utils').prepend('<a id="large-print" href="#">Large print version</a>');
	$('#large-print').bind('click',function(){
		$('body').addClass('largeprint');
		window.print();
		return false;
	});
	
	
	/* Print Links (requires: urlInternal) */
	
	if(/^Explore/.test(document.title) === false){
	
		// Loop through the links in the body of the page and create a print reference section (only visible for print)
		// create a heading, ordered list at the end of the page and hide it
		$('#content').append('<h2 class="printlinks">Link references<\/h2><ol class="printlinks"><\/ol>');
		
		// loop through all of the links that are internal or external without the class of noprint
		$('#content,, .actions').find('a[href]').each(function(){
			
			var that = this; // we can still refer to the link later
			
			// create a full absolute link from the href value
			var expandedLink = "";
			if ($.isUrlInternal($(this).attr('href'))){
				expandedLink = window.location.protocol + "//" + window.location.hostname + "/" + $(this).attr('href').replace(/^\//, "");
			} else if ($.isUrlFragment($(this).attr('href')) || $(this).hasClass('noprint')) {
				// we don't want to do anything with an anchor or 'noprint' link so change the CSS (no underline for print) and skip it
				$(this).addClass("anchor");
				return true;
			} else {
				expandedLink = $(this).attr('href');
			}
			
			// inserts spaces after slashes to make it wrap nicer
			// expandedLink = expandedLink.replace(/\//g,'/<span class="linkspacer"> </span>');
			
			// if the link exists in the list, append the number to the link in a sup[num]
			var existsAlready = false, refCount = 1;
			
			$('ol.printlinks li').each(function(refnum){
				if (!existsAlready){
					if (expandedLink === $(this).text()){
						var ref = refnum + 1;
						$(that).after('<sup class="printonly">[' + ref + ']<\/sup>');
						existsAlready = true;
					}
				}
				refCount++;
			});
			
			// else append it to the list and append that new number to the link in a sup[num]
			if (!existsAlready){
				$('ol.printlinks').append('<li>' + encodeURI(expandedLink).replace(/\//g,'/<span class="linkspacer"> </span>') + '<\/li>');
				$(this).after('<sup class="printonly">[' + refCount + ']<\/sup>');
			}
			
		});
		
		if($('ol.printlinks').find('li').length === 0){
			$('.printlinks').remove();
		}
	}
	
	
	/* table sorting */
	
	$(".sort").tablesorter({widthFixed: true, widgets: ['zebra']}).tablesorterPager({container: $("#pager")});
	$(".foi-sort").tablesorter({widthFixed: true, widgets: ['zebra'], headers: { 0: {sorter:'commonwealthdate-short'}}	}).tablesorterPager({container: $("#pager")});
	
	
	/* search default text validation */
	
	$('input[name=query]').each(function(){
		$(this).closest('form').submit(function(){
			var searchDefaults = ["search","type what you want to find here","Type keywords to search this site","Type what you want to find here",	"",	" "	]; 
			var searchQuery = $(this).find('input[name=query]').val();
			if(searchDefaults.find(searchQuery)){
				alert('Please enter a valid search term and try again.');
				return false;
			}
		});
	});
	
	
	// external and different-internal link tracking
	// requires http://benalman.com/projects/jquery-urlinternal-plugin/ && http://plugins.jquery.com/project/metadata
	
	$('a').live('click', function(e){
		if ($.isUrlExternal($(this).attr('href')) && (typeof(urchinTracker) !== "undefined")) {
			// external links - will not capture links opening in new tabs
			var url = $(this).attr('href');
			urchinTracker('/tracked-events/external-link/' + url.replace(/http[s]*:\/\//, ''));
			if($(this).attr('target') !== '_blank') {
				e.preventDefault();
				setTimeout(function(){ document.location.href = url; }, 500);
			}
		} else if ($.isUrlInternal($(this).attr('href'))) { 
			// internal links
			if($(this).metadata() && $(this).metadata().from && (typeof(urchinTracker) !== "undefined")){
				var url = $(this).attr('href'), link = url;
				if(!/^http/.test(link)){ link = window.location.hostname + link; }
				urchinTracker('/tracked-events/internal-link/' + link.replace(/http[s]*:\/\//, "").replace(/#.*$/, "") + ((/\/$/.test(link)) ? "" : "/") + $(this).metadata().from);
				e.preventDefault();
				setTimeout(function(){ document.location.href = url; }, 500);
			}
		}		
	}); // end a.live external/internal link tracking
	
	// automatically tag some internal links or groups of links with a unique anchor
	var containers2tag = [ { selector: '#footer', tag: 'footer' } ];
	for(var i = 0, j = containers2tag.length; i < j; i++){
		$(containers2tag[i].selector + ' a:urlInternal').each(function(){
			$(this).addClass('{from: \'' + containers2tag[i].tag + '\'}');
		});
	}
	
}); // end the only document ready allowed in this document


/* Google Analytics */
 
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-2785808-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


/* PLUG INS */

/**
 * Function : dump()
 * Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
 */
 function dump(arr,level) {
	var dumped_text = "";
	if(!level) level = 0;
	
	//The padding given at the beginning of the line.
	var level_padding = "";
	for(var j=0;j<level+1;j++) level_padding += "    ";
	
	if(typeof(arr) == 'object') { //Array/Hashes/Objects 
		for(var item in arr) {
			var value = arr[item];
			
			if(typeof(value) == 'object') { //If it is an array,
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value,level+1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { //Stings/Chars/Numbers etc.
		dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
	}
	return dumped_text;
}   


/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);


/*
 * urlInternal - v1.0 - 10/7/2009
 * http://benalman.com/projects/jquery-urlinternal-plugin/
 * 
 * Copyright (c) 2009 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($){var g,i=!0,r=!1,m=window.location,h=Array.prototype.slice,b=m.href.match(/^((https?:\/\/.*?\/)?[^#]*)#?.*$/),u=b[1]+"#",t=b[2],e,l,f,q,c,j,x="elemUrlAttr",k="href",y="src",p="urlInternal",d="urlExternal",n="urlFragment",a,s={};function w(A){var z=h.call(arguments,1);return function(){return A.apply(this,z.concat(h.call(arguments)))}}$.isUrlInternal=q=function(z){if(!z||j(z)){return g}if(a.test(z)){return i}if(/^(?:https?:)?\/\//i.test(z)){return r}if(/^[a-z\d.-]+:/i.test(z)){return g}return i};$.isUrlExternal=c=function(z){var A=q(z);return typeof A==="boolean"?!A:A};$.isUrlFragment=j=function(z){var A=(z||"").match(/^([^#]?)([^#]*#).*$/);return !!A&&(A[2]==="#"||z.indexOf(u)===0||(A[1]==="/"?t+A[2]===u:!/^https?:\/\//i.test(z)&&$('<a href="'+z+'"/>')[0].href.indexOf(u)===0))};function v(A,z){return this.filter(":"+A+(z?"("+z+")":""))}$.fn[p]=w(v,p);$.fn[d]=w(v,d);$.fn[n]=w(v,n);function o(D,C,B,A){var z=A[3]||e()[(C.nodeName||"").toLowerCase()]||"";return z?!!D(C.getAttribute(z)):r}$.expr[":"][p]=w(o,q);$.expr[":"][d]=w(o,c);$.expr[":"][n]=w(o,j);$[x]||($[x]=function(z){return $.extend(s,z)})({a:k,base:k,iframe:y,img:y,input:y,form:"action",link:k,script:y});e=$[x];$.urlInternalHost=l=function(B){B=B?"(?:(?:"+Array.prototype.join.call(arguments,"|")+")\\.)?":"";var A=new RegExp("^"+B+"(.*)","i"),z="^(?:"+m.protocol+")?//"+m.hostname.replace(A,B+"$1").replace(/\\?\./g,"\\.")+(m.port?":"+m.port:"")+"/";return f(z)};$.urlInternalRegExp=f=function(z){if(z){a=typeof z==="string"?new RegExp(z,"i"):z}return a};l("www")})(jQuery);
 
$.extend({URLEncode:function(c){var o='';var x=0;c=c.toString();var r=/(^[a-zA-Z0-9_.]*)/;
  while(x<c.length){var m=r.exec(c.substr(x));
    if(m!=null && m.length>1 && m[1]!=''){o+=m[1];x+=m[1].length;
    }else{if(c[x]==' ')o+='+';else{var d=c.charCodeAt(x);var h=d.toString(16);
    o+='%'+(h.length<2?'0':'')+h.toUpperCase();}x++;}}return o;},
URLDecode:function(s){var o=s;var binVal,t;var r=/(%[^%]{2})/;
  while((m=r.exec(o))!=null && m.length>1 && m[1]!=''){b=parseInt(m[1].substr(1),16);
  t=String.fromCharCode(b);o=o.replace(m[1],t);}return o;}
});


/*
 * TableSorter 2.0 - Client-side table sorting with ease!
 * Version 2.0.5b
 * @requires jQuery v1.2.3
 * 
 * Copyright (c) 2007 Christian Bach
 * Examples and docs at: http://tablesorter.com
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($){$.extend({tablesorter:new
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',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="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(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,rows,-1,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,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}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=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}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++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][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;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}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 checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;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"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}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=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;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+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);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);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;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(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).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){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};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.toLocaleLowerCase());},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(/[£$€]/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();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
			

$.tablesorter.addParser({ 
	id: 'commonwealthdate', 
	is: function(s) { return false; }, 
	format: function(s) { 
		// Example: 1 August 2011
		var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
		var t = s.split(" ");
		var u = t[2] + "" + months.indexOf(t[1]) + "" + t[0];
		return Number(u);
	}, 
	type: 'numeric' 
});

$.tablesorter.addParser({ 
	id: 'commonwealthdate-short', 
	is: function(s) { return false; }, 
	format: function(s) { 
		// Example: 1 August 2011
		var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
		var t = s.split(" ");
		var u = t[2] + "" + months.indexOf(t[1]) + "" + t[0];
		return Number(u);
	}, 
	type: 'numeric' 
}); 
 
$.tablesorter.addParser({ 
	id: 'commonwealthdate-ldF', 
	is: function(s) {  return false; }, 
	format: function(s) { 
		// Example: Monday 14 March
		var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
		var t = s.split(" ");
		var u = months.indexOf(t[1]) + "" + t[1];;
		return Number(u);
	}, 
	type: 'numeric' 
}); 

$.tablesorter.addParser({ 
	id: 'commonwealthdate-ldFY', 
	is: function(s) { return false; }, 
	format: function(s) { 
		// Example: Monday 14 March 2011
		var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
		var t = s.split(" ");
		var u = t[3] + "" + months.indexOf(t[2]) + "" + t[1];;
		return Number(u);
	}, 
	type: 'numeric' 
});

$.tablesorter.addParser({ 
	id: 'dhs-time', 
	is: function(s) { return false; }, 
	format: function(s) { 
		// Example: 9:30 am  || 10 pm
		if(s.match(/noon/)){ s = "12:00"; } else if (s.match(/midnight/)) { s = "00:00"; }
		if (!s.match(/:/)){
			// 10 pm to 10:00 pm
			amORpm = (s.match(/am$/)) ? "am" : "pm";
			s = s.replace(" " + amORpm, "") + ":00 " + amORpm;
		}
		return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
	}, 
	type: 'numeric' 
});


/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);


/* Table sorter pager */
(function($){$.extend({tablesorterPager:new function(){function updatePageDisplay(c){var s=$(c.cssPageDisplay,c.container).val((c.page+1)+c.seperator+c.totalPages);}
function setPageSize(table,size){var c=table.config;c.size=size;c.totalPages=Math.ceil(c.totalRows/c.size);c.pagerPositionSet=false;moveToPage(table);fixPosition(table);}
function fixPosition(table){var c=table.config;if(!c.pagerPositionSet&&c.positionFixed){var c=table.config,o=$(table); //if(o.offset){c.container.css({top:o.offset().top+o.height()+'px',position:'absolute'});}
c.pagerPositionSet=true;}}
function moveToFirstPage(table){var c=table.config;c.page=0;moveToPage(table);}
function moveToLastPage(table){var c=table.config;c.page=(c.totalPages-1);moveToPage(table);}
function moveToNextPage(table){var c=table.config;c.page++;if(c.page>=(c.totalPages-1)){c.page=(c.totalPages-1);}
moveToPage(table);}
function moveToPrevPage(table){var c=table.config;c.page--;if(c.page<=0){c.page=0;}
moveToPage(table);}
function moveToPage(table){var c=table.config;if(c.page<0||c.page>(c.totalPages-1)){c.page=0;}
renderTable(table,c.rowsCopy);}
function renderTable(table,rows){var c=table.config;var l=rows.length;var s=(c.page*c.size);var e=(s+c.size);if(e>rows.length){e=rows.length;}
var tableBody=$(table.tBodies[0]);$.tablesorter.clearTableBody(table);for(var i=s;i<e;i++){var o=rows[i];var l=o.length;for(var j=0;j<l;j++){tableBody[0].appendChild(o[j]);}}
fixPosition(table,tableBody);$(table).trigger("applyWidgets");if(c.page>=c.totalPages){moveToLastPage(table);}
updatePageDisplay(c);}
this.appender=function(table,rows){var c=table.config;c.rowsCopy=rows;c.totalRows=rows.length;c.totalPages=Math.ceil(c.totalRows/c.size);renderTable(table,rows);};this.defaults={size:10,offset:0,page:0,totalRows:0,totalPages:0,container:null,cssNext:'.next',cssPrev:'.prev',cssFirst:'.first',cssLast:'.last',cssPageDisplay:'.pagedisplay',cssPageSize:'.pagesize',seperator:"/",positionFixed:true,appender:this.appender};this.construct=function(settings){return this.each(function(){config=$.extend(this.config,$.tablesorterPager.defaults,settings);var table=this,pager=config.container;$(this).trigger("appendCache");config.size=parseInt($(".pagesize",pager).val());$(config.cssFirst,pager).click(function(){moveToFirstPage(table);return false;});$(config.cssNext,pager).click(function(){moveToNextPage(table);return false;});$(config.cssPrev,pager).click(function(){moveToPrevPage(table);return false;});$(config.cssLast,pager).click(function(){moveToLastPage(table);return false;});$(config.cssPageSize,pager).change(function(){setPageSize(table,parseInt($(this).val()));return false;});});};}});$.fn.extend({tablesorterPager:$.tablesorterPager.construct});})(jQuery);


//This prototype is provided by the Mozilla foundation and
//is distributed under the MIT license.
//http://www.ibiblio.org/pub/Linux/LICENSES/mit.license
if (!Array.prototype.indexOf)
{
  Array.prototype.indexOf = function(elt /*, from*/)
  {
    var len = this.length;

    var from = Number(arguments[1]) || 0;
    from = (from < 0) 
         ? Math.ceil(from)
         : Math.floor(from);
    if (from < 0)
      from += len;

    for (; from < len; from++)
    {
      if (from in this &&
          this[from] === elt)
        return from;
    }
    return -1;
  };
}



// http://www.hunlock.com/blogs/Mastering_Javascript_Arrays
if (!Array.prototype.find){
	Array.prototype.find = function(searchStr) {
	  var returnArray = false;
	  for (var i = 0, j = this.length; i < j; i++) {
		if (typeof(searchStr) == 'function') {
		  if (searchStr.test(this[i])) {
			if (!returnArray) { returnArray = []; }
			returnArray.push(i);
		  }
		} else {
		  if (this[i]===searchStr) {
			if (!returnArray) { returnArray = []; }
			returnArray.push(i);
		  }
		}
	  }
	  return returnArray;
	};
}

/*
 * Metadata - jQuery plugin for parsing metadata from elements
 * Copyright (c) 2006 John Resig, Yehuda Katz, J?örn Zaefferer, Paul McLanahan
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * Revision: $Id: jquery.metadata.js 3640 2007-10-11 18:34:38Z pmclanahan $
 */
  (function($){$.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(a,b){this.defaults.type=a;this.defaults.name=b},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single="metadata";var data=$.data(elem,settings.single);if(data)return data;data="{}";var getData=function(data){if(typeof data!="string")return data;if(data.indexOf("{")<0){data=eval("("+data+")")}};var getObject=function(data){if(typeof data!="string")return data;data=eval("("+data+")");return data};if(settings.type=="html5"){var object={};$(elem.attributes).each(function(){var a=this.nodeName;if(a.match(/^data-/))a=a.replace(/^data-/,"");else return true;object[a]=getObject(this.nodeValue)})}else{if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1]}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML)}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr}object=getObject(data.indexOf("{")<0?"{"+data+"}":data)}$.data(elem,settings.single,object);return object}}});$.fn.metadata=function(a){return $.metadata.get(this[0],a)}})(jQuery)
