﻿// JavaScript Document
function $(obj){return document.getElementById(obj);}

function setDisplay(obj, b){
	var Obj = $(obj);
	if (Obj){Obj.style.display = b;}
}

function hidden_face(){
	setDisplay("img_div", "none");
}
function ShowEmot(obj){
	var str = "";
	var div = $('img_div');
	if(div == null){
		div1 = document.createElement("div");
		div1.id = "img_div";
		div1.className = "ShowEmot";
		div1.style.position = "absolute";
		for(i = 0; i <= 104; i++){
			str += "<img src=\"Images/Faces/"+i+".gif\" class=\"Emot\" onclick=\"javascript:InsertEmot("+i+");\" alt=\"\" />";
		}
		str += "<a href=\"javascript:void(0);\" onclick=\"javascript:hidden_face();return false;\" title=\"关闭表情\">&nbsp;Close</a>";
		div1.innerHTML = str;
		obj.parentNode.appendChild(div1);
	}else{
		div.style.display="block";
	}
}

function InsertEmot(Pic){
	$("log_Content").value+="[Pic"+Pic+"]";
	hidden_face();
	$("log_Content").focus();
}

function innerUBB(){
	$("log_Content").value = fontbegin + $("log_Content").value + fontend;
	$("log_Content").focus();
}

function Bold(){
	fontbegin = "[B]";
	fontend = "[/B]";
	innerUBB();
}

function Italic(){
	fontbegin = "[I]";
	fontend = "[/I]";
	innerUBB();
}

function Underline(){
	fontbegin = "[U]";
	fontend = "[/U]";
	innerUBB();
}

document.write("<img onclick=\"Bold()\" title=\"粗体字\" src=\"Images/u_1.gif\" align=\"absmiddle\" alt=\"\" />");
document.write("&nbsp;<img onclick=\"Italic()\" title=\"斜体字\" src=\"Images/u_2.gif\" align=\"absmiddle\" alt=\"\" />");
document.write("&nbsp;<img onclick=\"Underline()\" title=\"下划线\" src=\"Images/u_3.gif\" align=\"absmiddle\" alt=\"\" />");
document.write("&nbsp;<img onclick=\"ShowEmot(this);return false;\" title=\"表情\" src=\"Images/u_4.gif\" align=\"absmiddle\" alt=\"\" />");