function mouseOver() {
	if (!$(this).hasClass('disabled')) {
		$(this).addClass('hover');
	}
}

function mouseOut() {
	if (!$(this).hasClass('disabled')) {
		$(this).removeClass('hover');
	}
}

function highlightText(string) {
	string = string.replace(/(@([a-zA-Z0-9_]+))/g, '<a href="/$2"><span class="highlight_at">$1</span></a>');
	string = string.replace(/(\+([a-zA-Z0-9_-]+))/g, '<a href="/showtag/$2"><span class="highlight_plus">$1</span></a>');
	return string;
}

$(function(){
	$('.button,.capsule').hover(mouseOver, mouseOut);
	
	$.extend($.fn.disableTextSelect = function() {
		return this.each(function(){
			if($.browser.mozilla){//Firefox
				$(this).css('MozUserSelect','none');
			}else if($.browser.msie){//IE
				$(this).bind('selectstart',function(){return false;});
			}else{//Opera, etc.
				$(this).mousedown(function(){return false;});
			}
		});
	});
	$('.button,.capsule').disableTextSelect();//No text selection on elements with a class of 'noSelect'
});

$.prototype.enabled = function(value) {
	if (value) {
		this.removeClass('disabled');
	} else {
		this.addClass('disabled');
	}
};


