/// <reference path="../jquery-1.4.1-vsdoc.js" />

(function () {
	var _$technologies_li;
	function $technologies_li() {
		/// <returns type="jQuery" />
		return _$technologies_li || (_$technologies_li = $("#technology li"));
	}
	function unhover() {
		$technologies_li().removeClass("ihv");
	}
	var links = [
	"#lfx", ".ifx",
	"#lfl", ".ifl, .ips",
	"#llx", ".iph, .idr, .imy, .ijq, .ifb",
	"#lan", ".ims, .isa, .ivs, .ijq, .iex",
	"#lsl", ".ims, .isa, .ivs, .isl",
	"#lma", ".iad, .iip",
	"#lcc", ".iaz, .isa, .ifb"
	];

	$.each(links, function (i, v) {
		i % 2 || $(v).hover(function () {
			$technologies_li().filter(links[i + 1]).addClass("ihv");
		}, unhover);
	});

	/* uncomment this to use the bouncy effect on tooltips
	$.easing.bouncy = function (x, t, b, c, d) {
	var 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;
	}

	// create custom tooltip effect for jQuery Tooltip
	$.tools.tooltip.addEffect("bouncy", function (done) {
	// opening animation
	this.getTip().animate({ top: '+=15' }, 500, 'bouncy', done).show();
	}, function (done) {
	// closing animation
	this.getTip().animate({ top: '-=15' }, 500, 'bouncy', function () {
	$(this).hide();
	done.call();
	});
	});
	*/

	$("[title]").tooltip({
		effect: "fade",
		fadeInSpeed: 300,
		fadeOutSpeed: 300,
		opacity: .9,
		delay: 100,
		//position: "bottom center",
		// tweak the position
		offset: [-4, 0]
	}).dynamic({ bottom: { direction: 'down', bounce: true} });
	$("#technology").click(function (e) {
		//hide all the tooltips before redirecting
		$(".tooltip").hide();
		window.location.href = $(e.target).find("a").attr("href");
	});
})();
