function addsmiley (text)
{
	var t = document.getElementById ('theText');
	if (t.selectionEnd) se = t.selectionEnd; else se = 0;
	t.value = t.value.slice (0, se).concat (text).concat (t.value.slice (se, t.value.length));
	t.focus ();
	t.selectionEnd = se + text.length;
	t.selectionStart = t.selectionEnd;
}
function deleteforumpost (id)
{
	var ret = prompt ("כדי לאשר מחיקה זו, רשום בתיבה את המילה DELETE", "")
	if (ret != null && ret == "DELETE")
	{
		window.location='/forum/?confirmdelete='+id;
	}
	else
	{
		window.location='/forum/';
	}
}
function open_box (id)
{
	var box = document.getElementById('post_'+id);
	if (box.style.display == "")
	{
		box.style.display='block';
	}
	else if (box.style.display=='block')
	{
		box.style.display='none';
	}
	else
	{
		box.style.display='block';
	}
}
function addbetterbutton (before, after, blank)
{
	var t = document.getElementById ('theText');
	if (t.selectionStart) ss = t.selectionStart; else ss = 0;
	if (t.selectionEnd) se = t.selectionEnd; else se = 0;
	if (ss == se)
	{
		var mid = blank;
		ret = t.value.slice (0, ss).concat (before+blank+after).concat (t.value.slice (ss, t.value.length));
	}
	else
	{
		var mid = t.value.slice (ss, se);
		ret = t.value.slice (0, ss).concat (before).concat (t.value.slice (ss, se)).concat (after).concat (t.value.slice (se, t.value.length));
	}
	t.value = ret;
	t.focus ();
	t.selectionStart = ss + before.length;
	t.selectionEnd = t.selectionStart + mid.length;
}