var Quote = 0;
var Bold  = 0;
var Code = 0;
var Center = 0;

function commentWrite(NewCode) {
document.ubb.content.value+=NewCode;
document.ubb.content.focus();
return;
}function AddText(text) {
	if (document.ubb.content.createTextRange && document.ubb.content.caretPos) {      
		var caretPos = document.ubb.content.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.ubb.content.value += text;
	document.ubb.content.focus(caretPos);
}
function inputs(str)
{
AddText(str);
}
function Curl() {
fontbegin="[URL]";
fontend="[/URL]";
fontchuli();
}
function Cimage() {
fontbegin="[img]";
fontend="[/img]";
fontchuli();
}
function Cflash() {
fontbegin="[Flash]";
fontend="[/Flash]";
fontchuli();
}
function Cbold() {
fontbegin="[B]";
fontend="[/B]";
fontchuli();
}
function Ccenter() {
fontbegin="[center]";
fontend="[/center]";
fontchuli();
}
function Cnotice() {
fontbegin="[img]http://www.shandongzikao.com/images/Notice.gif";
fontend="[/img]";
fontchuli();
}

function paste(text) {
	if (opener.document.ubb.content.createTextRange && opener.document.ubb.content.caretPos) {      
		var caretPos = opener.document.ubb.content.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else opener.document.ubb.content.value += text;
	opener.document.ubb.content.focus(caretPos);
}

function showcolor(color){
fontbegin="[color="+color+"]";
fontend="[/color]";
fontchuli();
}

function fontchuli(){
if ((document.selection)&&(document.selection.type == "Text")) {
var range = document.selection.createRange();
var ch_text=range.text;
range.text = fontbegin + ch_text + fontend;
} 
else {
//document.ubb.content.value=fontbegin+document.ubb.content.value+fontend;
document.ubb.content.value=fontbegin+fontend+document.ubb.content.value;
document.ubb.content.focus();
}
}

//多媒体播放
var MediaTemp=new Array()
function MediaShow(strType,strID,strURL,intWidth,intHeight)
{
	var tmpstr
	if (MediaTemp[strID]==undefined) MediaTemp[strID]=false; else MediaTemp[strID]=!MediaTemp[strID];
	if(MediaTemp[strID]){
			if ( document.all )	{
	         	document.getElementById(strID).outerHTML = '<div id="'+strID+'"></div>'
			}
			else
			{
	         	document.getElementById(strID).innerHTML = ''
			}

		document.images[strID+"_img"].src="../../images/mm_snd.gif" 		
		document.getElementById(strID+"_text").innerHTML="在线播放"	
	}else{
		document.images[strID+"_img"].src="../../images/mm_snd_stop.gif" 		
		document.getElementById(strID+"_text").innerHTML="关闭在线播放"
				tmpstr='<div style="height:6px;overflow:hidden"></div><object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+intWidth+'" height="'+intHeight+'"><param name="movie" value="'+strURL+'" /><param name="quality" value="high" /><param name="AllowScriptAccess" value="never" /><embed src="'+strURL+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+intWidth+'" height="'+intHeight+'" /></object>';
		document.getElementById(strID).innerHTML = tmpstr;
	}
		document.getElementById(strID+"_href").blur()
}
