var maxlength = 150;
var defVoice;
var posting = false;
function postVoice() {
	var val = $F('txtBody');
	if (val != '' && val != defVoice && val.length <= maxlength && posting == false) {
	    document.postForm.submit();
	    posting = true;
	}
}
function onHeaderLoad() {
    var body = $('txtBody');
    if (!body) return;
    if (body.value == defVoice) {
        Event.observe(body, 'focus', initBody);
    } else {
        body.addClassName('voiceform_active');
        $('postButton').show();
    }
    Event.observe(body, 'keyup', inputBody);
}
function initBody() {
    var body = $('txtBody');
    Field.clear(body);
    body.addClassName('voiceform_active');
    $('postButton').show();
    Event.stopObserving(body, 'focus', initBody);
}
function inputBody() {
    var len = $F('txtBody').length;
    if (len > maxlength) {
        $('overLength').innerHTML = len - maxlength;
        Element.show('lengthAlert');
    } else {
        Element.hide('lengthAlert');    
    }
}
Event.observe(window, 'load', onHeaderLoad);

