var ts_version = "1.30";
var ts_browser_agt = navigator.userAgent.toLowerCase();
var ts_browser_is_ie = ((ts_browser_agt.indexOf("msie") != -1) && (ts_browser_agt.indexOf("opera") == -1));
var ml_tsort = {sort_col_title:"Click here to Sort!", sort_col_asc_title:"Sorted in ascending order", sort_col_desc_title:"Sorted in descending order", sort_col_class:"abc", sort_col_style:"text-decoration:none; font-weight:bold; color:white", sort_col_class_post_sort:"def", sort_col_style_post_sort:"text-decoration:none; font-weight:bold; color:white", sort_col_mouseover:"this.style.color='blue'", use_ctrl_alt_click:true, sort_only_sortable:true, minimum_sort_row:4, no_sort_above_click:false, default_sort_asc:true, forcesort_msg:"This column can only be sorted in one way!", nosort_title:"No sorting on this column!", cookie_days:0, default_date_style:"us", table_head_row:0, table_nohead_row:1, skiprows:1, table_content_might_change:false, preserve_style:"", tell_me_time_consumption:false, smallest_int:-2147483648000, cookie_table_idx:0, get_doc_name:function () {
	var _1 = /.+\/(.+)\??/;
	var _2 = _1.exec(window.location.href);
	if (_2) {
		return _2[1].replace(/[^A-Za-z0-9]+/g, "");
	}
}, set_vars:function (_3) {
	var e = (_3) ? _3 : window.event;
	var _5 = (_3) ? ((_3.target) ? _3.target : _3.srcElement) : window.event.srcElement;
	ml_tsort.clicked_td = ml_tsort.getParent(_5, "TD") || ml_tsort.getParent(_5, "TH");
	ml_tsort.clicked_table = ml_tsort.getParent(_5, "TABLE");
	if (!ml_tsort.clicked_table || ml_tsort.clicked_table.rows.length < 1 || !ml_tsort.clicked_td) {
		return;
	}
	var _6 = ml_tsort.clicked_table.rows[0].cells[ml_tsort.clicked_td.cellIndex];
	if (e.ctrlKey && e.altKey && ml_tsort.use_ctrl_alt_click) {
		ml_tsort.resortTable(_6);
	}
}, set_skiprows:function (td) {
	ml_tsort.clicked_tr = ml_tsort.getParent(td, "TR");
	ml_tsort.clicked_table = ml_tsort.getParent(td, "TABLE");
	if (ml_tsort.clicked_tr) {
		if (ml_tsort.no_sort_above_click) {
			ml_tsort.skiprows = 0;
			if (ml_tsort.clicked_table && ml_tsort.clicked_table.rows.length >= ml_tsort.minimum_sort_row) {
				for (var j = 0; j < ml_tsort.clicked_table.rows.length; j++) {
					if (ml_tsort.clicked_table.rows[j] == ml_tsort.clicked_tr) {
						break;
					}
					if (ml_tsort.clicked_table.rows[j].parentNode.tagName.toLowerCase() == "tbody") {
						ml_tsort.skiprows++;
					}
				}
			}
		} else {
			ml_tsort.skiprows = (ml_tsort.table_has_header(ml_tsort.clicked_table)) ? ml_tsort.table_head_row : ml_tsort.table_nohead_row;
		}
	}
}, makeSortable:function (_9) {
	if (_9.rows && _9.rows.length > 0) {
		var _a = _9.getAttribute("ts_linkrow") || 0;
		var _b = _9.rows[_a];
	}
	if (!_b) {
		return;
	}
	var _c;
	if (this.cookie_days > -1) {
		if (!_9.id) {
			this.cookie_table_idx = this.cookie_table_idx + 1;
			_9.cookieid = this.get_doc_name() + this.cookie_table_idx;
		} else {
			_9.cookieid = this.get_doc_name() + _9.id;
		}
		var _d = this.get_cookie(_9.cookieid);
		if (_d) {
			var _e = _d.split(":");
			_c = _b.cells[_e[0]];
			_c.setAttribute("sortdir", _e[1]);
		}
	}
	for (var i = 0; i < _b.cells.length; i++) {
		var _10 = _b.cells[i];
		if (_10.getAttribute("ts_nosort")) {
			if (this.nosort_title) {
				_10.innerHTML = "<span title=\"" + this.nosort_title + "\">" + _10.innerHTML + "</span>";
			}
		} else {
			var txt = _10.innerHTML;
			if (_10.getAttribute("sortdir")) {
				if (_c) {
					_10.removeAttribute("sortdir");
				} else {
					_c = _10;
				}
			}
			_10.innerHTML = "<a style=\"" + this.sort_col_style + "\" onMouseOver=\"this.oldstyle=this.style.cssText;" + this.sort_col_mouseover + "\" onMouseOut=\"this.style.cssText=this.oldstyle;\" class=\"" + this.sort_col_class + "\" href=\"#\" title=\"" + this.sort_col_title + "\" onclick=\"javascript:ml_tsort.resortTable(this.parentNode);return false\">" + txt + "</a>";
		}
	}
	if (_c) {
		this.resortTable(_c);
	}
}, sortables_init:function () {
	if (!document.getElementsByTagName) {
		return;
	}
	var _12 = document.getElementsByTagName("table");
	for (var ti = 0; ti < _12.length; ti++) {
		thisTbl = _12[ti];
		if (!ml_tsort.sort_only_sortable || thisTbl.className.match(/sortable/i)) {
			ml_tsort.makeSortable(thisTbl);
		}
	}
}, getParent:function (el, _15) {
	if (el == null) {
		return null;
	} else {
		if (el.nodeType == 1 && el.tagName.toLowerCase() == _15.toLowerCase()) {
			return el;
		} else {
			return this.getParent(el.parentNode, _15);
		}
	}
}, getInnerText:function (el) {
	if (typeof el == "string") {
		return el;
	}
	if (typeof el == "undefined") {
		return el;
	}
	if (el.innerText) {
		return el.innerText;
	}
	var str = "";
	var cs = el.childNodes;
	var l = cs.length;
	for (var i = 0; i < l; i++) {
		switch (cs[i].nodeType) {
		  case 1:
			str += this.getInnerText(cs[i]);
			break;
		  case 3:
			str += cs[i].nodeValue;
			break;
		}
	}
	return str;
}, match_date_format:function (_1b, _1c) {
	_1c = _1c.replace(/\//g, "[-,. \\/]");
	this.set_date_array(_1c);
	if (!isNaN(this.convert_date(this.getInnerText(_1b.cells[this.sort_column_index])))) {
		return true;
	}
	return false;
}, get_sortfn:function (_1d, _1e) {
	var _1f = this.sort_caseinsensitive;
	var _20 = this.clicked_table;
	var td = this.clicked_td;
	var _22 = this.sort_column_index;
	if (!_20 || _20.rows.length < ml_tsort.minimum_sort_row || !td) {
		return _1f;
	}
	var _23 = _1e || _20.rows[0].cells[_22].getAttribute("ts_type");
	this.replace_pattern = "";
	var itm;
	for (var _25 = 0, i = 0; i < _20.rows.length; i++) {
		if (_25++ < ml_tsort.skiprows) {
			continue;
		}
		var t = _20.rows[i].parentNode.tagName.toLowerCase();
		if (t == "tbody" && _20.rows[i].cells.length >= _22 + 1) {
			itm = this.getInnerText(_20.rows[i].cells[_22]);
			if (itm.match(/\S/)) {
				break;
			}
		}
	}
	if (i == _20.rows.length) {
		return _1f;
	}
	itm = ml_trim(itm);
	if (!_23 || (!_1e && this.table_content_might_change)) {
		if (this.default_date_style == "euro" && this.match_date_format(_20.rows[i], "D/M/Y")) {
			_1f = this.sort_date;
			_23 = "euro_date";
		} else {
			if (this.match_date_format(_20.rows[i], "M/D/Y")) {
				_1f = this.sort_date;
				_23 = "date";
			} else {
				if (itm.match(/^[???$]/)) {
					_1f = this.sort_currency;
					_23 = "money";
				} else {
					if (itm.match(/^\d{1,3}(\.\d{1,3}){3}$/)) {
						_1f = this.sort_ip;
						_23 = "ip";
					} else {
						if (itm.match(/^[+-]?\s*[0-9]+(?:\.[0-9]+)?(?:\s*[eE]\s*[+-]?\s*\d+)?$/)) {
							_1f = this.sort_numeric;
							_23 = "number";
						}
					}
				}
			}
		}
	} else {
		if (_23 == "string") {
			_1f = this.sort_caseinsensitive;
		} else {
			if (_23 == "date") {
				if (this.match_date_format(_20.rows[i], "M/D/Y")) {
					_1f = this.sort_date;
				} else {
					if (_1d) {
						alert("The data is not standard time stamp and cannot be parsed! The column will be sorted alphabetically instead.");
					}
				}
			} else {
				if (_23 == "euro_date") {
					if (this.match_date_format(_20.rows[i], "D/M/Y")) {
						_1f = this.sort_date;
					} else {
						if (_1d) {
							alert("The data is not standard time stamp and cannot be parsed! The column will be sorted alphabetically instead.");
						}
					}
				} else {
					if (_23 == "year_month_date") {
						if (this.match_date_format(_20.rows[i], "Y/M/D")) {
							_1f = this.sort_date;
						} else {
							if (_1d) {
								alert("The data is not standard time stamp and cannot be parsed! The column will be sorted alphabetically instead.");
							}
						}
					} else {
						if (_23 == "year_date_month") {
							if (this.match_date_format(_20.rows[i], "Y/D/M")) {
								_1f = this.sort_date;
							} else {
								if (_1d) {
									alert("The data is not standard time stamp and cannot be parsed! The column will be sorted alphabetically instead.");
								}
							}
						} else {
							if (_23 == "other_date") {
								this.set_date_array(td.getAttribute("ts_date_format").replace(/\//g, "[-. \\/]"));
								_1f = this.sort_date;
							} else {
								if (_23 == "number") {
									_1f = this.sort_numeric;
								} else {
									if (_23 == "ip") {
										_1f = this.sort_ip;
									} else {
										if (_23 == "money") {
											_1f = this.sort_currency;
										} else {
											if (_23 == "custom") {
												this.custom_code = td.getAttribute("ts_sortfn");
												_1f = this.custom_sortfn;
											} else {
												if (_1d) {
													alert("unsupported sorting type!");
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	}
	_20.rows[0].cells[_22].setAttribute("ts_type", _23);
	return _1f;
}, table_has_header:function (_27) {
	if (_27.tHead && _27.tHead.rows.length > 0) {
		return true;
	}
	return false;
}, resortTable:function (td) {
	if (td == null) {
		return;
	}
	var _29 = td.cellIndex;
	var _2a = this.getParent(td, "TABLE");
	this.sort_column_index = _29;
	if (_2a.rows[0].cells[_29].getAttribute("ts_nosort")) {
		if (this.nosort_title) {
			alert(this.nosort_title);
		}
		return;
	}
	this.clicked_table = _2a;
	if (_2a == null || _2a.rows.length < ml_tsort.minimum_sort_row) {
		return;
	}
	this.set_skiprows(td);
	this.clicked_td = td;
	var _2b = new Array();
	var _2c = 0;
	for (var i = 0, j = 0, rowcount = 0; j < _2a.rows.length; j++) {
		var t = _2a.rows[j].parentNode.tagName.toLowerCase();
		if (t == "tbody") {
			if (rowcount++ < ml_tsort.skiprows) {
				continue;
			} else {
				if (_2a.rows[j].cells.length >= _29 + 1) {
					_2b[i++] = _2a.rows[j];
				}
			}
		} else {
			if (t == "thead") {
				_2c++;
			}
		}
	}
	if (_2b.length == 0) {
		return;
	}
	var _2f = new Date();
	var _30 = _2a.getAttribute("ts_sortcell") || 0;
	_30--;
	var _31 = _2a.getAttribute("ts_skiprows") || -1;
	var _32 = _2a.rows[0].cells[_29].getAttribute("ts_type");
	var _33 = (_2a == this.last_sorted_table && _29 == _30 && (!ml_tsort.no_sort_above_click || ml_tsort.skiprows == _31));
	_2a.setAttribute("ts_skiprows", ml_tsort.skiprows);
	var _34 = td.getAttribute("sortdir");
	var _35;
	if (td.getAttribute("ts_forcesort")) {
		_35 = (td.getAttribute("ts_forcesort") == "desc") ? "asc" : "desc";
	} else {
		_35 = (_33) ? _2a.getAttribute("ts_sortdir") : ((_34 == "desc") ? "asc" : (_34 == "asc") ? "desc" : ((this.default_sort_asc) ? "desc" : "asc"));
	}
	if (!td.getAttribute("ts_forcesort") && !this.table_content_might_change && _33) {
		_2b.reverse();
	} else {
		if (td.getAttribute("ts_forcesort") && !this.table_content_might_change && _33 && td.getAttribute("ts_forcesort") == _2a.getAttribute("ts_sortdir")) {
			if (this.forcesort_msg) {
				alert(this.forcesort_msg);
			}
			return;
		} else {
			var _36 = this.get_sortfn(true);
			_2a.setAttribute("ts_sortcell", _29 + 1);
			_2b.sort(_36);
			if (_35 == "asc") {
				_2b.reverse();
			}
		}
	}
	var _37 = _2a.getAttribute("ts_linkrow") || 0;
	if (_30 > -1 && _2a.rows[_37].cells[_30].firstChild.style) {
		_2a.rows[_37].cells[_30].firstChild.oldstyle = this.sort_col_style;
		_2a.rows[_37].cells[_30].firstChild.style.cssText = this.sort_col_style;
		_2a.rows[_37].cells[_30].firstChild.className = this.sort_col_class;
	}
	if (_2a.rows[_37].cells[_29].firstChild.style) {
		_2a.rows[_37].cells[_29].firstChild.oldstyle = this.sort_col_style_post_sort;
		_2a.rows[_37].cells[_29].firstChild.style.cssText = this.sort_col_style_post_sort;
		_2a.rows[_37].cells[_29].firstChild.className = this.sort_col_class_post_sort;
	}
	if (_35 == "desc") {
		_2a.setAttribute("ts_sortdir", "asc");
	} else {
		_2a.setAttribute("ts_sortdir", "desc");
	}
	if (this.cookie_days > -1) {
		this.set_cookie(_2a.cookieid, _29 + ":" + _2a.getAttribute("ts_sortdir"));
	}
	if (_30 > -1 && _2a.rows[_37].cells[_30].firstChild.tagName) {
		_2a.rows[_37].cells[_30].firstChild.title = this.sort_col_title;
	}
	if (_2a.rows[_37].cells[_29].firstChild.tagName) {
		_2a.rows[_37].cells[_29].firstChild.title = ((_35 == "desc") ? this.sort_col_asc_title : this.sort_col_desc_title);
	}
	this.last_sorted_table = _2a;
	var _38 = new Date();
	var ps = _2a.getAttribute("preserve_style") || this.preserve_style;
	if (ps == "row" && !ts_browser_is_ie) {
		var tmp = new Array(_2b.length);
		for (var i = 0; i < _2b.length; i++) {
			tmp[i] = _2b[i].innerHTML;
		}
		for (var i = 0; i < _2b.length; i++) {
			_2a.rows[i + _2c + ml_tsort.skiprows].innerHTML = tmp[i];
		}
	} else {
		if (ps == "cell" || (ps == "row" && ts_browser_is_ie)) {
			var tmp = new Array(_2b.length);
			for (var i = 0; i < _2b.length; i++) {
				for (var j = 0; j < _2b[i].cells.length; j++) {
					if (!tmp[i]) {
						tmp[i] = new Array(_2b[i].cells.length);
					}
					tmp[i][j] = _2b[i].cells[j].innerHTML;
				}
			}
			for (var i = 0; i < _2b.length; i++) {
				for (var j = 0; j < _2b[i].cells.length; j++) {
					_2a.rows[i + _2c + ml_tsort.skiprows].cells[j].innerHTML = tmp[i][j];
				}
			}
		} else {
			for (var i = 0; i < _2b.length; i++) {
				_2a.tBodies[0].appendChild(_2b[i]);
			}
		}
	}
	var _43 = new Date();
	if (this.tell_me_time_consumption) {
		alert("it took " + this.diff_time(_38, _2f) + " seconds to do sorting!");
		alert("it took " + this.diff_time(_43, _38) + " seconds to do redrawing!");
	}
}, diff_time:function (_44, _45) {
	return (_44.getTime() - _45.getTime()) / 1000;
}, set_date_array:function (f) {
	var tmp = [["D", f.indexOf("D")], ["M", f.indexOf("M")], ["Y", f.indexOf("Y")]];
	tmp.sort(function (a, b) {
		return a[1] - b[1];
	});
	this.date_order_array = new Array(3);
	for (var i = 0; i < 3; i++) {
		this.date_order_array[tmp[i][0]] = "$" + (i + 2);
	}
	this.replace_pattern = f.replace(/[DMY]([^DMY]+)[DMY]([^DMY]+)[DMY]/, "^(.*?)(\\d+)$1(\\d+)$2(\\d+)(.*)$");
}, process_year:function (y) {
	var tmp = parseInt(y);
	if (tmp < 32) {
		return "20" + y;
	} else {
		if (tmp < 100) {
			return "19" + y;
		} else {
			return y;
		}
	}
}, convert_date:function (a) {
	var re = "RegExp.$1+RegExp." + this.date_order_array["M"] + "+'/'+RegExp." + this.date_order_array["D"] + "+'/'+this.process_year(RegExp." + this.date_order_array["Y"] + ")+RegExp.$5";
	var _4f = "if(a.match(/" + this.replace_pattern + "/)) (" + re + "); else a;";
	return Date.parse(eval(_4f));
}, sort_date:function (a, b) {
	var _52 = ml_tsort.getInnerText(a.cells[ml_tsort.sort_column_index]);
	var _53 = ml_tsort.getInnerText(b.cells[ml_tsort.sort_column_index]);
	var aa, bb;
	if (_52 && _52.match(/\S/)) {
		aa = ml_tsort.convert_date(_52);
		if (isNaN(aa)) {
			aa = Date.parse(_52);
		}
		if (isNaN(aa)) {
			aa = 0;
		}
	} else {
		aa = ml_tsort.smallest_int;
	}
	if (_53 && _53.match(/\S/)) {
		bb = ml_tsort.convert_date(_53);
		if (isNaN(bb)) {
			bb = Date.parse(_53);
		}
		if (isNaN(bb)) {
			bb = 0;
		}
	} else {
		bb = ml_tsort.smallest_int;
	}
	return aa - bb;
}, sort_currency:function (a, b) {
	return ml_tsort.sort_num(ml_tsort.getInnerText(a.cells[ml_tsort.sort_column_index]).replace(/[^-0-9.+]/g, ""), ml_tsort.getInnerText(b.cells[ml_tsort.sort_column_index]).replace(/[^-0-9.+]/g, ""));
}, sort_num:function (a, b) {
	var aa, bb;
	if (a && a.match(/\S/)) {
		if (!isNaN(a)) {
			aa = a;
		} else {
			if (a && a.match(/^[^0-9.+-]*([+-]?\s*[0-9]+(?:\.[0-9]+)?(?:\s*[eE]\s*[+-]?\s*\d+)?)/)) {
				aa = parseFloat(RegExp.$1.replace(/\s+/g, ""));
			} else {
				aa = 0;
			}
		}
	} else {
		aa = ml_tsort.smallest_int;
	}
	if (b && b.match(/\S/)) {
		if (!isNaN(b)) {
			bb = b;
		} else {
			if (b && b.match(/^[^0-9.+-]*([+-]?\s*[0-9]+(?:\.[0-9]+)?(?:\s*[eE]\s*[+-]?\s*\d+)?)/)) {
				bb = parseFloat(RegExp.$1.replace(/\s+/g, ""));
			} else {
				bb = 0;
			}
		}
	} else {
		bb = ml_tsort.smallest_int;
	}
	return aa - bb;
}, sort_numeric:function (a, b) {
	return ml_tsort.sort_num(ml_tsort.getInnerText(a.cells[ml_tsort.sort_column_index]), ml_tsort.getInnerText(b.cells[ml_tsort.sort_column_index]));
}, sort_ip:function (a, b) {
	var aa = ml_tsort.getInnerText(a.cells[ml_tsort.sort_column_index]).split(".");
	var bb = ml_tsort.getInnerText(b.cells[ml_tsort.sort_column_index]).split(".");
	return ml_tsort.sort_num(aa[0], bb[0]) || ml_tsort.sort_num(aa[1], bb[1]) || ml_tsort.sort_num(aa[2], bb[2]) || ml_tsort.sort_num(aa[3], bb[3]);
}, sort_caseinsensitive:function (a, b) {
	var aa = ml_tsort.getInnerText(a.cells[ml_tsort.sort_column_index]).toLowerCase();
	var bb = ml_tsort.getInnerText(b.cells[ml_tsort.sort_column_index]).toLowerCase();
	if (aa == bb) {
		return 0;
	}
	if (aa < bb) {
		return -1;
	}
	return 1;
}, custom_sortfn:function (aa, bb) {
	var a = ml_tsort.getInnerText(aa.cells[ml_tsort.sort_column_index]);
	var b = ml_tsort.getInnerText(bb.cells[ml_tsort.sort_column_index]);
	return eval(ml_tsort.custom_code);
}, set_cookie:function (_68, _69) {
	var _6a = new Date();
	var _6b = "";
	if (ml_tsort.cookie_days > 0) {
		_6a.setTime(_6a.getTime() + ml_tsort.cookie_days * 24 * 360000);
		_6b = "; expires=" + _6a.toGMTString();
	}
	document.cookie = _68 + "=" + _69 + _6b;
}, get_cookie:function (_6c) {
	if (document.cookie) {
		var st = document.cookie.indexOf(_6c);
		if (st > -1) {
			st = st + _6c.length + 1;
			var end = document.cookie.indexOf(";", st);
			if (end == -1) {
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(st, end));
		}
	}
}};
function ml_trim(_6f) {
	if (!_6f) {
		return _6f;
	}
	var tmp = _6f.replace(/^\s+/, "");
	return tmp.replace(/\s+$/, "");
}
function ts_addEvent(elm, _72, fn, _74) {
	if (elm.addEventListener) {
		elm.addEventListener(_72, fn, _74);
		return true;
	} else {
		if (elm.attachEvent) {
			var r = elm.attachEvent("on" + _72, fn);
			return r;
		} else {
			alert("Handler could not be removed");
			return false;
		}
	}
}
ts_addEvent(document, "click", ml_tsort.set_vars);
ts_addEvent(window, "load", ml_tsort.sortables_init);


