//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();
}


// 在当前文档位置插入.
function insertHTML(html) {
 
	if ( document.getElementById("message").contentWindow.document.selection.type.toLowerCase() != "none"){
		 document.getElementById("message").contentWindow.document.selection.clear() ;
	}
	 document.getElementById("message").contentWindow.document.selection.createRange().pasteHTML(html) ; 
}

//Function to open preview post window
function FormatTextWiki(command){
	
 
   	var sel = document.getElementById("message").contentWindow.document.selection.createRange();
    insertHTML("<a rel='wiki' href='wiki'><font color=blue>" + sel.text + "</font></a>");
    
	//document.getElementById("message").contentWindow.document.execCommand("InsertImage", false, imagePath);
 
     
}

