var jrs = {

	showRaidTip : function(o) {

		var comment = o.attr('comment');

		if (comment.length > 0) {

			var tiptitle = o.attr('tiptitle');
			var image = o.attr('image');
			var tip = (o.attr('id') ? '#' + o.attr('id') + ' ' : '') + '.raidtip';

			o.prepend('<div class="raidtip"><div class="t"></div><div class="m">' + (image ? '<img alt="" src="' + image + '" />' : '') + (tiptitle ? '<h1>' + tiptitle + '</h1><br/>' : '') + comment + '</div><div class="b"></div></div>');

			jQuery(tip).css('margin-top', '-' + (jQuery(tip).height() + 5) + 'px');
			jQuery(tip).css('margin-left', '-' + ((jQuery(tip).width() / 2) - (o.width() / 2)) + 'px');

			// also close the tip when hovering over it so it doesn't get in the way
			jQuery(tip).hover(
				function () {
					jrs.closeRaidTip(o);
				},
				function () {
				}
			);

			if (jQuery.browser.msie) {
				// IE is gay
				jQuery(tip).css('display', 'block');
			} else {
				jQuery(tip).fadeIn('fast');
			}

		}

	},

	closeRaidTip : function(o) {

		var tip = (o.attr('id') ? '#' + o.attr('id') + ' ' : '') + '.raidtip';

		// not fading out here as that causes flicker when another tip is fading in at the same time
		jQuery(tip).remove();

	},

	showRaidList : function() {

		var list = '';
		var l = document.getElementById('jrs_signups');

		jQuery('#jrs_signups .char').each(function() {
			list += this.innerHTML + '<br/>';
		});

		jrs.closeRaidList();
		jQuery('#jrs_signups').prepend('<div id="jrs_copyview"><h1>Copy list</h1>' + list + '<br/><a class="btn" href="javascript:jrs.closeRaidList()">Close</a></div>');

	},

	closeRaidList : function() {
		jQuery('#jrs_copyview').remove();
	}

}
