// Function to get selected html
var selHTML;
function CopySel(){
	selHTML = '';
	if (document.getSelection) selHTML = document.getSelection()
		else if (window.getSelection) selHTML = window.getSelection()
     		else if (document.selection) selHTML = document.selection.createRange().htmlText;
}

//Function to do quote
function DoQuote(uName) {
	var oIframe = document.getElementById("message");
	if (oIframe.contentWindow) oIframe = oIframe.contentWindow;
	if (oIframe.value == undefined) {
		oIframe.focus();
		oIframe.document.body.innerHTML += '[QUOTE=' + uName + ']' + selHTML + '[/QUOTE]';
	} else {
		oIframe.value += '[QUOTE=' + uName + ']' + selHTML + '[/QUOTE]';
	}

}

//Function to jump to another forum
function ForumJump(URL) {

	if (URL.options[URL.selectedIndex].value != "") self.location.href = URL.options[URL.selectedIndex].value;
	return true;
}

//Function to open pop up window
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}


//Function to open preview post window
function OpenPreviewWindow(targetPage, formName){

	now = new Date

	//Open the window first
   	openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')

   	//Now submit form to the new window
   	formName.action = targetPage + "?ID=" + now.getTime();
	formName.target = "preview";
	formName.submit();
}