String.prototype.stripHTML = function() {
	return this.replace(/<(?:.|\s)*?>/g, '');
};

Array.prototype.contains = function(val) {
	var len = this.length;
	for (var i = 0; i < len; i++) {
		if (this[i] == val) {
			return true;
		}
	}
	
	return false;
}


function showOverlay(id) {
	$('#overlay').css('height', $(document).height()).show();
	$('#' + id).show();	
}
function hideOverlay(id, fade) {
	if (typeof(fade) != 'undefined') {
		$('#overlay, #' + id).fadeOut(fade);
	} else {
		$('#overlay, #' + id).hide();
	}
}

function ajaxError(request, status, err) {
	var txt = 'There was an error making the request:';
	
	if (status) { txt += '\n' + status; }
	if (err) { txt += '\n' + err; }
	
	alert(txt);
}

$(document).ready(function() {
	if ($.fn.tooltip) {
		$('a.tooltip').tooltip();
	}
});