(function (jQuery) {
	jQuery.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, jQueryheaders) {
				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 (jQuery.metadata && (jQuery(jQueryheaders[i]).metadata() && jQuery(jQueryheaders[i]).metadata().sorter)) {
							p = getParserById(jQuery(jQueryheaders[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(jQuery.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(jQuery(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 = jQuery(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 = jQuery(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 () {
					jQuery(table).trigger("sortEnd");
				},
				0);
			};

			function buildHeaders(table) {
				if (table.config.debug) {
					var time = new Date();
				}
				var meta = (jQuery.metadata) ? true : false,
				tableHeadersRows = [];
				for (var i = 0; i < table.tHead.rows.length; i++) {
					tableHeadersRows[i] = 0;
				};
				jQuerytableHeaders = jQuery("thead th", table);
				jQuerytableHeaders.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) {
						jQuery(this).addClass(table.config.cssHeader);
					}
					table.config.headerList[index] = this;
				});
				if (table.config.debug) {
					benchmark("Built headers:", time);
					log(jQuerytableHeaders);
				}
				return jQuerytableHeaders;
			};

			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 ((jQuery.metadata) && (jQuery(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, jQueryheaders, list, css) {
				jQueryheaders.removeClass(css[0]).removeClass(css[1]);
				var h = [];
				jQueryheaders.each(function (offset) {
					if (!this.sortDisabled) {
						h[this.column] = jQuery(this);
					}
				});
				var l = list.length;
				for (var i = 0; i < l; i++) {
					h[list[i][0]].addClass(css[list[i][1]]);
				}
			}

			function fixColumnWidth(table, jQueryheaders) {
				var c = table.config;
				if (c.widthFixed) {
					var colgroup = jQuery('<colgroup>');
					jQuery("tr:first td", table.tBodies[0]).each(function () {
						colgroup.append(jQuery('<col>').css('width', jQuery(this).width()));
					});
					jQuery(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 jQuerythis, jQuerydocument, jQueryheaders, cache, config, shiftDown = 0,
						sortOrder;
					this.config = {};
					config = jQuery.extend(this.config, jQuery.tablesorter.defaults, settings);
					jQuerythis = jQuery(this);
					jQueryheaders = buildHeaders(this);
					this.config.parsers = buildParserCache(this, jQueryheaders);
					cache = buildCache(this);
					var sortCSS = [config.cssDesc, config.cssAsc];
					fixColumnWidth(this);
					jQueryheaders.click(function (e) {
						jQuerythis.trigger("sortStart");
						var totalRows = (jQuerythis[0].tBodies[0] && jQuerythis[0].tBodies[0].rows.length) || 0;
						if (!this.sortDisabled && totalRows > 0) {
							var jQuerycell = jQuery(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(jQuerythis[0], jQueryheaders, config.sortList, sortCSS);
								appendToTable(jQuerythis[0], multisort(jQuerythis[0], config.sortList, cache));
							},
							1);
							return false;
						}
					}).mousedown(function () {
						if (config.cancelSelection) {
							this.onselectstart = function () {
								return false
							};
							return false;
						}
					});
					jQuerythis.bind("update", function () {
						this.config.parsers = buildParserCache(this, jQueryheaders);
						cache = buildCache(this);
					}).bind("sorton", function (e, list) {
						jQuery(this).trigger("sortStart");
						config.sortList = list;
						var sortList = config.sortList;
						updateHeaderSortCount(this, sortList);
						setHeadersCss(this, jQueryheaders, 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 (jQuery.metadata && (jQuery(this).metadata() && jQuery(this).metadata().sortlist)) {
						config.sortList = jQuery(this).metadata().sortlist;
					}
					if (config.sortList.length > 0) {
						jQuerythis.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+)?jQuery)|(^([-+]?[1-9][0-9]*)jQuery)|(^([-+]?((0?|[1-9][0-9]*)' + DECIMAL + '(0*[1-9][0-9]*)))jQuery)|(^[-+]?[1-9]+[0-9]*' + DECIMAL + '0+jQuery)/';
				return RegExp(exp).test(jQuery.trim(s));
			};
			this.clearTableBody = function (table) {
				if (jQuery.browser.msie) {
					function empty() {
						while (this.firstChild) this.removeChild(this.firstChild);
					}
					empty.apply(table.tBodies[0]);
				} else {
					table.tBodies[0].innerHTML = "";
				}
			};
		}
	});
	jQuery.fn.extend({
		tablesorter: jQuery.tablesorter.construct
	});
	var ts = jQuery.tablesorter;
	ts.addParser({
		id: "text",
		is: function (s) {
			return true;
		},
		format: function (s) {
			return jQuery.trim(s.toLowerCase());
		},
		type: "text"
	});
	ts.addParser({
		id: "digit",
		is: function (s, table) {
			var c = table.config;
			return jQuery.tablesorter.isDigit(s, c);
		},
		format: function (s) {
			return jQuery.tablesorter.formatFloat(s);
		},
		type: "numeric"
	});
	ts.addParser({
		id: "currency",
		is: function (s) {
			return /^[?jQuery€?.]/.test(s);
		},
		format: function (s) {
			return jQuery.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}jQuery/.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 jQuery.tablesorter.formatFloat(r);
		},
		type: "numeric"
	});
	ts.addParser({
		id: "url",
		is: function (s) {
			return /^(https?|ftp|file):\/\/jQuery/.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}jQuery/.test(s);
		},
		format: function (s) {
			return jQuery.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0");
		},
		type: "numeric"
	});
	ts.addParser({
		id: "percent",
		is: function (s) {
			return /\%jQuery/.test(jQuery.trim(s));
		},
		format: function (s) {
			return jQuery.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)))jQuery/));
		},
		format: function (s) {
			return jQuery.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})/, "jQuery3/jQuery1/jQuery2");
			} else if (c.dateFormat == "uk") {
				s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "jQuery3/jQuery2/jQuery1");
			} else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
				s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "jQuery1/jQuery2/jQuery3");
			}
			return jQuery.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)))jQuery/.test(s);
		},
		format: function (s) {
			return jQuery.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 jQuery(cell).metadata()[p];
		},
		type: "numeric"
	});
	ts.addWidget({
		id: "zebra",
		format: function (table) {
			if (table.config.debug) {
				var time = new Date();
			}
			jQuery("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) {
				jQuery.tablesorter.benchmark("Applying Zebra widget", time);
			}
		}
	});
})(jQuery);
if (typeof jQuery == 'undefined') {
	throw 'Unable to load Shadowbox, jQuery library not found';
}
var Shadowbox = {};
Shadowbox.lib = {
	adapter: 'jquery',
	getStyle: function (el, style) {
		return jQuery(el).css(style);
	},
	setStyle: function (el, style, value) {
		if (typeof style != 'object') {
			var temp = {};
			temp[style] = value;
			style = temp;
		}
		jQuery(el).css(style);
	},
	get: function (el) {
		return (typeof el == 'string') ? document.getElementById(el) : el;
	},
	remove: function (el) {
		jQuery(el).remove();
	},
	getTarget: function (e) {
		return e.target;
	},
	getPageXY: function (e) {
		return [e.pageX, e.pageY];
	},
	preventDefault: function (e) {
		e.preventDefault();
	},
	keyCode: function (e) {
		return e.keyCode;
	},
	addEvent: function (el, name, handler) {
		jQuery(el).bind(name, handler);
	},
	removeEvent: function (el, name, handler) {
		jQuery(el).unbind(name, handler);
	},
	append: function (el, html) {
		jQuery(el).append(html);
	}
};
(function (jQuery) {
	jQuery.fn.shadowbox = function (options) {
		return this.each(function () {
			var jQuerythis = jQuery(this);
			var opts = jQuery.extend({},
			options || {},
			jQuery.metadata ? jQuerythis.metadata() : jQuery.meta ? jQuerythis.data() : {});
			var cls = this.className || '';
			opts.width = parseInt((cls.match(/w:(\d+)/) || [])[1]) || opts.width;
			opts.height = parseInt((cls.match(/h:(\d+)/) || [])[1]) || opts.height;
			Shadowbox.setup(jQuerythis, opts);
		});
	};
})(jQuery);
if (typeof Shadowbox == 'undefined') {
	throw 'Unable to load Shadowbox, no base library adapter found';
} (function () {
	var version = '2.0';
	var options = {
		animate: true,
		animateFade: true,
		animSequence: 'wh',
		flvPlayer: 'flvplayer.swf',
		modal: false,
		overlayColor: '#000',
		overlayOpacity: 0.8,
		flashBgColor: '#000000',
		autoplayMovies: true,
		showMovieControls: true,
		slideshowDelay: 0,
		resizeDuration: 0.55,
		fadeDuration: 0.35,
		displayNav: true,
		continuous: false,
		displayCounter: true,
		counterType: 'default',
		counterLimit: 10,
		viewportPadding: 20,
		handleOversize: 'resize',
		handleException: null,
		handleUnsupported: 'link',
		initialHeight: 160,
		initialWidth: 320,
		enableKeys: true,
		onOpen: null,
		onFinish: null,
		onChange: null,
		onClose: null,
		skipSetup: false,
		errors: {
			fla: {
				name: 'Flash',
				url: 'http://www.adobe.com/products/flashplayer/'
			},
			qt: {
				name: 'QuickTime',
				url: 'http://www.apple.com/quicktime/download/'
			},
			wmp: {
				name: 'Windows Media Player',
				url: 'http://www.microsoft.com/windows/windowsmedia/'
			},
			f4m: {
				name: 'Flip4Mac',
				url: 'http://www.flip4mac.com/wmv_download.htm'
			}
		},
		ext: {
			img: ['png', 'jpg', 'jpeg', 'gif', 'bmp'],
			swf: ['swf'],
			flv: ['flv'],
			qt: ['dv', 'mov', 'moov', 'movie', 'mp4'],
			wmp: ['asf', 'wm', 'wmv'],
			qtwmp: ['avi', 'mpg', 'mpeg'],
			iframe: ['asp', 'aspx', 'cgi', 'cfm', 'htm', 'html', 'pl', 'php', 'php3', 'php4', 'php5', 'phtml', 'rb', 'rhtml', 'shtml', 'txt', 'vbs']
		}
	};
	var SB = Shadowbox;
	var SL = SB.lib;
	var default_options;
	var RE = {
		domain: /:\/\/(.*?)[:\/]/,
		inline: /#(.+)jQuery/,
		rel: /^(light|shadow)box/i,
		gallery: /^(light|shadow)box\[(.*?)\]/i,
		unsupported: /^unsupported-(\w+)/,
		param: /\s*([a-z_]*?)\s*=\s*(.+)\s*/,
		empty: /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)jQuery/i
	};
	var cache = [];
	var gallery;
	var current;
	var content;
	var content_id = 'shadowbox_content';
	var dims;
	var initialized = false;
	var activated = false;
	var slide_timer;
	var slide_start;
	var slide_delay = 0;
	var ua = navigator.userAgent.toLowerCase();
	var client = {
		isStrict: document.compatMode == 'CSS1Compat',
		isOpera: ua.indexOf('opera') > -1,
		isIE: ua.indexOf('msie') > -1,
		isIE7: ua.indexOf('msie 7') > -1,
		isSafari: /webkit|khtml/.test(ua),
		isWindows: ua.indexOf('windows') != -1 || ua.indexOf('win32') != -1,
		isMac: ua.indexOf('macintosh') != -1 || ua.indexOf('mac os x') != -1,
		isLinux: ua.indexOf('linux') != -1
	};
	client.isBorderBox = client.isIE && !client.isStrict;
	client.isSafari3 = client.isSafari && !!(document.evaluate);
	client.isGecko = ua.indexOf('gecko') != -1 && !client.isSafari;
	var ltIE7 = client.isIE && !client.isIE7;
	var plugins;
	if (navigator.plugins && navigator.plugins.length) {
		var detectPlugin = function (plugin_name) {
			var detected = false;
			for (var i = 0, len = navigator.plugins.length; i < len; ++i) {
				if (navigator.plugins[i].name.indexOf(plugin_name) > -1) {
					detected = true;
					break;
				}
			}
			return detected;
		};
		var f4m = detectPlugin('Flip4Mac');
		plugins = {
			fla: detectPlugin('Shockwave Flash'),
			qt: detectPlugin('QuickTime'),
			wmp: !f4m && detectPlugin('Windows Media'),
			f4m: f4m
		};
	} else {
		var detectPlugin = function (plugin_name) {
			var detected = false;
			try {
				var axo = new ActiveXObject(plugin_name);
				if (axo) detected = true;
			} catch(e) {}
			return detected;
		};
		plugins = {
			fla: detectPlugin('ShockwaveFlash.ShockwaveFlash'),
			qt: detectPlugin('QuickTime.QuickTime'),
			wmp: detectPlugin('wmplayer.ocx'),
			f4m: false
		};
	}
	var apply = function (o, e) {
		for (var p in e) o[p] = e[p];
		return o;
	};
	var isLink = function (el) {
		return el && typeof el.tagName == 'string' && (el.tagName.toUpperCase() == 'A' || el.tagName.toUpperCase() == 'AREA');
	};
	SL.getViewportHeight = function () {
		var h = window.innerHeight;
		var mode = document.compatMode;
		if ((mode || client.isIE) && !client.isOpera) {
			h = client.isStrict ? document.documentElement.clientHeight : document.body.clientHeight;
		}
		return h;
	};
	SL.getViewportWidth = function () {
		var w = window.innerWidth;
		var mode = document.compatMode;
		if (mode || client.isIE) {
			w = client.isStrict ? document.documentElement.clientWidth : document.body.clientWidth;
		}
		return w;
	};
	SL.createHTML = function (obj) {
		var html = '<' + obj.tag;
		for (var attr in obj) {
			if (attr == 'tag' || attr == 'html' || attr == 'children') continue;
			if (attr == 'cls') {
				html += ' class="' + obj['cls'] + '"';
			} else {
				html += ' ' + attr + '="' + obj[attr] + '"';
			}
		}
		if (RE.empty.test(obj.tag)) {
			html += '/>';
		} else {
			html += '>';
			var cn = obj.children;
			if (cn) {
				for (var i = 0, len = cn.length; i < len; ++i) {
					html += this.createHTML(cn[i]);
				}
			}
			if (obj.html) html += obj.html;
			html += '</' + obj.tag + '>';
		}
		return html;
	};
	var ease = function (x) {
		return 1 + Math.pow(x - 1, 3);
	};
	var animate = function (el, p, to, d, cb) {
		var from = parseFloat(SL.getStyle(el, p));
		if (isNaN(from)) from = 0;
		if (from == to) {
			if (typeof cb == 'function') cb();
			return;
		}
		var delta = to - from;
		var op = p == 'opacity';
		var unit = op ? '' : 'px';
		var fn = function (ease) {
			SL.setStyle(el, p, from + ease * delta + unit);
		};
		if (!options.animate && !op || op && !options.animateFade) {
			fn(1);
			if (typeof cb == 'function') cb();
			return;
		}
		d *= 1000;
		var begin = new Date().getTime();
		var end = begin + d;
		var timer = setInterval(function () {
			var time = new Date().getTime();
			if (time >= end) {
				clearInterval(timer);
				fn(1);
				if (typeof cb == 'function') cb();
			} else {
				fn(ease((time - begin) / d));
			}
		},
		10);
	};
	var clearOpacity = function (el) {
		var s = el.style;
		if (client.isIE) {
			if (typeof s.filter == 'string' && (/alpha/i).test(s.filter)) {
				s.filter = s.filter.replace(/[\w\.]*alpha\(.*?\);?/i, '');
			}
		} else {
			s.opacity = '';
			s['-moz-opacity'] = '';
			s['-khtml-opacity'] = '';
		}
	};
	var getComputedHeight = function (el) {
		var h = Math.max(el.offsetHeight, el.clientHeight);
		if (!h) {
			h = parseInt(SL.getStyle(el, 'height'), 10);
			if (!client.isBorderBox) {
				h += parseInt(SL.getStyle(el, 'padding-top'), 10) + parseInt(SL.getStyle(el, 'padding-bottom'), 10) + parseInt(SL.getStyle(el, 'border-top-width'), 10) + parseInt(SL.getStyle(el, 'border-bottom-width'), 10);
			}
		}
		return h;
	};
	var getPlayer = function (url) {
		var m = url.match(RE.domain);
		var d = m && document.domain == m[1];
		if (url.indexOf('#') > -1 && d) return 'inline';
		var q = url.indexOf('?');
		if (q > -1) url = url.substring(0, q);
		if (RE.img.test(url)) return 'img';
		if (RE.swf.test(url)) return plugins.fla ? 'swf' : 'unsupported-swf';
		if (RE.flv.test(url)) return plugins.fla ? 'flv' : 'unsupported-flv';
		if (RE.qt.test(url)) return plugins.qt ? 'qt' : 'unsupported-qt';
		if (RE.wmp.test(url)) {
			if (plugins.wmp) return 'wmp';
			if (plugins.f4m) return 'qt';
			if (client.isMac) return plugins.qt ? 'unsupported-f4m' : 'unsupported-qtf4m';
			return 'unsupported-wmp';
		} else if (RE.qtwmp.test(url)) {
			if (plugins.qt) return 'qt';
			if (plugins.wmp) return 'wmp';
			return client.isMac ? 'unsupported-qt' : 'unsupported-qtwmp';
		} else if (!d || RE.iframe.test(url)) {
			return 'iframe';
		}
		return 'unsupported';
	};
	var handleClick = function (ev) {
		var link;
		if (isLink(this)) {
			link = this;
		} else {
			link = SL.getTarget(ev);
			while (!isLink(link) && link.parentNode) {
				link = link.parentNode;
			}
		}
		if (link) {
			SB.open(link);
			if (gallery.length) SL.preventDefault(ev);
		}
	};
	var toggleNav = function (id, on) {
		var el = SL.get('shadowbox_nav_' + id);
		if (el) el.style.display = on ? '' : 'none';
	};
	var buildBars = function (cb) {
		var obj = gallery[current];
		var title_i = SL.get('shadowbox_title_inner');
		title_i.innerHTML = obj.title || '';
		var nav = SL.get('shadowbox_nav');
		if (nav) {
			var c, n, pl, pa, p;
			if (options.displayNav) {
				c = true;
				var len = gallery.length;
				if (len > 1) {
					if (options.continuous) {
						n = p = true;
					} else {
						n = (len - 1) > current;
						p = current > 0;
					}
				}
				if (options.slideshowDelay > 0 && hasNext()) {
					pa = slide_timer != 'paused';
					pl = !pa;
				}
			} else {
				c = n = pl = pa = p = false;
			}
			toggleNav('close', c);
			toggleNav('next', n);
			toggleNav('play', pl);
			toggleNav('pause', pa);
			toggleNav('previous', p);
		}
		var counter = SL.get('shadowbox_counter');
		if (counter) {
			var co = '';
			if (options.displayCounter && gallery.length > 1) {
				if (options.counterType == 'skip') {
					var i = 0,
						len = gallery.length,
						end = len;
					var limit = parseInt(options.counterLimit);
					if (limit < len) {
						var h = Math.round(limit / 2);
						i = current - h;
						if (i < 0) i += len;
						end = current + (limit - h);
						if (end > len) end -= len;
					}
					while (i != end) {
						if (i == len) i = 0;
						co += '<a onclick="Shadowbox.change(' + i + ');"';
						if (i == current) co += ' class="shadowbox_counter_current"';
						co += '>' + (++i) + '</a>';
					}
				} else {
					co = (current + 1) + ' ' + SB.LANG.of + ' ' + len;
				}
			}
			counter.innerHTML = co;
		}
		cb();
	};
	var hideBars = function (anim, cb) {
		var obj = gallery[current];
		var title = SL.get('shadowbox_title');
		var info = SL.get('shadowbox_info');
		var close = SL.get('shadowbox_nav_close');
		var meta = SL.get('shadowbox_meta');
		var title_i = SL.get('shadowbox_title_inner');
		var info_i = SL.get('shadowbox_info_inner');
		var fn = function () {
			buildBars(cb);
		};
		var title_h = getComputedHeight(title);
		var info_h = getComputedHeight(info) * -1;
		var close_h = getComputedHeight(close);
		close_h = (isNaN(close_h)) ? 16 : close_h;
		var meta_h = getComputedHeight(meta);
		meta_h = (isNaN(meta_h)) ? 16 : meta_h;
		info_h = (isNaN(info_h)) ? 58 : info_h;
		if (anim) {
			animate(info_i, 'margin-top', info_h + close_h + meta_h, 0.35, fn);
		} else {
			SL.setStyle(info_i, 'margin-top', (info_h + close_h + meta_h) + 'px');
			fn();
		}
	};
	var showBars = function (cb) {
		var title_i = SL.get('shadowbox_title_inner');
		var info_i = SL.get('shadowbox_info_inner');
		var t = title_i.innerHTML != '';
		if (t) animate(title_i, 'margin-top', 0, 0.35);
		animate(info_i, 'margin-top', 0, 0.35, cb);
	};
	var loadContent = function () {
		var obj = gallery[current];
		if (!obj) return;
		var changing = false;
		if (content) {
			content.remove();
			changing = true;
		}
		var p = obj.player == 'inline' ? 'html' : obj.player;
		if (typeof SB[p] != 'function') {
			SB.raise('Unknown player ' + obj.player);
		}
		content = new SB[p](content_id, obj);
		listenKeys(false);
		toggleLoading(true);
		hideBars(changing, function () {
			if (!content) return;
			if (!changing) {
				SL.get('shadowbox').style.display = '';
			}
			var fn = function () {
				resizeContent(function () {
					if (!content) return;
					showBars(function () {
						if (!content) return;
						SL.get('shadowbox_body_inner').innerHTML = SL.createHTML(content.markup(dims));
						toggleLoading(false, function () {
							if (!content) return;
							if (typeof content.onLoad == 'function') {
								content.onLoad();
							}
							if (options.onFinish && typeof options.onFinish == 'function') {
								options.onFinish(gallery[current]);
							}
							if (slide_timer != 'paused') {
								SB.play();
							}
							listenKeys(true);
						});
					});
				});
			};
			if (typeof content.ready != 'undefined') {
				var id = setInterval(function () {
					if (content) {
						if (content.ready) {
							clearInterval(id);
							id = null;
							fn();
						}
					} else {
						clearInterval(id);
						id = null;
					}
				},
				100);
			} else {
				fn();
			}
		});
		if (gallery.length > 1) {
			var next = gallery[current + 1] || gallery[0];
			if (next.player == 'img') {
				var a = new Image();
				a.src = next.content;
			}
			var prev = gallery[current - 1] || gallery[gallery.length - 1];
			if (prev.player == 'img') {
				var b = new Image();
				b.src = prev.content;
			}
		}
	};
	var setDimensions = function (height, width, resizable) {
		resizable = resizable || false;
		var sb = SL.get('shadowbox_body'),
			h, w;
		h = height = parseInt(height);
		w = width = parseInt(width);
		var view_h = SL.getViewportHeight();
		var view_w = SL.getViewportWidth();
		var border_w = parseInt(SL.getStyle(sb, 'border-left-width'), 10) + parseInt(SL.getStyle(sb, 'border-right-width'), 10);
		border_w = (isNaN(border_w)) ? 16 : border_w;
		var extra_w = border_w + 2 * options.viewportPadding;
		if (w + extra_w >= view_w) {
			w = view_w - extra_w;
		}
		var border_h = parseInt(SL.getStyle(sb, 'border-top-width'), 10) + parseInt(SL.getStyle(sb, 'border-bottom-width'), 10);
		border_h = (isNaN(border_h)) ? 16 : border_h;
		var bar_h = getComputedHeight(SL.get('shadowbox_title')) + getComputedHeight(SL.get('shadowbox_info')) + getComputedHeight(SL.get('shadowbox_meta')) + getComputedHeight(SL.get('shadowbox_nav_close'));
		var extra_h = border_h + 2 * parseInt(options.viewportPadding) + bar_h;
		if (h + extra_h >= view_h) {
			h = view_h - extra_h;
		}
		var drag = false;
		var resize_h = height;
		var resize_w = width;
		var handle = options.handleOversize;
		if (resizable && (handle == 'resize' || handle == 'drag')) {
			var change_h = (height - h) / height;
			var change_w = (width - w) / width;
			if (handle == 'resize') {
				if (change_h > change_w) {
					w = Math.round((width / height) * h);
				} else if (change_w > change_h) {
					h = Math.round((height / width) * w);
				}
				resize_w = w;
				resize_h = h;
			} else {
				var link = gallery[current];
				if (link) drag = link.player == 'img' && (change_h > 0 || change_w > 0);
			}
		}
		dims = {
			height: h + border_h + bar_h,
			width: w + border_w,
			inner_h: h,
			inner_w: w,
			top: (view_h - (h + extra_h)) / 2 + options.viewportPadding,
			resize_h: resize_h,
			resize_w: resize_w,
			drag: drag
		};
	};
	var resizeContent = function (cb) {
		if (!content) return;
		setDimensions(content.height, content.width, content.resizable);
		if (cb) {
			switch (options.animSequence) {
			case 'hw':
				adjustHeight(dims.inner_h, dims.top, true, function () {
					adjustWidth(dims.width, true, cb);
				});
				break;
			case 'wh':
				adjustWidth(dims.width, true, function () {
					adjustHeight(dims.inner_h, dims.top, true, cb);
				});
				break;
			case 'sync':
			default:
				adjustWidth(dims.width, true);
				adjustHeight(dims.inner_h, dims.top, true, cb);
			}
		} else {
			adjustWidth(dims.width, false);
			adjustHeight(dims.inner_h, dims.top, false);
			var c = SL.get(content_id);
			if (c) {
				if (content.resizable && options.handleOversize == 'resize') {
					c.height = dims.resize_h;
					c.width = dims.resize_w;
				}
				if (gallery[current].player == 'img' && options.handleOversize == 'drag') {
					var top = parseInt(SL.getStyle(c, 'top'));
					if (top + content.height < dims.inner_h) {
						SL.setStyle(c, 'top', dims.inner_h - content.height + 'px');
					}
					var left = parseInt(SL.getStyle(c, 'left'));
					if (left + content.width < dims.inner_w) {
						SL.setStyle(c, 'left', dims.inner_w - content.width + 'px');
					}
				}
			}
		}
	};
	var adjustHeight = function (height, top, anim, cb) {
		height = parseInt(height);
		var sb = SL.get('shadowbox_body');
		if (anim) {
			animate(sb, 'height', height, options.resizeDuration);
		} else {
			SL.setStyle(sb, 'height', height + 'px');
		}
		var s = SL.get('shadowbox');
		if (anim) {
			animate(s, 'top', top, options.resizeDuration, cb);
		} else {
			SL.setStyle(s, 'top', top + 'px');
			if (typeof cb == 'function') cb();
		}
	};
	var adjustWidth = function (width, anim, cb) {
		width = parseInt(width);
		var s = SL.get('shadowbox');
		if (anim) {
			animate(s, 'width', width, options.resizeDuration, cb);
		} else {
			SL.setStyle(s, 'width', width + 'px');
			if (typeof cb == 'function') cb();
		}
	};
	var listenKeys = function (on) {
		if (!options.enableKeys) return;
		SL[(on ? 'add' : 'remove') + 'Event'](document, 'keydown', handleKey);
	};
	var handleKey = function (e) {
		var code = SL.keyCode(e);
		SL.preventDefault(e);
		if (code == 81 || code == 88 || code == 27) {
			SB.close();
		} else if (code == 37 || code == 38) {
			SB.previous();
		} else if (code == 39 || code == 40) {
			SB.next();
		} else if (code == 32) {
			SB[(typeof slide_timer == 'number' ? 'pause' : 'play')]();
		}
	};
	var toggleLoading = function (on, cb) {
		var loading = SL.get('shadowbox_loading');
		if (on) {
			loading.style.display = '';
			if (typeof cb == 'function') cb();
		} else {
			var p = gallery[current].player;
			var anim = (p == 'img' || p == 'html');
			var fn = function () {
				loading.style.display = 'none';
				clearOpacity(loading);
				if (typeof cb == 'function') cb();
			};
			if (anim) {
				animate(loading, 'opacity', 0, options.fadeDuration, fn);
			} else {
				fn();
			}
		}
	};
	var fixTop = function () {
		SL.get('shadowbox_container').style.top = document.documentElement.scrollTop + 'px';
	};
	var fixHeight = function () {
		SL.get('shadowbox_overlay').style.height = SL.getViewportHeight() + 'px';
	};
	var hasNext = function () {
		return gallery.length > 1 && (current != gallery.length - 1 || options.continuous);
	};
	var toggleVisible = function (cb) {
		var els, v = (cb) ? 'hidden' : 'visible';
		var hide = ['select', 'object', 'embed'];
		for (var i = 0; i < hide.length; ++i) {
			els = document.getElementsByTagName(hide[i]);
			for (var j = 0, len = els.length; j < len; ++j) {
				els[j].style.visibility = v;
			}
		}
		var so = SL.get('shadowbox_overlay');
		var sc = SL.get('shadowbox_container');
		var sb = SL.get('shadowbox');
		if (cb) {
			SL.setStyle(so, {
				backgroundColor: options.overlayColor,
				opacity: 0
			});
			if (!options.modal) SL.addEvent(so, 'click', SB.close);
			if (ltIE7) {
				fixTop();
				fixHeight();
				SL.addEvent(window, 'scroll', fixTop);
			}
			sb.style.display = 'none';
			sc.style.visibility = 'visible';
			animate(so, 'opacity', parseFloat(options.overlayOpacity), options.fadeDuration, cb);
		} else {
			SL.removeEvent(so, 'click', SB.close);
			if (ltIE7) SL.removeEvent(window, 'scroll', fixTop);
			sb.style.display = 'none';
			animate(so, 'opacity', 0, options.fadeDuration, function () {
				sc.style.visibility = 'hidden';
				sb.style.display = '';
				clearOpacity(so);
			});
		}
	};
	Shadowbox.init = function (opts) {
		if (initialized) return;
		if (typeof SB.LANG == 'undefined') {
			SB.raise('No Shadowbox language loaded');
			return;
		}
		if (typeof SB.SKIN == 'undefined') {
			SB.raise('No Shadowbox skin loaded');
			return;
		}
		apply(options, opts || {});
		var markup = SB.SKIN.markup.replace(/\{(\w+)\}/g, function (m, p) {
			return SB.LANG[p];
		});
		var bd = document.body || document.documentElement;
		SL.append(bd, markup);
		if (ltIE7) {
			SL.setStyle(SL.get('shadowbox_container'), 'position', 'absolute');
			SL.get('shadowbox_body').style.zoom = 1;
			var png = SB.SKIN.png_fix;
			if (png && png.constructor == Array) {
				for (var i = 0; i < png.length; ++i) {
					var el = SL.get(png[i]);
					if (el) {
						var match = SL.getStyle(el, 'background-image').match(/url\("(.*\.png)"\)/);
						if (match) {
							SL.setStyle(el, {
								backgroundImage: 'none',
								filter: 'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src=' + match[1] + ',sizingMethod=scale);'
							});
						}
					}
				}
			}
		}
		for (var e in options.ext) {
			RE[e] = new RegExp('\.(' + options.ext[e].join('|') + ')\s*jQuery', 'i');
		}
		var id;
		SL.addEvent(window, 'resize', function () {
			if (id) {
				clearTimeout(id);
				id = null;
			}
			id = setTimeout(function () {
				if (ltIE7) fixHeight();
				resizeContent();
			},
			50);
		});
		if (!options.skipSetup) SB.setup();
		initialized = true;
	};
	Shadowbox.loadSkin = function (skin, dir) {
		if (! (/\/jQuery/.test(dir))) dir += '/';
		skin = dir + skin + '/';
		document.write('<link rel="stylesheet" type="text/css" href="' + skin + 'skin.css">');
		document.write('<scr' + 'ipt type="text/javascript" src="' + skin + 'skin.js"><\/script>');
	};
	Shadowbox.loadLanguage = function (lang, dir) {
		if (! (/\/jQuery/.test(dir))) dir += '/';
		document.write('<scr' + 'ipt type="text/javascript" src="' + dir + 'shadowbox-' + lang + '.js"><\/script>');
	};
	Shadowbox.loadPlayer = function (players, dir) {
		if (typeof players == 'string') players = [players];
		if (! (/\/jQuery/.test(dir))) dir += '/';
		for (var i = 0, len = players.length; i < len; ++i) {
			document.write('<scr' + 'ipt type="text/javascript" src="' + dir + 'shadowbox-' + players[i] + '.js"><\/script>');
		}
	};
	Shadowbox.setup = function (links, opts) {
		if (!links) {
			var links = [];
			var a = document.getElementsByTagName('a'),
				rel;
			for (var i = 0, len = a.length; i < len; ++i) {
				rel = a[i].getAttribute('rel');
				if (rel && RE.rel.test(rel)) links[links.length] = a[i];
			}
		} else if (!links.length) {
			links = [links];
		}
		var link;
		for (var i = 0, len = links.length; i < len; ++i) {
			link = links[i];
			if (typeof link.shadowboxCacheKey == 'undefined') {
				link.shadowboxCacheKey = cache.length;
				SL.addEvent(link, 'click', handleClick);
			}
			cache[link.shadowboxCacheKey] = this.buildCacheObj(link, opts);
		}
	};
	Shadowbox.buildCacheObj = function (link, opts) {
		var href = link.href;
		var o = {
			el: link,
			title: link.getAttribute('title'),
			player: getPlayer(href),
			options: apply({},
			opts || {}),
			content: href
		};
		var opt, l_opts = ['player', 'title', 'height', 'width', 'gallery'];
		for (var i = 0, len = l_opts.length; i < len; ++i) {
			opt = l_opts[i];
			if (typeof o.options[opt] != 'undefined') {
				o[opt] = o.options[opt];
				delete o.options[opt];
			}
		}
		var rel = link.getAttribute('rel');
		if (rel) {
			var match = rel.match(RE.gallery);
			if (match) o.gallery = escape(match[2]);
			var params = rel.split(';');
			for (var i = 0, len = params.length; i < len; ++i) {
				match = params[i].match(RE.param);
				if (match) {
					if (match[1] == 'options') {
						eval('apply(o.options, ' + match[2] + ')');
					} else {
						o[match[1]] = match[2];
					}
				}
			}
		}
		return o;
	};
	Shadowbox.applyOptions = function (opts) {
		if (opts) {
			default_options = apply({},
			options);
			options = apply(options, opts);
		}
	};
	Shadowbox.revertOptions = function () {
		if (default_options) {
			options = default_options;
			default_options = null;
		}
	};
	Shadowbox.open = function (obj, opts) {
		this.revertOptions();
		if (isLink(obj)) {
			if (typeof obj.shadowboxCacheKey == 'undefined' || typeof cache[obj.shadowboxCacheKey] == 'undefined') {
				obj = this.buildCacheObj(obj, opts);
			} else {
				obj = cache[obj.shadowboxCacheKey];
			}
		}
		if (obj.constructor == Array) {
			gallery = obj;
			current = 0;
		} else {
			var copy = apply({},
			obj);
			if (!obj.gallery) {
				gallery = [copy];
				current = 0;
			} else {
				current = null;
				gallery = [];
				var ci;
				for (var i = 0, len = cache.length; i < len; ++i) {
					ci = cache[i];
					if (ci.gallery) {
						if (ci.content == obj.content && ci.gallery == obj.gallery && ci.title == obj.title) {
							current = gallery.length;
						}
						if (ci.gallery == obj.gallery) {
							gallery.push(apply({},
							ci));
						}
					}
				}
				if (current == null) {
					gallery.unshift(copy);
					current = 0;
				}
			}
		}
		obj = gallery[current];
		if (obj.options || opts) {
			this.applyOptions(apply(apply({},
			obj.options || {}), opts || {}));
		}
		var match, r;
		for (var i = 0, len = gallery.length; i < len; ++i) {
			r = false;
			if (gallery[i].player == 'unsupported') {
				r = true;
			} else if (match = RE.unsupported.exec(gallery[i].player)) {
				if (options.handleUnsupported == 'link') {
					gallery[i].player = 'html';
					var s, a, oe = options.errors;
					switch (match[1]) {
					case 'qtwmp':
						s = 'either';
						a = [oe.qt.url, oe.qt.name, oe.wmp.url, oe.wmp.name];
						break;
					case 'qtf4m':
						s = 'shared';
						a = [oe.qt.url, oe.qt.name, oe.f4m.url, oe.f4m.name];
						break;
					default:
						s = 'single';
						if (match[1] == 'swf' || match[1] == 'flv') match[1] = 'fla';
						a = [oe[match[1]].url, oe[match[1]].name];
					}
					var msg = SB.LANG.errors[s].replace(/\{(\d+)\}/g, function (m, i) {
						return a[i];
					});
					gallery[i].content = '<div class="shadowbox_message">' + msg + '</div>';
				} else {
					r = true;
				}
			} else if (gallery[i].player == 'inline') {
				var match = RE.inline.exec(gallery[i].content);
				if (match) {
					var el;
					if (el = SL.get(match[1])) {
						gallery[i].content = el.innerHTML;
					} else {
						SB.raise('Cannot find element with id ' + match[1]);
					}
				} else {
					SB.raise('Cannot find element id for inline content');
				}
			}
			if (r) {
				gallery.splice(i, 1);
				if (i < current) {
					--current;
				} else if (i == current) {
					current = i > 0 ? current - 1 : i;
				}--i;
				len = gallery.length;
			}
		}
		if (gallery.length) {
			if (options.onOpen && typeof options.onOpen == 'function') {
				options.onOpen(obj);
			}
			if (!activated) {
				setDimensions(options.initialHeight, options.initialWidth);
				adjustHeight(dims.inner_h, dims.top, false);
				adjustWidth(dims.width, false);
				toggleVisible(loadContent);
			} else {
				loadContent();
			}
			activated = true;
		}
	};
	Shadowbox.change = function (num) {
		if (!gallery) return;
		if (!gallery[num]) {
			if (!options.continuous) {
				return;
			} else {
				num = num < 0 ? (gallery.length - 1) : 0;
			}
		}
		if (typeof slide_timer == 'number') {
			clearTimeout(slide_timer);
			slide_timer = null;
			slide_delay = slide_start = 0;
		}
		current = num;
		if (options.onChange && typeof options.onChange == 'function') {
			options.onChange(gallery[current]);
		}
		loadContent();
	};
	Shadowbox.next = function () {
		this.change(current + 1);
	};
	Shadowbox.previous = function () {
		this.change(current - 1);
	};
	Shadowbox.play = function () {
		if (!hasNext()) return;
		if (!slide_delay) slide_delay = options.slideshowDelay * 1000;
		if (slide_delay) {
			slide_start = new Date().getTime();
			slide_timer = setTimeout(function () {
				slide_delay = slide_start = 0;
				SB.next();
			},
			slide_delay);
			toggleNav('play', false);
			toggleNav('pause', true);
		}
	};
	Shadowbox.pause = function () {
		if (typeof slide_timer == 'number') {
			var time = new Date().getTime();
			slide_delay = Math.max(0, slide_delay - (time - slide_start));
			if (slide_delay) {
				clearTimeout(slide_timer);
				slide_timer = 'paused';
			}
			toggleNav('pause', false);
			toggleNav('play', true);
		}
	};
	Shadowbox.close = function () {
		if (!activated) return;
		listenKeys(false);
		toggleVisible(false);
		if (content) {
			content.remove();
			content = null;
		}
		if (typeof slide_timer == 'number') clearTimeout(slide_timer);
		slide_timer = null;
		slide_delay = 0;
		if (options.onClose && typeof options.onClose == 'function') {
			options.onClose(gallery[current]);
		}
		activated = false;
	};
	Shadowbox.clearCache = function () {
		for (var i = 0, len = cache.length; i < len; ++i) {
			if (cache[i].el) {
				SL.removeEvent(cache[i].el, 'click', handleClick);
				delete cache[i].el.shadowboxCacheKey;
			}
		}
		cache = [];
	};
	Shadowbox.getPlugins = function () {
		return plugins;
	};
	Shadowbox.getOptions = function () {
		return options;
	};
	Shadowbox.getCurrent = function () {
		return gallery[current];
	};
	Shadowbox.getVersion = function () {
		return version;
	};
	Shadowbox.getClient = function () {
		return client;
	};
	Shadowbox.getContent = function () {
		return content;
	};
	Shadowbox.getDimensions = function () {
		return dims;
	};
	Shadowbox.raise = function (e) {
		if (typeof options.handleException == 'function') {
			options.handleException(e);
		} else {
			throw e;
		}
	};
})();
if (typeof Shadowbox == 'undefined') {
	throw 'Unable to load Shadowbox language file, base library not found.';
}
Shadowbox.LANG = {
	code: 'en',
	of: 'of',
	loading: 'loading',
	cancel: 'Cancel',
	next: 'Next',
	previous: 'Previous',
	play: 'Play',
	pause: 'Pause',
	close: 'Close',
	save: 'Save',
	print: 'Print',
	errors: {
		single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',
		shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',
		either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'
	}
};
if (typeof Shadowbox == 'undefined') {
	throw 'Unable to load Shadowbox skin, base library not found.';
}
Shadowbox.SKIN = {
	markup: '<div id="shadowbox_container">' + '<div id="shadowbox_overlay"></div>' + '<div id="shadowbox">' + '<div id="shadowbox_nav_close"><a onclick="Shadowbox.close()" tabindex="0">{close}</a></div>' + '<div id="shadowbox_body">' + '<div id="shadowbox_body_inner"></div>' + '<div id="shadowbox_loading">' + '<div id="shadowbox_loading_indicator"></div>' + '</div>' + '</div>' + '<div id="shadowbox_title">' + '<div id="shadowbox_title_inner"></div>' + '</div>' + '<div id="shadowbox_info">' + '<div id="shadowbox_info_inner">' + '<div id="shadowbox_nav_prevnext" class="clearfix">' + '<p id="shadowbox_nav_previous"><a onclick="Shadowbox.previous()" tabindex="0">{previous}</a></p>' + '<p id="shadowbox_nav_next"><a onclick="Shadowbox.next()" tabindex="0">{next}</a></p>' + '</div>' + '<div id="shadowbox_nav" class="clearfix">' + '<div id="shadowbox_meta">' + '<a id="shadowbox_meta_save" tabindex="0">{save}</a>' + '<a id="shadowbox_meta_print" tabindex="0" class="print">{print}</a>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>'
};
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	Shadowbox.flv = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.resizable = true;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
		if (SB.getOptions().showMovieControls == true) {
			this.height += 20;
		}
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
	};
	Shadowbox.flv.prototype = {
		markup: function (dims) {
			var obj = this.obj;
			var h = dims.resize_h;
			var w = dims.resize_w;
			var options = SB.getOptions();
			var autoplay = String(options.autoplayMovies);
			var controls = options.showMovieControls;
			var showicons = String(controls);
			var displayheight = h - (controls ? 20 : 0);
			var flashvars = ['file=' + this.obj.content, 'height=' + h, 'width=' + w, 'autostart=' + autoplay, 'displayheight=' + displayheight, 'showicons=' + showicons, 'backcolor=0x000000', 'frontcolor=0xCCCCCC', 'lightcolor=0x557722'];
			return {
				tag: 'object',
				id: this.id,
				name: this.id,
				type: 'application/x-shockwave-flash',
				data: options.flvPlayer,
				children: [{
					tag: 'param',
					name: 'movie',
					value: options.flvPlayer
				},
				{
					tag: 'param',
					name: 'flashvars',
					value: flashvars.join('&amp;')
				},
				{
					tag: 'param',
					name: 'allowfullscreen',
					value: 'true'
				}],
				height: h,
				width: w
			};
		},
		remove: function () {
			var el = SL.get(this.id);
			if (el) SL.remove(el);
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	Shadowbox.html = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : 500;
	};
	Shadowbox.html.prototype = {
		markup: function (dims) {
			return {
				tag: 'div',
				id: this.id,
				cls: 'html',
				html: this.obj.content
			};
		},
		remove: function () {
			var el = SL.get(this.id);
			if (el) SL.remove(el);
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	var C = SB.getClient();
	Shadowbox.iframe = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : SL.getViewportHeight();
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : SL.getViewportWidth();
	};
	Shadowbox.iframe.prototype = {
		markup: function (dims) {
			var markup = {
				tag: 'iframe',
				id: this.id,
				name: this.id,
				height: '100%',
				width: '100%',
				frameborder: '0',
				marginwidth: '0',
				marginheight: '0',
				scrolling: 'auto'
			};
			if (C.isIE) {
				markup.allowtransparency = 'true';
				if (!C.isIE7) {
					markup.src = 'javascript:false;document.write("");';
				}
			}
			return markup;
		},
		onLoad: function () {
			var win = (C.isIE) ? SL.get(this.id).contentWindow : window.frames[this.id];
			win.location = this.obj.content;
		},
		remove: function () {
			var el = SL.get(this.id);
			if (el) {
				SL.remove(el);
				if (C.isGecko) delete window.frames[this.id];
			}
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	var C = SB.getClient();
	var drag;
	var draggable;
	var drag_id = 'shadowbox_drag_layer';
	var preloader;
	var resetDrag = function () {
		drag = {
			x: 0,
			y: 0,
			start_x: null,
			start_y: null
		};
	};
	var toggleDrag = function (on, h, w) {
		if (on) {
			resetDrag();
			var styles = ['position:absolute', 'height:' + h + 'px', 'width:' + w + 'px', 'cursor:' + (C.isGecko ? '-moz-grab' : 'move'), 'background-color:' + (C.isIE ? '#fff;filter:alpha(opacity=0)' : 'transparent')];
			SL.append(SL.get('shadowbox_body_inner'), '<div id="' + drag_id + '" style="' + styles.join(';') + '"></div>');
			SL.addEvent(SL.get(drag_id), 'mousedown', listenDrag);
		} else {
			var d = SL.get(drag_id);
			if (d) {
				SL.removeEvent(d, 'mousedown', listenDrag);
				SL.remove(d);
			}
		}
	};
	var listenDrag = function (e) {
		SL.preventDefault(e);
		var coords = SL.getPageXY(e);
		drag.start_x = coords[0];
		drag.start_y = coords[1];
		draggable = SL.get('shadowbox_content');
		SL.addEvent(document, 'mousemove', positionDrag);
		SL.addEvent(document, 'mouseup', unlistenDrag);
		if (C.isGecko) SL.setStyle(SL.get(drag_id), 'cursor', '-moz-grabbing');
	};
	var unlistenDrag = function () {
		SL.removeEvent(document, 'mousemove', positionDrag);
		SL.removeEvent(document, 'mouseup', unlistenDrag);
		if (C.isGecko) SL.setStyle(SL.get(drag_id), 'cursor', '-moz-grab');
	};
	var positionDrag = function (e) {
		var content = SB.getContent();
		var dims = SB.getDimensions();
		var coords = SL.getPageXY(e);
		var move_x = coords[0] - drag.start_x;
		drag.start_x += move_x;
		drag.x = Math.max(Math.min(0, drag.x + move_x), dims.inner_w - content.width);
		SL.setStyle(draggable, 'left', drag.x + 'px');
		var move_y = coords[1] - drag.start_y;
		drag.start_y += move_y;
		drag.y = Math.max(Math.min(0, drag.y + move_y), dims.inner_h - content.height);
		SL.setStyle(draggable, 'top', drag.y + 'px');
	};
	Shadowbox.img = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.resizable = true;
		this.ready = false;
		var self = this;
		preloader = new Image();
		preloader.onload = function () {
			self.height = self.obj.height ? parseInt(self.obj.height, 10) : preloader.height;
			self.width = self.obj.width ? parseInt(self.obj.width, 10) : preloader.width;
			self.ready = true;
			preloader.onload = '';
			preloader = null;
		};
		preloader.src = obj.content;
	};
	Shadowbox.img.prototype = {
		markup: function (dims) {
			return {
				tag: 'img',
				id: this.id,
				height: dims.resize_h,
				width: dims.resize_w,
				src: this.obj.content,
				style: 'position:absolute'
			};
		},
		onLoad: function () {
			var dims = SB.getDimensions();
			if (dims.drag && SB.getOptions().handleOversize == 'drag') {
				toggleDrag(true, dims.resize_h, dims.resize_w);
			}
		},
		remove: function () {
			var el = SL.get(this.id);
			if (el) SL.remove(el);
			toggleDrag(false);
			if (preloader) {
				preloader.onload = '';
				preloader = null;
			}
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	var C = SB.getClient();
	Shadowbox.qt = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
		if (SB.getOptions().showMovieControls == true) {
			this.height += 16;
		}
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
	};
	Shadowbox.qt.prototype = {
		markup: function (dims) {
			var options = SB.getOptions();
			var autoplay = String(options.autoplayMovies);
			var controls = String(options.showMovieControls);
			var markup = {
				tag: 'object',
				id: this.id,
				name: this.id,
				height: this.height,
				width: this.width,
				children: [{
					tag: 'param',
					name: 'src',
					value: this.obj.content
				},
				{
					tag: 'param',
					name: 'scale',
					value: 'aspect'
				},
				{
					tag: 'param',
					name: 'controller',
					value: controls
				},
				{
					tag: 'param',
					name: 'autoplay',
					value: autoplay
				}],
				kioskmode: 'true'
			};
			if (C.isIE) {
				markup.classid = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
				markup.codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
			} else {
				markup.type = 'video/quicktime';
				markup.data = this.obj.content;
			}
			return markup;
		},
		remove: function () {
			try {
				document[this.id].Stop();
			} catch(e) {}
			var el = SL.get(this.id);
			if (el) {
				SL.remove(el);
			}
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	Shadowbox.swf = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.resizable = true;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
	};
	Shadowbox.swf.prototype = {
		markup: function (dims) {
			var bgcolor = SB.getOptions().flashBgColor;
			return {
				tag: 'object',
				id: this.id,
				name: this.id,
				type: 'application/x-shockwave-flash',
				data: this.obj.content,
				children: [{
					tag: 'param',
					name: 'movie',
					value: this.obj.content
				},
				{
					tag: 'param',
					name: 'bgcolor',
					value: bgcolor
				}],
				height: dims.resize_h,
				width: dims.resize_w
			};
		},
		remove: function () {
			var el = SL.get(this.id);
			if (el) SL.remove(el);
		}
	};
})();
(function () {
	var SB = Shadowbox;
	var SL = SB.lib;
	var C = SB.getClient();
	Shadowbox.wmp = function (id, obj) {
		this.id = id;
		this.obj = obj;
		this.height = this.obj.height ? parseInt(this.obj.height, 10) : 300;
		if (SB.getOptions().showMovieControls) {
			this.height += (C.isIE ? 70 : 45);
		}
		this.width = this.obj.width ? parseInt(this.obj.width, 10) : 300;
	};
	Shadowbox.wmp.prototype = {
		markup: function (dims) {
			var options = SB.getOptions();
			var autoplay = options.autoplayMovies ? 1 : 0;
			var markup = {
				tag: 'object',
				id: this.id,
				name: this.id,
				height: this.height,
				width: this.width,
				children: [{
					tag: 'param',
					name: 'autostart',
					value: autoplay
				}]
			};
			if (C.isIE) {
				var controls = options.showMovieControls ? 'full' : 'none';
				markup.classid = 'clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6';
				markup.children[markup.children.length] = {
					tag: 'param',
					name: 'url',
					value: this.obj.content
				};
				markup.children[markup.children.length] = {
					tag: 'param',
					name: 'uimode',
					value: controls
				};
			} else {
				var controls = options.showMovieControls ? 1 : 0;
				markup.type = 'video/x-ms-wmv';
				markup.data = this.obj.content;
				markup.children[markup.children.length] = {
					tag: 'param',
					name: 'showcontrols',
					value: controls
				};
			}
			return markup;
		},
		remove: function () {
			if (C.isIE) {
				try {
					window[this.id].controls.stop();
					window[this.id].URL = 'non-existent.wmv';
					window[this.id] = function () {};
				} catch(e) {}
			}
			var el = SL.get(this.id);
			if (el) {
				setTimeout(function () {
					SL.remove(el);
				},
				10);
			}
		}
	};
})();
var FHG = {
    init: function () {
        FHG.initSlants(jQuery('#vignettes .vignette'));
        FHG.initVignetteHover();
		FHG.carouselInit();
		if (typeof Shadowbox !== 'undefined' && jQuery('ul.image-gallery').length || typeof Shadowbox !== 'undefined') {
			Shadowbox.init({
				onFinish: FHG.shadowboxFinish,
				onClose: FHG.shadowboxClose,
				displayCounter: false,
				autoplayMovies: false,
				continuous: false,
				animate: false,
				flvPlayer: '/includes/assets/mediaplayer/flvplayer.swf'
			});
		}
		FHG.viewShadowboxGallery();
    },
	viewShadowboxGallery: function () {
		jQuery('a.viewGallery').click(function () {
			var firstInGallery = document.getElementById('first-in-gallery');
			Shadowbox.open(firstInGallery);
			return false;
		})
	},
	shadowboxFinish: function (obj) {
		if (jQuery('#searchfilterpopup').length) {
			jQuery('#shadowbox_content div.tablist li').click(FHG.showSearchFilterTab);
			jQuery.each(jQuery('#contentboxes input[type="checkbox"]:checked'), function (a, b) {
				jQuery('#shadowbox_content input[name="' + jQuery(b).attr('name') + '"]').attr('checked', 'checked');
			});
			jQuery('#shadowbox_content input[class="cancel"]').click(Shadowbox.close);
			jQuery('#shadowbox_content input[class="submit"]').click(FHG.applySearchFilter);
			jQuery('#shadowbox_meta').css('display', 'none');
		} else {
			var player = obj['player'];
			if (player == 'img' || player == 'html' || player == 'inline') {
				jQuery('#shadowbox_meta').css('display', 'block');
				if (player == 'img') {
					jQuery('#shadowbox_meta_save').attr('href', obj.content).css('display', 'inline');
				} else {
					jQuery('#shadowbox_meta_save').css('display', 'none');
				}
				if (player == 'html' || player == 'inline' || player == 'img') {
					jQuery('table.sortable-table').tablesorter({
						sortList: [
							[0, 0]]
					});
					if (window.print) {
						jQuery('#shadowbox_meta_print').addClass('active').click(function () {
							window.print();
							return false;
						});
					}
				}
			} else {
				jQuery('#shadowbox_meta_save').attr('href', obj.content).css('display', 'inline');
			}
		}
		jQuery('body').addClass('boxprint');
		FHG.updateBuffer();
	},
	shadowboxClose: function () {
		jQuery('body').removeClass('boxprint');
	},
	carouselInit: function () {
		var o = jQuery('#carousel'),
			iKey;
		if (o.length > 0) {
			(function (jQuery) {
				jQuery.fn.jCarouselLite = function (o) {
					o = jQuery.extend({
						btnPrev: jQuery('#carousel-prev'),
						btnNext: jQuery('#carousel-next'),
						btnGo: null,
						mouseWheel: false,
						auto: null,
						speed: 200,
						easing: null,
						vertical: false,
						circular: false,
						visible: 5,
						start: 0,
						scroll: 1,
						beforeStart: null,
						afterEnd: null
					},
					o || {});
					return this.each(function () {
						var running = false,
							animCss = 'left',
							sizeCss = 'width';
						var div = jQuery('#carousel-wrapper'),
							ul = jQuery('#carousel'),
							tLi = ul.children('li'),
							tl = tLi.size(),
							v = o.visible;
						var li = ul.children('li'),
							itemLength = li.size(),
							curr = o.start;
						div.css('visibility', 'visible');
						FHG.setTabindex(vis());
						var liSize = FHG.width(li);
						var ulSize = liSize * itemLength + 16;
						ul.css(sizeCss, ulSize + 'px').css(animCss, -(curr * liSize));
						if (o.btnPrev) {
							jQuery(o.btnPrev).removeAttr('aria-disabled').attr(FHG.nTabindex(), 0).click(function () {
								return go(curr - o.scroll);
							}).keydown(function (event) {
								if (!event.altKey) {
									if ((iKey = event.keyCode) && (iKey == FHG.key_enter || iKey == FHG.key_left || iKey == FHG.key_up)) {
										return go(curr - o.scroll);
									} else if (iKey == FHG.key_right || iKey == FHG.key_down) {
										return go(curr + o.scroll);
									} else {
										return;
									}
								}
							}).addClass('disabled');
						}
						if (o.btnNext) {
							jQuery(o.btnNext).removeAttr('aria-disabled').attr(FHG.nTabindex(), 0).click(function () {
								return go(curr + o.scroll);
							}).keydown(function (event) {
								if (!event.altKey) {
									if ((iKey = event.keyCode) && (iKey == FHG.key_enter || iKey == FHG.key_right || iKey == FHG.key_down)) {
										return go(curr + o.scroll);
									} else if (iKey == FHG.key_left || iKey == FHG.key_up) {
										return go(curr - o.scroll);
									} else {
										return;
									}
								}
							});
						}

						function vis() {
							return li.slice(curr).slice(0, v);
						}


						function go(to) {
							if (!running) {
								var disabledButton = false;
								jQuery('a.carousel-button').removeClass('disabled');
								if (o.circular) {
									if (to <= o.start - v - 1) {
										ul.css(animCss, -((itemLength - (v * 2)) * liSize) + 'px');
										curr = (to == o.start - v - 1) ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll;
									} else if (to >= itemLength - v + 1) {
										ul.css(animCss, -((v) * liSize) + "px");
										curr = (to == itemLength - v + 1) ? v + 1 : v + o.scroll;
									} else {
										curr = to;
									}
								} else if (to < 0 || to > itemLength - v) {
									disabledButton = (to < 0) ? o.btnPrev : o.btnNext;
									disabledButton.addClass('disabled');
									return;
								} else {
									curr = to;
								}
								running = true;
								ul.animate({
									left: -(curr * liSize)
								},
								o.speed, o.easing, function () {
									FHG.setTabindex(vis());
									FHG.updateBuffer();
									running = false;
								});
							}
							return false;
						}
					});
				};
			})(jQuery);
			o.jCarouselLite();
		}
	},
	nTabindex: function () {
		return (document.body && document.body.tabIndex === 0) ? 'tabIndex' : 'tabindex';
	},    
	setTabindex: function (aElms) {
		jQuery('#carousel a').attr(FHG.nTabindex(), '-1');
		jQuery('a', aElms).removeAttr(FHG.nTabindex());
	},
	updateBuffer: function () {
		jQuery('#bufferUpdater').val(Math.random());
	},
	css: function (elm, prop) {
        return parseInt(jQuery.css(elm[0], prop), 10) || 0;
    },
    width: function (elm) {
        return elm[0].offsetWidth + FHG.css(elm, 'marginLeft') + FHG.css(elm, 'marginRight');
    },
    initSlants: function (obj) {
        obj.each(function (i) {
            var span = jQuery('> span', this);
            var slantedBottom = (jQuery('#nav-second', this).length === 0);
            if (span.length === 0) {
                return false;
            }
            var spanWidth = span.width();
            var spanHeight = span.height();
            var color = span.css('background-color');
            var a = spanWidth;
            var angle = 5;
            var radians = 360 / angle;
            var c = spanWidth / Math.cos(Math.PI * 2 / radians);
            var b = Math.floor(Math.sqrt(Math.pow(c, 2) - Math.pow(a, 2)));
            var bot = (slantedBottom) ? b : 0;
            var canvas = document.createElement('canvas');
            if (canvas.getContext) {
                canvas.width = spanWidth;
                canvas.height = spanHeight;
                var ctx = canvas.getContext('2d');
                ctx.beginPath();
                ctx.fillStyle = color;
                ctx.moveTo(0, 0);
                ctx.lineTo(a, b);
                ctx.lineTo(a, spanHeight - bot);
                ctx.lineTo(0, spanHeight);
                ctx.fill();
                jQuery(span).replaceWith(canvas);
            } else {
                if (!document.namespaces["v"]) {
                    document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
                }
                spanHeight = jQuery(this).height() + 28;
                var vmlShape = document.createElement('v:shape');
                vmlShape.strokecolor = color;
                vmlShape.strokeweight = '1px';
                vmlShape.fillcolor = color;
                vmlShape.coordorigin = '0 0';
                vmlShape.coordsize = spanWidth + ' ' + spanHeight;
                vmlShape.path = 'm 0,0 l ' + a + ',' + b + ',' + a + ',' + (spanHeight - bot) + ',0,' + spanHeight + ' x e';
                var vmlFill = document.createElement('v:fill');
                vmlFill.opacity = (jQuery(this).attr('class').indexOf('top') !== -1) ? '.9' : '.7';
                vmlShape.appendChild(vmlFill);
                jQuery(vmlShape).css('height', spanHeight)
                jQuery(span).replaceWith(vmlShape);
            }
        });
    },
    initVignetteHover: function () {
        jQuery('#vignettes .vignette').hover(FHG.vignetteHover, function () {});
    },
    vignetteHover: function (e) {
        var aSiblings = jQuery(this).siblings();
        jQuery(this).addClass('top').removeClass('bottom');
        aSiblings.addClass('bottom').removeClass('top');
        if (!jQuery(this).find('canvas').length) {
            jQuery(this).find('fill').attr('opacity', '90%');
            aSiblings.find('fill').attr('opacity', '70%');
        }
    }
};
jQuery(document).ready(function() {
 FHG.init();
	initQuickLinks();
	initLinkBoxes();
});
//jQuery(function() {
//	initQuickLinks()
//	initLinkBoxes()
//});
function initQuickLinks() {
	if (jQuery("#quicklinks").length == 0) {
	    jQuery.get("/",
		    function(data) {
		        //jQuery("#duxbury_col1").append(jQuery(data).find("#quicklinks")); /* TOO MUCH FOR IE6 */

		        var quicklinks = data.match("<div id=\"quicklinks\">(\\w|\\W)+?</div>");
		        if (quicklinks.length > 0) {
		            jQuery("#duxbury_col1").append(jQuery(quicklinks[0]));
		        }
		        bindQuickLinks();
		    }
		);
	} else {
		bindQuickLinks();
	}
}
function bindQuickLinks() {
	jQuery("#quicklinks a.slide-control").click(function() {
		jQuery(this).toggleClass("close");
		jQuery("#quicklinks ul.slide-down").slideToggle("fast");
	});
}
function initLinkBoxes() {
	jQuery(".linkbox a.slide-control").click(function() {
		jQuery(this).toggleClass("close");
		jQuery(this).next("ul").slideToggle("fast");
	});
}
