(function () {
"use strict";

function request(querytext, func, errorfunc) {
	var req = new XMLHttpRequest();
	req.onreadystatechange = function() {
		if (req.readyState !== 4) {
			return;
		}
		if (req.status !== 200) {
			errorfunc();
			return;
		}
		func(req.responseText);
	};
	req.open("GET",querytext);
	req.send();
}

donewpost.onclick = function(e) {
	request("/newpost"+window.location.search+"&t="+encodeURIComponent(document.getElementById("wysihtml5-editor").value),function(r) {
		window.location="/posts.html"+window.location.search;},function() {});
};

}());