/*
 * 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: 2007-03-27 16:29:43 -0500 (Tue, 27 Mar 2007) $
 * $Rev: 1601 $
 */
 
 
 
jQuery.fn._height = jQuery.fn.height;
jQuery.fn._width  = jQuery.fn.width;
jQuery.fn.height = function() {
	if ( this[0] == window )
		return self.innerHeight ||
			jQuery.boxModel && document.documentElement.clientHeight ||
			document.body.clientHeight;

	if ( this[0] == document )
		return Math.max( document.body.scrollHeight, document.body.offsetHeight );

	return this._height(arguments[0]);
};
jQuery.fn.width = function() {
	if ( this[0] == window )
		return self.innerWidth ||
			jQuery.boxModel && document.documentElement.clientWidth ||
			document.body.clientWidth;

	if ( this[0] == document )
		return Math.max( document.body.scrollWidth, document.body.offsetWidth );

	return this._width(arguments[0]);
};
jQuery.fn.innerHeight = function() {
	return this[0] == window || this[0] == document ?
		this.height() :
		this.css('display') != 'none' ?
		 	this[0].offsetHeight - (parseInt(this.css("borderTopWidth")) || 0) - (parseInt(this.css("borderBottomWidth")) || 0) :
			this.height() + (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
};
jQuery.fn.innerWidth = function() {
	return this[0] == window || this[0] == document ?
		this.width() :
		this.css('display') != 'none' ?
			this[0].offsetWidth - (parseInt(this.css("borderLeftWidth")) || 0) - (parseInt(this.css("borderRightWidth")) || 0) :
			this.height() + (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
};
jQuery.fn.outerHeight = function() {
	return this[0] == window || this[0] == document ?
		this.height() :
		this.css('display') != 'none' ?
			this[0].offsetHeight :
			this.height() + (parseInt(this.css("borderTopWidth")) || 0) + (parseInt(this.css("borderBottomWidth")) || 0)
				+ (parseInt(this.css("paddingTop")) || 0) + (parseInt(this.css("paddingBottom")) || 0);
};
jQuery.fn.outerWidth = function() {
	return this[0] == window || this[0] == document ?
		this.width() :
		this.css('display') != 'none' ?
			this[0].offsetWidth :
			this.height() + (parseInt(this.css("borderLeftWidth")) || 0) + (parseInt(this.css("borderRightWidth")) || 0)
				+ (parseInt(this.css("paddingLeft")) || 0) + (parseInt(this.css("paddingRight")) || 0);
};
jQuery.fn.scrollLeft = function() {
	if ( this[0] == window || this[0] == document )
		return self.pageXOffset ||
			jQuery.boxModel && document.documentElement.scrollLeft ||
			document.body.scrollLeft;

	return this[0].scrollLeft;
};
jQuery.fn.scrollTop = function() {
	if ( this[0] == window || this[0] == document )
		return self.pageYOffset ||
			jQuery.boxModel && document.documentElement.scrollTop ||
			document.body.scrollTop;

	return this[0].scrollTop;
};
jQuery.fn.offset = function(options, returnObject) {
	var x = 0, y = 0, elem = this[0], parent = this[0], absparent=false, relparent=false, op, sl = 0, st = 0, options = jQuery.extend({ margin: true, border: true, padding: false, scroll: true }, options || {});
	do {
		x += parent.offsetLeft || 0;
		y += parent.offsetTop  || 0;
		if (jQuery.browser.mozilla || jQuery.browser.msie) {
			var bt = parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
			var bl = parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
			x += bl;
			y += bt;
			if (jQuery.browser.mozilla && parent != elem && jQuery.css(parent, 'overflow') != 'visible') {
				x += bl;
				y += bt;
			}
			if (jQuery.css(parent, 'position') == 'absolute') absparent = true;
			if (jQuery.css(parent, 'position') == 'relative') relparent = true;
		}

		if (options.scroll) {
			op = parent.offsetParent;
			do {
				sl += parent.scrollLeft || 0;
				st += parent.scrollTop  || 0;

				parent = parent.parentNode;
				if (jQuery.browser.mozilla && parent != elem && parent != op && jQuery.css(parent, 'overflow') != 'visible') {
					x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
					y += parseInt(jQuery.css(parent, 'borderTopWidth')) || 0;
				}
			} while (op && parent != op);
		} else
			parent = parent.offsetParent;

		if (parent && (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html')) {
			// Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
			if ((jQuery.browser.safari || (jQuery.browser.msie && jQuery.boxModel)) && jQuery.css(elem, 'position') != 'absolute') {
				x += parseInt(jQuery.css(parent, 'marginLeft')) || 0;
				y += parseInt(jQuery.css(parent, 'marginTop'))  || 0;
			}
			if ( (jQuery.browser.mozilla && !absparent) || 
			     (jQuery.browser.msie && jQuery.css(elem, 'position') == 'static' && (!relparent || !absparent)) ) {
				x += parseInt(jQuery.css(parent, 'borderLeftWidth')) || 0;
				y += parseInt(jQuery.css(parent, 'borderTopWidth'))  || 0;
			}
			break; // Exit the loop
		}
	} while (parent);

	if ( !options.margin) {
		x -= parseInt(jQuery.css(elem, 'marginLeft')) || 0;
		y -= parseInt(jQuery.css(elem, 'marginTop'))  || 0;
	}
	if ( options.border && (jQuery.browser.safari || jQuery.browser.opera) ) {
		x += parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
		y += parseInt(jQuery.css(elem, 'borderTopWidth'))  || 0;
	} else if ( !options.border && !(jQuery.browser.safari || jQuery.browser.opera) ) {
		x -= parseInt(jQuery.css(elem, 'borderLeftWidth')) || 0;
		y -= parseInt(jQuery.css(elem, 'borderTopWidth'))  || 0;
	}
	if ( options.padding ) {
		x += parseInt(jQuery.css(elem, 'paddingLeft')) || 0;
		y += parseInt(jQuery.css(elem, 'paddingTop'))  || 0;
	}
	if (options.scroll && jQuery.browser.opera && jQuery.css(elem, 'display') == 'inline') {
		sl -= elem.scrollLeft || 0;
		st -= elem.scrollTop  || 0;
	}
	var returnValue = options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
	                                 : { top: y, left: x };
	if (returnObject) { jQuery.extend(returnObject, returnValue); return this; }
	else              { return returnValue; }
};
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 * TERMS OF USE - jQuery Easing
 * Open source under the BSD License.
 */
// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];
jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});
/* hover indent */
(function($) {
	$.fn.hoverIntent = function(f,g) {
		var cfg = {
			sensitivity: 7,
			interval: 100,
			timeout: 0
		};
		cfg = $.extend(cfg, g ? { over: f, out: g } : f );
		var cX, cY, pX, pY;
		var track = function(ev) {
			cX = ev.pageX;
			cY = ev.pageY;
		};
		var compare = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
				$(ob).unbind("mousemove",track);
				ob.hoverIntent_s = 1;
				return cfg.over.apply(ob,[ev]);
			} else {
				pX = cX; pY = cY;
				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
			}
		};
		var delay = function(ev,ob) {
			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
			ob.hoverIntent_s = 0;
			return cfg.out.apply(ob,[ev]);
		};
		var handleHover = function(e) {
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
			if ( p == this ) { return false; }
			var ev = jQuery.extend({},e);
			var ob = this;
			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
			if (e.type == "mouseover") {
				pX = ev.pageX; pY = ev.pageY;
				$(ob).bind("mousemove",track);
				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
			} else {
				$(ob).unbind("mousemove",track);
				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
			}
		};
		return this.mouseover(handleHover).mouseout(handleHover);
	};
})(jQuery);
/*
* jQuery clueTip plugin
* Version 0.9.4  (11/14/2007)
* @requires jQuery v1.1.1+
* @requires Dimensions plugin 
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($) { 
	var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow, imgCount;
	$.fn.cluetip = function(options) {
		var defaults = {
			width:            275,
			height:           'auto',
			cluezIndex:       97,
			positionBy:       'auto',
			topOffset:        15,
			leftOffset:       15,
			local:            false,
			hideLocal:        true,
			attribute:        'rel',
			titleAttribute:   'title',
			splitTitle:       '',
			showTitle:        true,
			cluetipClass:     'default',
			hoverClass:       '',
			waitImage:        true,
			cursor:           'help',
			arrows:           false, 
			dropShadow:       true,
			dropShadowSteps:  6,
			sticky:           false,
			mouseOutClose:    false,
			activation:       'hover',
			closePosition:    'top',
			closeText:        'Close',
			truncate:         0,
			fx: {             
				open:       'show',
				openSpeed:  ''
			},                
			hoverIntent: {    
				sensitivity:  3,
				interval:     50,
				timeout:      0
			},                
			onActivate:       function(e) {return true;},
			onShow:           function(ct, c){},
			ajaxCache:        true,  
			ajaxProcess:      function(data) {
				data = $(data).not('style, meta, link, script, title');
				return data;
			},                
			ajaxSettings: {   
				dataType: 'html'
			}
		};
		if (options && options.ajaxSettings) {
			$.extend(defaults.ajaxSettings, options.ajaxSettings);
			delete options.ajaxSettings;
		}
		if (options && options.fx) {
			$.extend(defaults.fx, options.fx);
			delete options.fx;
		}
		if (options && options.hoverIntent) {
			$.extend(defaults.hoverIntent, options.hoverIntent);
			delete options.hoverIntent;
		}
		$.extend(defaults, options);

		return this.each(function() {
			var cluetipContents = false;
			var cluezIndex = parseInt(defaults.cluezIndex, 10)-1;
			var isActive = false;
			if (!$cluetip) {
				$cluetipInner = $('<div id="cluetip-inner"></div>');
				$cluetipTitle = $('<h3 id="cluetip-title"></h3>');        
				$cluetipOuter = $('<div id="cluetip-outer"></div>').append($cluetipInner).prepend($cluetipTitle);
				$cluetip = $('<div></div>').attr({'id': 'cluetip'}).css({zIndex: defaults.cluezIndex})
				.append($cluetipOuter).append('<div id="cluetip-extra"></div>')[insertionType](insertionElement).hide();
				$('<div id="cluetip-waitimage"></div>').css({position: 'absolute', zIndex: cluezIndex-1})
				.insertBefore('#cluetip').hide();
				$cluetip.css({position: 'absolute', zIndex: cluezIndex});
				$cluetipOuter.css({position: 'relative', zIndex: cluezIndex+1});
				$cluetipArrows = $('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex: cluezIndex+1}).appendTo('#cluetip');
			}
			var dropShadowSteps = (defaults.dropShadow) ? +defaults.dropShadowSteps : 0;
			if (!$dropShadow) {
				$dropShadow = $([]);
				for (var i=0; i < dropShadowSteps; i++) {
					$dropShadow = $dropShadow.add($('<div></div>').css({zIndex: cluezIndex-i-1, opacity:.1, top: 1+i, left: 1+i}));
				};
				$dropShadow.css({position: 'absolute', backgroundColor: '#000'})
				.prependTo($cluetip);
			}
			var $this = $(this);      
			var tipAttribute = $this.attr(defaults.attribute), ctClass = defaults.cluetipClass;
			if (!tipAttribute && !defaults.splitTitle) return true;
			if (defaults.local && defaults.hideLocal) { $(tipAttribute + ':first').hide(); }
			var tOffset = parseInt(defaults.topOffset, 10), lOffset = parseInt(defaults.leftOffset, 10);
			var tipHeight, wHeight;
			var defHeight = isNaN(parseInt(defaults.height, 10)) ? 'auto' : (/\D/g).test(defaults.height) ? defaults.height : defaults.height + 'px';
			var sTop, linkTop, posY, tipY, mouseY;
			var tipWidth = parseInt(defaults.width, 10) + parseInt($cluetip.css('paddingLeft')) + parseInt($cluetip.css('paddingRight')) + dropShadowSteps;
			if( isNaN(tipWidth) ) tipWidth = 275;
			var linkWidth = this.offsetWidth;
			var linkLeft, posX, tipX, mouseX, winWidth;
			var tipParts;
			var tipTitle = (defaults.attribute != 'title') ? $this.attr(defaults.titleAttribute) : '';
			if (defaults.splitTitle) {
				tipParts = tipTitle.split(defaults.splitTitle);
				tipTitle = tipParts.shift();
			}
			var localContent;
			var activate = function(event) {
				if (!defaults.onActivate($this)) {
					return false;
				}
				isActive = true;
				$cluetip.removeClass().css({width: defaults.width});
				if (tipAttribute == $this.attr('href')) {
					$this.css('cursor', defaults.cursor);
				}
				$this.attr('title','');
				if (defaults.hoverClass) {
					$this.addClass(defaults.hoverClass);
				}
				linkTop = posY = $this.offset().top;
				linkLeft = $this.offset().left;
				mouseX = event.pageX;
				mouseY = event.pageY;
				if ($this[0].tagName.toLowerCase() != 'area') {
					sTop = $(document).scrollTop();
					winWidth = $(window).width();
				}
				if (defaults.positionBy == 'fixed') {
					posX = linkWidth + linkLeft + lOffset;
					$cluetip.css({left: posX});
				} else {
					posX = (linkWidth > linkLeft && linkLeft > tipWidth)
					|| linkLeft + linkWidth + tipWidth + lOffset > winWidth 
					? linkLeft - tipWidth - lOffset 
					: linkWidth + linkLeft + lOffset;
					if ($this[0].tagName.toLowerCase() == 'area' || defaults.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
						if (mouseX + 20 + tipWidth > winWidth) {  
							posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset :  mouseX - (tipWidth/2);
						} else {
							posX = mouseX + lOffset;
						}
						var pY = posX < 0 ? event.pageY + tOffset : event.pageY;
					}
					$cluetip.css({left: (posX > 0 && defaults.positionBy != 'bottomTop') ? posX : (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0)});
				}
				wHeight = $(window).height();
				if (tipParts) {
					for (var i=0; i < tipParts.length; i++){
						if (i == 0) {
							$cluetipInner.html(tipParts[i]);
						} else { 
							$cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
						}            
					};
					cluetipShow(pY);
				}
				else if (!defaults.local && tipAttribute.indexOf('#') != 0) {
					if (cluetipContents && defaults.ajaxCache) {
						$cluetipInner.html(cluetipContents);
						cluetipShow(pY);
					}
					else {
						var ajaxSettings = defaults.ajaxSettings;
						ajaxSettings.url = tipAttribute;
						ajaxSettings.beforeSend = function() {
							$cluetipOuter.children().empty();
							if (defaults.waitImage) {
								$('#cluetip-waitimage')
								.css({top: mouseY-10, left: parseInt(posX+(tipWidth/2),10)})
								.show();
							}
						};
						ajaxSettings.error = function() {
							if (isActive) {
								$cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
							}
						};
						ajaxSettings.success = function(data) {
							cluetipContents = defaults.ajaxProcess(data);
							if (isActive) {
								$cluetipInner.html(cluetipContents);
							}
						};
						ajaxSettings.complete = function() {
							imgCount = $('#cluetip-inner img').length;
							if (imgCount) {
								$('#cluetip-inner img').load( function(){
									imgCount--;
									if (imgCount<1) {
										$('#cluetip-waitimage').hide();
										if (isActive) cluetipShow(pY);
									}
								}); 
							} else {
								$('#cluetip-waitimage').hide();
								if (isActive) cluetipShow(pY);    
							} 
						};
						$.ajax(ajaxSettings);
					}
				} else if (defaults.local){
					var $localContent = $(tipAttribute + ':first');
					var localCluetip = $.fn.wrapInner ? $localContent.wrapInner('<div></div>').children().clone(true) : $localContent.html();
					$.fn.wrapInner ? $cluetipInner.empty().append(localCluetip) : $cluetipInner.html(localCluetip);
					cluetipShow(pY);
				}
			};
			var cluetipShow = function(bpY) {
				$cluetip.addClass('cluetip-' + ctClass);

				if (defaults.truncate) { 
					var $truncloaded = $cluetipInner.text().slice(0,defaults.truncate) + '...';
					$cluetipInner.html($truncloaded);
				}
				function doNothing() {}; //empty function
				tipTitle ? $cluetipTitle.show().html(tipTitle) : (defaults.showTitle) ? $cluetipTitle.show().html('&nbsp;') : $cluetipTitle.hide();
				if (defaults.sticky) {
					var $closeLink = $('<div id="cluetip-close"><a href="#">' + defaults.closeText + '</a></div>');
					(defaults.closePosition == 'bottom') ? $closeLink.appendTo($cluetipInner) : (defaults.closePosition == 'title') ? $closeLink.prependTo($cluetipTitle) : $closeLink.prependTo($cluetipInner);
					$closeLink.click(function() {
						cluetipClose();
						return false;
					});
					if (defaults.mouseOutClose) {
						$cluetip.hover(function() {doNothing(); }, 
						function() {$closeLink.trigger('click'); });
					} else {
						$cluetip.unbind('mouseout');
					}
				}
				var direction = '';
				$cluetipOuter.css({overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
				tipHeight = defHeight == 'auto' ? $cluetip.outerHeight() : parseInt(defHeight,10);   
				tipY = posY;      
				if (defaults.positionBy == 'fixed') {
					tipY = posY - defaults.dropShadowSteps + tOffset;
				} else if ( (posX < mouseX && Math.max(posX, 0) + tipWidth > mouseX) || defaults.positionBy == 'bottomTop') {
					if (posY + tipHeight + tOffset > sTop + wHeight && mouseY - sTop > tipHeight + tOffset) { 
						tipY = mouseY - tipHeight - tOffset;
						direction = 'top';
					} else { 
						tipY = mouseY + tOffset;
						direction = 'bottom';
					}
				} else if ( posY + tipHeight + tOffset > sTop + wHeight ) {
					tipY = (tipHeight >= wHeight) ? sTop : sTop + wHeight - tipHeight - tOffset;
				} else if ($this.css('display') == 'block' || $this[0].tagName.toLowerCase() == 'area' || defaults.positionBy == "mouse") {
					tipY = bpY - tOffset;
				} else {
					tipY = posY - defaults.dropShadowSteps;
				}
				if (direction == '') {
					posX < linkLeft ? direction = 'left' : direction = 'right';
				}
				$cluetip.css({top: tipY + 'px'}).removeClass().addClass('clue-' + direction + '-' + ctClass).addClass(' cluetip-' + ctClass);
				if (defaults.arrows) { // set up background positioning to align with element
					var bgY = (posY - tipY - defaults.dropShadowSteps);
					$cluetipArrows.css({top: (/(left|right)/.test(direction) && posX >=0 && bgY > 0) ? bgY + 'px' : /(left|right)/.test(direction) ? 0 : ''}).show();
				} else {
					$cluetipArrows.hide();
				}
				$dropShadow.hide();
				$cluetip.hide()[defaults.fx.open](defaults.fx.open != 'show' && defaults.fx.openSpeed);
				if (defaults.dropShadow) $dropShadow.css({height: tipHeight, width: defaults.width}).show();
				defaults.onShow($cluetip, $cluetipInner);
			};
			var inactivate = function() {
				isActive = false;
				$('#cluetip-waitimage').hide();
				if (!defaults.sticky) {
					cluetipClose();
				};
				if (defaults.hoverClass) {
					$this.removeClass(defaults.hoverClass);
				}
			};
			var cluetipClose = function() {
				$cluetipOuter 
				.parent().hide().removeClass().end()
				.children().empty();
				if (tipTitle) {
					$this.attr('title', tipTitle);
				}
				$this.css('cursor','');
				if (defaults.arrows) $cluetipArrows.css({top: ''});
			};
			if (defaults.activation == 'click'||defaults.activation == 'toggle') {
				$this.click(function(event) {
					if ($cluetip.is(':hidden')) {
						activate(event);
					} else {
						inactivate(event);
					}
					this.blur();
					return false;
				});
			} else {
				$this.click(function() {
					if (tipAttribute == $this.attr('href')) {
						return false;
					}
				});
				if ($.fn.hoverIntent && defaults.hoverIntent) {
					$this.hoverIntent({
						sensitivity: defaults.hoverIntent.sensitivity,
						interval: defaults.hoverIntent.interval,  
						over: function(event) {activate(event);}, 
						timeout: defaults.hoverIntent.timeout,  
						out: function(event) {inactivate(event);}
					});           
				} else {
					$this.hover(function(event) {
						activate(event);
					}, function(event) {
						inactivate(event);
					});
				}
			}
		});
	};
	var insertionType = 'appendTo', insertionElement = 'body';
	$.cluetip = {};
	$.cluetip.setup = function(options) {
		if (options && options.insertionType && (options.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)) {
			insertionType = options.insertionType;
		}
		if (options && options.insertionElement) {
			insertionElement = options.insertionElement;
		}
	};
})(jQuery);
/*
 * jqModal - Minimalist Modaling with jQuery
 *
 * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * $Version: 2007.08.17 +r11
 */
(function($) {
	$.fn.jqm=function(o){
		var _o = {
			zIndex: 3000,
			overlay: 50,
			overlayClass: 'jqmOverlay',
			closeClass: 'jqmClose',
			trigger: '.jqModal',
			ajax: false,
			target: false,
			modal: false,
			toTop: false,
			onShow: false,
			onHide: false,
			onLoad: false
		};
		return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
			H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
			if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
		});};

	$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
	$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
	$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
	$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};

	$.jqm = {
		hash:{},
		open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
			if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
			else if(c.overlay > 0)h.w.jqmAddClose(o);
			else o=false;

			h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
			if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

			if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
				r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
			else if(cc)h.w.jqmAddClose($(cc,h.w));

			if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
			(c.onShow)?c.onShow(h):h.w.show();e(h);return false;
		},
		close:function(s){var h=H[s];h.a=false;
			if(A[0]){A.pop();if(!A[0])F('unbind');}
			if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
			if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
		}};
	var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
	i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
	e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
	f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
	F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
	m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
	hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
		$(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
})(jQuery);
/*
 * jqDnR - Minimalistic Drag'n'Resize for jQuery.
 * http://dev.iceburg.net/jquery/jqDnR/
 * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * $Version: 2007.08.19 +r2
 */
(function($){
$.fn.jqDrag=function(h){return i(this,h,'d');};
$.fn.jqResize=function(h){return i(this,h,'r');};
$.jqDnR={dnr:{},e:0,
drag:function(v){
 if(M.k == 'd')E.css({left:M.X+v.pageX-M.pX,top:M.Y+v.pageY-M.pY});
 else E.css({width:Math.max(v.pageX-M.pX+M.W,0),height:Math.max(v.pageY-M.pY+M.H,0)});
  return false;},
stop:function(){E.css('opacity',M.o);$().unbind('mousemove',J.drag).unbind('mouseup',J.stop);}
};
var J=$.jqDnR,M=J.dnr,E=J.e,
i=function(e,h,k){return e.each(function(){h=(h)?$(h,e):e;
 h.bind('mousedown',{e:e,k:k},function(v){var d=v.data,p={};E=d.e;
 // attempt utilization of dimensions plugin to fix IE issues
 if(E.css('position') != 'relative'){try{E.position(p);}catch(e){}}
 M={X:p.left||f('left')||0,Y:p.top||f('top')||0,W:f('width')||E[0].scrollWidth||0,H:f('height')||E[0].scrollHeight||0,pX:v.pageX,pY:v.pageY,k:d.k,o:E.css('opacity')};
 E.css({opacity:0.8});$().mousemove($.jqDnR.drag).mouseup($.jqDnR.stop);
 return false;
 });
});},
f=function(k){return parseInt(E.css(k))||false;};
})(jQuery);
