

function submit(e) {
	button = $('improve-submit');
	commentTextArea = $('improve-sug');
	postBody = queryString({comment:commentTextArea.value})
	d = doXHR("/commentsAjax", {
		method:'POST', 
		sendContent:postBody,
		mimeType: 'application/javascript',
                headers: [['Content-Type', 'application/x-www-form-urlencoded']]
	});
	d.addCallback(function (result) {
		log(result);
		thanks = P({class:'tab'}, "Thank You");
		hideElement(thanks);
		insertSiblingNodesBefore(button,thanks);
		commentTextArea.value = "";
		blindDown(thanks,{duration:0.3});
	});
	e.stop();
}


function init(e) {
	var improvesug = $('improve-sug');
	if (improvesug ) {
		connect('improve-submit', 'onclick', submit);
		addElementClass(improvesug, "default");
		connect('improve-sug', 'onclick',clearimprove);
	}
}

function clearimprove(e) {
	is = $('improve-sug')
	if (hasElementClass(is,"default")) {
		log("clearimp");
		is.value = "";
		removeElementClass(is,"default");
	}
}


connect(window,'onload',init);

