// shoutbox.js v0.1, Jan 2009

document.observe("dom:loaded", function() {
	if($("shoutbox_countsigns")!=null) {
	   var shout = new shoutbox();
	}
});

var sbct = true;
function textcounter(field, countfield, limit) {
	if (field.value.length > limit) {
		field.value = field.value.substring(0, limit);
	} else {
		countfield.value = String(limit - field.value.length)+ ' Zeichen';
	}
}
function cleartextarea(field) {}

var SBwhatsup_default = 'Schreib was!';

// feedlist class
var shoutbox = Class.create( {
	initialize : function(name) {
			this.SBname = name;
			this.SBWatchThis();
			this.SBSetStartConfig();
	},
	SBWatchThis : function() {
		$("shoutbox_countsigns").style.visibility = "visible";
		Element.extend(document.shoutboxform.message).observe('click', this.SBSetInputClick);
		Element.extend(document.shoutboxform.message).observe('blur', this.SBblur);
	},
	SBSetStartConfig : function() {
		document.shoutboxform.message.value = SBwhatsup_default;
	},
	SBSetInputClick : function() {
		if (document.shoutboxform.message.value == SBwhatsup_default) {
			document.shoutboxform.message.value = '';
		}
	},
	SBblur : function() {
		if (document.shoutboxform.message.value == '') {
			document.shoutboxform.message.value = SBwhatsup_default;
		}

	}

});

