function checkForm(){
	if ($('topic').value==""){
		$('error').innerHTML = '<font color=#ff0000><b>请输入标题！</b></font>';
		$('topic').focus();
		return false;
	}
	if ($('forum').value=="-"){
		$('error').innerHTML = '<font color=#ff0000><b>选择版块！</b></font>';
		$('forum').focus();
		return false;
	}
	
	if ($('mainText').value==""){
		$('error').innerHTML = '<font color=#ff0000><b>请输入内容！</b></font>';
		$('mainText').focus();
		return false;
	}
}

function tc116AddB(){
	$('mainText').focus();
    
	if (document.selection){
		if(document.selection.type == "Text") {
			document.selection.createRange().text = '[b]' + document.selection.createRange().text + '[/b]';
		}else{
			document.selection.createRange().text = '[b][/b]';			
		}
    }else{
        $('mainText').value=$('mainText').value+'[b][/b]';
    }
}

function tc116AddU(){
	$('mainText').focus();
    
	if (document.selection){
		if(document.selection.type == "Text") {
			document.selection.createRange().text = '[u]' + document.selection.createRange().text + '[/u]';
		}else{
			document.selection.createRange().text = '[u][/u]';			
		}
    }else{
        $('mainText').value=$('mainText').value+'[u][/u]';
    }
}


function tc116AddI(){
	$('mainText').focus();
	
	if (document.selection){
		if(document.selection.type == "Text") {
			document.selection.createRange().text = '[i]' + document.selection.createRange().text + '[/i]';
		}else{
			document.selection.createRange().text = '[i][/i]';			
		}
    }else{
        $('mainText').value=$('mainText').value+'[i][/i]';
    }
}

function tc116ToLink(){
	$('mainText').focus();
	
	var location = prompt("请输入您要连接的地址：","http://");
	if(!location) return true;

    if(document.selection){
		if(document.selection.type == "Text"){
			document.selection.createRange().text = '[url='+location+']' + document.selection.createRange().text + '[/url]';
		}else{
			var info = prompt("请输入连接文字：","");
			document.selection.createRange().text = "[url="+location+"]"+info+"[/url]";
		}
	}else{
		var info = prompt("请输入连接文字：","");
		$('mainText').value = $('mainText').value+"[url="+location+"]"+info+"[/url]";
    }
}


function tc116MakeCenter(){
	$('mainText').focus();

	if (document.selection){
		if(document.selection.type == "Text") {
			document.selection.createRange().text = '[center]' + document.selection.createRange().text + '[/center]';
		}else{
			document.selection.createRange().text = '[center][/center]';			
		}
    }else{
        $('mainText').value=$('mainText').value+'[center][/center]';
    }
}


function showColorList(show){
	if(show){
		$("colorList").style.display = "block";
	}else{
		$("colorList").style.display = "none";
	}
}

function tc116ChangeColor(color){
	$('mainText').focus();
	
    if (document.selection) {
		if(document.selection.type == "Text"){
			document.selection.createRange().text = '[color='+color+']' + document.selection.createRange().text + '[/color]';
		}else{
			document.selection.createRange().text = '[color='+color+'][/color]';
		}
    }else{
        $('mainText').value=$('mainText').value+'[color='+color+'][/color]';
    }
}

function showSizeList(show){
	if(show){
		$("sizeList").style.display = "block";
	}else{
		$("sizeList").style.display = "none";
	}
}

function tc116ChangeSize(size){
	$('mainText').focus();
	
    if(document.selection){
		if(document.selection.type == "Text"){
			document.selection.createRange().text = '[size='+size+']' + document.selection.createRange().text + '[/size]';
		}else{
			document.selection.createRange().text = '[size='+size+'][/size]';
		}
    }else{
        $('mainText').value=$('mainText').value+'[size='+size+'][/size]';
    }
}

function tc116AddImage(){
	$('mainText').focus();
	var location = prompt("请输入图片的地址：","http://");
	
	if (location){
		if(document.selection) {
			document.selection.createRange().text = "[img]"+location+"[/img]";
		}else{
			$('mainText').value = $('mainText').value+"[img]"+location+"[/img]";
		}
    }
}

function tc116AddFlash(){
	$('mainText').focus();
	var location = prompt("请输入Flash的地址：","http://");

	if (location){
		if(document.selection) {
			document.selection.createRange().text = "[flash]"+location+"[/flash]";
		}else{
			$('mainText').value = $('mainText').value+"[flash]"+location+"[/flash]";
		}
    }
}

function tc116AddMp3(){
	$('mainText').focus();
	var location = prompt("请输入音频文件地址：","http://");
	
	if(location){
		if(document.selection){
			document.selection.createRange().text = "[mp3]"+location+"[/mp3]";
		}else{
			$('mainText').value = $('mainText').value+"[mp3]"+location+"[/mp3]";
		}
	}
}

function tc116AddMp4(){
	$('mainText').focus();
	var location = prompt("请输入视频文件地址：","http://");
	
	if(location){
		if(document.selection){
			document.selection.createRange().text = "[mtv]"+location+"[/mtv]";
		}else{
			$('mainText').value = $('mainText').value+"[mtv]"+location+"[/mtv]";
		}
	}
}


function addUpImage(){
	if($('copyDiv').children.length < 3)
		$('copyDiv').appendChild($('up').cloneNode(true));
}