function lame_action(pid) {
	var url = $('lame_button' + pid).readAttribute('href');
	var url_object = url.toQueryParams();
	var action = url_object.action;
	var new_action = action == 'lame' ? 'remove_lame' : 'lame';

	if (parseInt(pid) && (action == 'lame' || action == 'remove_lame')) 
	{
		this.spinner = new ActivityIndicator("body", {image: imagepath + "/spinner_big.gif"});
		new Ajax.Request(
			'xmlhttp.php', {
			method: 'post',
			parameters: {action: action, pid: pid},
			onSuccess: function(data) {
				var response = data.responseText.evalJSON();
				if (response.success) {
					$('lame_' + pid).update(response.block);
					url_object.action = new_action;
					var new_url = $H(url_object).toQueryString();
					//alert(test);

					$('lame_button' + pid).update(response.image);
					$('lame_button' + pid).writeAttribute('href', new_url);
					this.spinner.destroy();
					this.spinner = '';
				}
				else 
				{
					errorPop('An error has occurred submitting while your request. Please refresh and try again.  If the problem persists, contact the board administrator.');
					this.spinner.destroy();
					this.spinner = '';
				}
			}
		});
	}
	else 
	{
		errorPop('An error has occurred while submitting your request. Please refresh and try again.  If the problem persists, contact the board administrator.');
	}
}

function errorPop(message) {
	var dim = $('container').getDimensions();
	var page = document.viewport.getScrollOffsets();

	var div = new Element('div', {'id':'lame_bg_error'});
	div.setStyle({
		margin: '0px', 
		padding: '0px', 
		backgroundColor: '#000000',
		width: '100%',
		minHeight: dim.height + 'px',
		height: dim.height + 'px', 
		zIndex: '100', 
		position: 'absolute',
		opacity: '0.8', 
		filter: 'alpha(opacity=80)'});
	
	var div2 = new Element('div', {'id':'lame_msg_error'});
	div2.setStyle({
		margin: '0px',
		padding: '10px 5px 0px 5px',
		width: '200px',
		height: '200px',
		border: 'thin solid #000000',
		top: (page.top + document.viewport.getHeight()/2) - 100 + 'px',
		left: (dim.width / 2) - 100 + 'px',
		position: 'absolute',
		zIndex: '101',
		color: 'red',
		fontWeight: 'bold',
		backgroundColor: '#CCCCCC'
	});
	
	div2.update(message + '<br /><br /><center><button type="button" onclick="$(\'lame_bg_error\').remove(); return false;">Kapat</button></center>');
	
	$('container').insert({'before' : div});
	$('lame_bg_error').insert({'top' : div2});
	
}