/* 
 * jquery.dimensions
 *
 * Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate$
 * $Rev$
 *
 * Version: @VERSION
 *
 * Requires: jQuery 1.2+
 */
(function(b) { b.dimensions = { version: "@VERSION" }; b.each(["Height", "Width"], function(d, c) { b.fn["inner" + c] = function() { if (!this[0]) { return } var f = c == "Height" ? "Top" : "Left", e = c == "Height" ? "Bottom" : "Right"; return this.is(":visible") ? this[0]["client" + c] : a(this, c.toLowerCase()) + a(this, "padding" + f) + a(this, "padding" + e) }; b.fn["outer" + c] = function(f) { if (!this[0]) { return } var h = c == "Height" ? "Top" : "Left", e = c == "Height" ? "Bottom" : "Right"; f = b.extend({ margin: false }, f || {}); var g = this.is(":visible") ? this[0]["offset" + c] : a(this, c.toLowerCase()) + a(this, "border" + h + "Width") + a(this, "border" + e + "Width") + a(this, "padding" + h) + a(this, "padding" + e); return g + (f.margin ? (a(this, "margin" + h) + a(this, "margin" + e)) : 0) } }); b.each(["Left", "Top"], function(d, c) { b.fn["scroll" + c] = function(e) { if (!this[0]) { return } return e != undefined ? this.each(function() { this == window || this == document ? window.scrollTo(c == "Left" ? e : b(window)["scrollLeft"](), c == "Top" ? e : b(window)["scrollTop"]()) : this["scroll" + c] = e }) : this[0] == window || this[0] == document ? self[(c == "Left" ? "pageXOffset" : "pageYOffset")] || b.boxModel && document.documentElement["scroll" + c] || document.body["scroll" + c] : this[0]["scroll" + c] } }); b.fn.extend({ position: function() { var h = 0, g = 0, f = this[0], i, c, e, d; if (f) { e = this.offsetParent(); i = this.offset(); c = e.offset(); i.top -= a(f, "marginTop"); i.left -= a(f, "marginLeft"); c.top += a(e, "borderTopWidth"); c.left += a(e, "borderLeftWidth"); d = { top: i.top - c.top, left: i.left - c.left} } return d }, offsetParent: function() { var c = this[0].offsetParent; while (c && (!/^body|html$/i.test(c.tagName) && b.css(c, "position") == "static")) { c = c.offsetParent } return b(c) } }); function a(c, d) { return parseInt(b.curCSS(c.jquery ? c[0] : c, d, true)) || 0 } })(jQuery);






/*
 * positionBy 1.0.7 (2008-01-29)
 *
 * Copyright (c) 2006,2007 Jonathan Sharp (http://jdsharp.us)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://jdsharp.us/
 *
 * Built upon jQuery 1.2.2 (http://jquery.com)
 * This also requires the jQuery dimensions plugin
 */
(function($) { var A = function(a, b, c, d) { this.x1 = a; this.x2 = c; this.y1 = b; this.y2 = d }; A.prototype.contains = function(a) { return (this.x1 <= a.x1 && a.x2 <= this.x2) && (this.y1 <= a.y1 && a.y2 <= this.y2) }; A.prototype.transform = function(x, y) { return new A(this.x1 + x, this.y1 + y, this.x2 + x, this.y2 + y) }; $.fn.positionBy = function(q) { var r = new Date(); if (this.length == 0) { return this } var q = $.extend({ target: null, targetPos: null, elementPos: null, x: null, y: null, positions: null, addClass: false, force: false, container: window }, q); if (q.x != null) { var s = q.x; var t = q.y; var u = 0; var v = 0 } else { var w = $($(q.target)[0]); var u = w.outerWidth(); var v = w.outerHeight(); var x = w.offset(); var s = x.left; var t = x.top } var y = s + u; var z = t + v; return this.each(function() { var c = $(this); if (!c.is(':visible')) { c.css({ left: -3000, top: -3000 }).show() } var d = c.outerWidth(); var e = c.outerHeight(); var f = []; var g = []; f[0] = new A(y, t, y + d, t + e); g[0] = [1, 7, 4]; f[1] = new A(y, z - e, y + d, z); g[1] = [0, 6, 4]; f[2] = new A(y, z, y + d, z + e); g[2] = [1, 3, 10]; f[3] = new A(y - d, z, y, z + e); g[3] = [1, 6, 10]; f[4] = new A(s, z, s + d, z + e); g[4] = [1, 6, 9]; f[5] = new A(s - d, z, s, z + e); g[5] = [6, 4, 9]; f[6] = new A(s - d, z - e, s, z); g[6] = [7, 1, 4]; f[7] = new A(s - d, t, s, t + e); g[7] = [6, 0, 4]; f[8] = new A(s - d, t - e, s, t); g[8] = [7, 9, 4]; f[9] = new A(s, t - e, s + d, t); g[9] = [0, 7, 4]; f[10] = new A(y - d, t - e, y, t); g[10] = [0, 7, 3]; f[11] = new A(y, t - e, y + d, t); g[11] = [0, 10, 3]; f[12] = new A(y - d, t, y, t + e); g[12] = [13, 7, 10]; f[13] = new A(y - d, z - e, y, z); g[13] = [12, 6, 3]; f[14] = new A(s, z - e, s + d, z); g[14] = [15, 1, 4]; f[15] = new A(s, t, s + d, t + e); g[15] = [14, 0, 9]; if (q.positions !== null) { var h = q.positions[0] } else if (q.targetPos != null && q.elementPos != null) { var h = []; h[0] = []; h[0][0] = 15; h[0][1] = 7; h[0][2] = 8; h[0][3] = 9; h[1] = []; h[1][0] = 0; h[1][1] = 12; h[1][2] = 10; h[1][3] = 11; h[2] = []; h[2][0] = 2; h[2][1] = 3; h[2][2] = 13; h[2][3] = 1; h[3] = []; h[3][0] = 4; h[3][1] = 5; h[3][2] = 6; h[3][3] = 14; var h = h[q.targetPos][q.elementPos] } var i = f[h]; var j = h; if (!q.force) { $window = $(window); var k = $window.scrollLeft(); var l = $window.scrollTop(); var m = new A(k, l, k + $window.width(), l + $window.height()); var n; if (q.positions) { n = q.positions } else { n = [h] } var o = []; while (n.length > 0) { var p = n.shift(); if (o[p]) { continue } o[p] = true; if (!m.contains(f[p])) { if (q.positions === null) { n = jQuery.merge(n, g[p]) } } else { i = f[p]; break } } } c.parents().each(function() { var a = $(this); if (a.css('position') != 'static') { var b = a.offset(); i = i.transform(-b.left, -b.top); return false } }); c.css({ left: i.x1, top: i.y1 }); if (q.addClass) { c.removeClass('positionBy0 positionBy1 positionBy2 positionBy3 positionBy4 positionBy5 ' + 'positionBy6 positionBy7 positionBy8 positionBy9 positionBy10 positionBy11 ' + 'positionBy12 positionBy13 positionBy14 positionBy15').addClass('positionBy' + p) } }) } })(jQuery);






/*
 * jdMenu 1.4.0 (2008-01-25)
 *
 * Copyright (c) 2006,2007 Jonathan Sharp (http://jdsharp.us)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://jdsharp.us/
 *
 * Built upon jQuery 1.2.1 (http://jquery.com)
 * This also requires the jQuery dimensions >= 1.2 plugin
 */
(function($) {
	$.jdMenu = {
		settings: [],
		getSettings: function(element) {
			var t = $(element).parents('ul.jd_menu:eq(0)')[0];
			return this.settings[t && t.$jdSettings ? t.$jdSettings : 0];
		}
	};

	function activateMenu(ul) {
		var ul = $(ul);
		var li = ul.parent();
		ul.trigger('jdMenuShow')
			.positionBy({ target: li[0],
				targetPos: (li.parent().is('.jd_menu') ? 3 : 1),
				elementPos: 0
			});
		li.addClass('jdm_active')
		// Hide any adjacent menus
			.siblings('li.sub').find('ul:eq(0):visible')
				.each(function() {
					hideMenu(this);
				});
	}

	function hideMenu(ul) {
		$(ul)
			.filter(':not(.jd_menu)')
			.find('> li.sub ul:eq(0):visible')
				.each(function() {
					hideMenu(this);
				})
			.end()
			.hide()
			.trigger('jdMenuHide')
			.parents('li.sub:eq(0)')
				.removeClass('jdm_active jdm_hover')
			.end()
				.find('> li.sub')
				.removeClass('jdm_active jdm_hover');
	}

	function getSettings(element) {
		return $.data($(element).is('.jd_menu') ? element : $(element).parents('ul.jd_menu')[0], 'jdMenuSettings'); ;
	}

	// Public methods
	$.fn.jdMenu = function(settings) {
		var settings = $.extend({ activateDelay: 500,
			showDelay: 0,
			hideDelay: 250
		}, settings);
		return this.filter('ul.jd_menu').each(function() {
			$.data(this, 'jdMenuSettings', settings);
			$('li.sub', this)
				.bind('mouseenter.jdmenu', function() {
					$(this).addClass('jdm_hover');
					var ul = $('ul:eq(0)', this);
					if (ul.length == 1) {
						var me = this;
						clearTimeout(this.$jdTimer);
						this.$jdTimer = setTimeout(function() {
							activateMenu(ul);
						}, getSettings(this).showDelay);
					}
				})
				.bind('mouseleave.jdmenu', function() {
					$(this).removeClass('jdm_hover');
					var ul = $('ul:eq(0)', this);
					if (ul.length == 1) {
						var settings = $.jdMenu.getSettings(this);
						var me = this;
						clearTimeout(this.$jdTimer);
						this.$jdTimer = setTimeout(function() {
							hideMenu(ul);
						}, getSettings(this).hideDelay);
					}
				})
				.bind('click.jdmenu', function(evt) {
					var ul = $('> ul', this);
					if (ul.length == 1) {
						activateMenu(ul);
					}

					// The user clicked the li and we need to trigger a click for the a
					if (evt.target == this) {
						var link = $('> a', evt.target).not('.accessible');
						if (link.length > 0) {
							var a = link[0];
							if (!a.onclick) {
								window.open(a.href, a.target || '_self');
							} else {
								$(a).trigger('click');
							}
						}
					}
					$(this).parent().jdMenuHide();
					evt.stopPropagation();
				})
				.bind('keydown.jdmenu', function(e) {
					if (e.which == 27) {
						if (!$(this).parent().is('.jd_menu')) {
							hideMenu($(this).parent()[0]);
						}
						$(this).parents('li.sub:eq(0)').find('a:eq(0)').trigger('focus');
						return false;
					}
				})
				.find('> a')
					.bind('focus.jdmenu', function() {
						$(this).parents('li.sub:eq(0)').addClass('jdm_hover');
					})
					.bind('blur.jdmenu', function() {
						$(this).parents('li.sub:eq(0)').removeClass('jdm_hover');
					})
					.filter('.accessible')
						.bind('click.jdmenu', function(evt) {
							evt.preventDefault();
						});
		});
	};

	$.fn.jdMenuUnbind = function() {
		$('li.sub', this)
			.unbind('mouseenter.jdmenu mouseleave.jdmenu click.jdmenu keydown.jdmenu')
			.find('> a').unbind('focus.jdmenu blur.jdmenu click.jdmenu');
		return this;
	};

	$.fn.jdMenuHide = function() {
		return this.filter('ul').each(function() { hideMenu(this); });
	};

	// Private methods and logic
	$(window)
	// Bind a click event to hide all visible menus when the document is clicked
		.bind('click.jdmenu', function() {
			$('ul.jd_menu ul:visible').jdMenuHide();
		});
})(jQuery);
