function shb(_id, _period) {
	
	var replaceObj;
	var id = _id;
	var period = _period;
	var ticker = 0;
	var self = this;
	var addButtonValue;
	var addButton;
	var timeout;
	init();
	
	function init() {
		
		if (getById('shbSubmit_' + id)) {
			addButtonValue = getById('shbSubmit_' + id).value;
			addButton = getById('shbSubmit_' + id);
		}
	}

	this.action = function(_action, _loadingOverlay){
	
		var boxTab = getById('shbListShouts_' + id);
		
		if (_action == "add") {
			var text = getById('shbText_' + id).value;
			getById('shbText_' + id).value = "";
			
			if (getById('shbUsername')) 
				var username = getById('shbUsername').value;
			
			if (getById('shbCaptcha')) 
				var captcha = getById('shbCaptcha').value;
			
			if(ticker > 0)
				return;
				
			clearTimeout(timeout);
			
			if (period > 0) {
				ticker = period;
				addButton.disabled = "disabled";
				
				this.tick();
			}
		}	
		
		
		var request = new AjaxRequest(pathPrefix + "/Ajax/shbAction", false, true);
		replaceObj = boxTab;
		
		if (_loadingOverlay) {
			request.ajaxLoadingOverlay(boxTab);
			request.callFunction = this.replaceInnerHTML;
		}
		else {
			request.callFunction = this.replaceInnerHTML;
		}
		
		request.setPostvars("action=" + _action + "&text=" + text + "&securityCode=" + captcha + "&id=" + id + "&username=" + username + sid2);
		request.doRequest();
	
	}
	
	this.replaceInnerHTML = function(_request) {
		var text = _request.responseText;
		if(text.substr(0, 3) == "bwd") {
			alert(text.substr(4));
			return false;			
		}
		
		if(replaceObj)
			replaceObj.innerHTML = _request.responseText;
	}

	this.clearInterval = function() {
		
		if(interval)
			window.clearInterval(interval);
	}
	
	this.tick = function() {
		
		if(ticker > 0) {
			ticker--;
			
			if(ticker == 0) {
				
				addButton.disabled = false;
				addButton.value = addButtonValue;
			}
			else {
				addButton.value = addButtonValue + " (" + (ticker+1) + ")";
			}
			
			timeout = setTimeout(function() {self.tick() }, 1000);
		}
						
	}
	
}