$(function () {
/*
	$('.popup-item').each(function () {
		var distance = 0;
		var time = 150;
		var hideDelay = 100;

		var hideDelayTimer = null;

		var beingShown = false;
		var shown = false;
		var trigger = $('.popup-trigger', this);
		var info = $('.popup', this).css('opacity', 0);


		$([trigger.get(0), info.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;

				info.css({
					top: -120,
					left: 30,
					display: 'block'
				}).animate({
					left: '-=' + distance + 'px',
					opacity: 1
				}, time, 'swing', function() {
					beingShown = false;
					shown = true;
				});
			}

			return false;
		})
		.mouseout(function () {
		
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				info.animate({
					left: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					shown = false;
					info.css('display', 'none');
				});

			}, hideDelay);

			return false;
		});
	});
	
	*/
	
	$('td.tooltip a').tooltip({ 
		delay: 100,
		showURL: false, 
		track: true,
		bodyHandler: function() {
			that = this;
			img = $('img.tooltip-img', this);
			if(img.length > 0){
				var src = img[0].src;
				return $("<img/>").attr("src", src);
			}
		}
	});
	
	$('a#show-filter-form').click(function(){
		$('#filter-user-form form').slideToggle('fast');
		return false;
	});

	$(".brd .post .postbody .post-entry a[href^='http']").attr('target', '_blank');

	
	$('#quick-reply').click(function(){
		$('#fld1').focus();
		return false;
	});
	
	$('form#quick-search').css('opacity','0.4');
	
	$('form#quick-search input[type=text]',this).focusin(function(){
		$(this).parents('form').css('opacity','1');
		$form = $(this).parents('form');
		$form.find('input[type=submit]').addClass('boxshadow');
	}).focusout(function(){
		$(this).parents('form').css('opacity','0.4');
		$form.find('input[type=submit]').removeClass('boxshadow');
	});
	
	$('form#quick-search input[type=submit]',this).focusin(function(){
		$(this).addClass('boxshadow');
		$(this).parents('form').css('opacity','1');
	}).focusout(function(){
		$(this).removeClass('boxshadow');
		$(this).parents('form').css('opacity','0.4');
	});
	
});
