function init() {
	determineStyle();
}


function getBrowserWidth() { //from ParticleTree - www.particletree.com
	if (window.innerWidth) {return window.innerWidth;}	
	else if (document.documentElement && document.documentElement.clientWidth != 0) {return document.documentElement.clientWidth;}
	else if (document.body) {return document.body.clientWidth;}		
	return 0;
}
function determineStyle() { //inspired by A List Apart - www.alistapart.com
	var browserWidth = getBrowserWidth();
	if(browserWidth <= 850) {
		for(var q = 0; (a = document.getElementsByTagName("link")[q]); q++) {
			a.disabled = true;
			if(a.getAttribute("title") == "narrow") a.disabled = false;
		}
	}
	if(browserWidth > 850) {
		for(var q = 0; (a = document.getElementsByTagName("link")[q]); q++) {
			a.disabled = true;
			if(a.getAttribute("title") == "wide") a.disabled = false;
		}
	}
}
function doResize() {
	determineStyle();
	if(document.getElementsByTagName("body")[0].className == "article") {
		var form = document.getElementById("commentformarea");
		var browserWidth = getBrowserWidth();
		if(browserWidth <= 850) {
			form.parentNode.removeChild(form);
			document.getElementsByTagName("body")[0].appendChild(form);
		}
		if(browserWidth > 850) {
			form.parentNode.removeChild(form);
			document.getElementById("infos").appendChild(form);
		}
		moveComments();
	}
}

window.onload = init;
window.onresize = doResize;