function edit(id) {
	
}

function reply(){
	window.location.hash = "#post-reply";
	myField = document.getElementById('post[body]')
	myField.focus();
	myField.selectionStart = myField.value.length;
	myField.scrollTop = myField.scrollHeight;
	
}



function quote(id) {
	var str = $("#fp"+id+" .unparsed_body").html();
	str = "[quote="+id+"]\n" + str.replace(/^\s*|\s*$/g,'') + "\n[/quote]";
	myField = document.getElementById('post[body]')
	
	myField.value = str;
	
	
	window.location.hash = "#post-reply";
	myField.focus();
	myField.selectionStart = myField.value.length;
	myField.scrollTop = myField.scrollHeight;
};


function insertAtCursor(myField, myValue) {
	if (document.selection) { // IE
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	} else if (myField.selectionStart || myField.selectionStart == 0) {//MOZILLA/NETSCAPE support
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
	myField.selectionStart = startPos + myValue.length;
	myField.focus();
	myField.scrollTop = myField.scrollHeight;
	} else {
		myField.value += myValue;
	}
}
