graems = null;
previewindow = null;
function Graems () {
	graems = window.open(
		"http://forums.tubal-reversal.net/cgi-bin/ultimatebb.cgi?ubb=graemlin_list",
		"graems",
		"width=250,height=240,toolbar=no,location=no,directories=no,status,menubar=no,scrollbars,resizable,copyhistory=no"
		);
	graems.focus();
} // end

function Preview () {

	var user_cookie = getCookie('ubber2452300.1438');
	if( ('' == user_cookie) || (null == user_cookie) ) {
		alert("Sorry, you must be registered and logged in to preview your post.");
		return true;
	}

	previewindow = window.open(
		"http://forums.tubal-reversal.net/cgi-bin/ultimatebb.cgi?ubb=preview_post;f=1;type=reply;quick=1",
		"preview",
		"width=550,height=300,toolbar=no,location=no,directories=no,status,menubar=no,scrollbars,resizable,copyhistory=no"
		);
	previewindow.focus();
} // end

function storeCaret (textEl) {
	if (textEl.createTextRange) {
		textEl.caretPos = document.selection.createRange().duplicate();
	} // end if
} // end storeCaret

function insertAtCaret (textEl, text) {
	if (textEl.createTextRange && textEl.caretPos) {
		// MSIE
		var caretPos = textEl.caretPos;
		caretPos.text =
			caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
			text + ' ' : text;
	} else if(textEl.selectionStart && textEl.setSelectionRange) {
		// Mozilla 1.3+
		var val = textEl.value;
		var cpos = textEl.selectionStart;
		var fpos = cpos + text.length;

		var before = val.substr(0,cpos);
		var after = val.substr(cpos, val.length);
		var aspace = after.charAt(0) == ' ' ? "" : " ";
		var bspace = before.charAt(before.length) == ' ' ? "" : " ";

		textEl.value = before + bspace + text + aspace + after;
		textEl.setSelectionRange(fpos,fpos); // set cursor pos to end of text
		textEl.focus();
	} else {
		textEl.value  = textEl.value + text; // otherwise just append
	}

	return true;
} // end insertAtCaret// JavaScript Document