// JavaScript Document
<!--
function insertFace( objID, smileface )
{
	document.all(objID).value += smileface;
}

function insertFFString( ubbtype )
{
	var endString;
	var selContent;
	if ( ubbtype != "images" )
		selContent = prompt("请输入文字：", "文字");
	
	switch( ubbtype )
	{
		case "link":
			var theurl = prompt("请输入网址：", "http://");
			endString = "[url=" + theurl + "]" + selContent + " [/url]";
			break;
		case "size":
			var thesize = prompt("请输入字体大小：", "4");
			endString = "[size=" + thesize + "]" + selContent + "[/size]";
			break;
		case "bold":
			endString = "[b]" + selContent + "[/b]";
			break;
		case "ital":
			endString = "[i]" + selContent + "[/i]";
			break;
		case "underline":
			endString = "[u]" + selContent + "[/u]";
			break;
		case "color":
			var theColor	= prompt("请输入字体颜色：\n(红：red；绿：green；蓝：blue；等)", "red");
			endString = "[color=" + theColor + "]" + selContent + "[/color]";
			break;
		case "font":
			endString = "[font=宋体]" + selContent + "[/font]";
			break;
		case "quote":
			endString = "[quote]" + selContent + "[/quote]";
			break;
		case "sup":
			endString = "[sup]" + selContent + "[/sup]";
			break;
		case "sub":
			endString = "[sub]" + selContent + "[/sub]";
			break;
		case "images":
			var imgUrl 	= prompt("请输入图片网址：", "http://");
			endString   = "[img]" + imgUrl + "[/img]";
			break;
	}
	return endString;
}

function insertIEString( ubbtype, selContent )
{
	var endString;
	switch( ubbtype )
	{
		case "link":
			var theurl 		= prompt("请输入网址：", "http://");
			endString 		= "[url=" + theurl + "] " + selContent + " [/url]";
			break;
		case "size":
			var thesize = prompt("请输入字体大小：", "4");
			endString = "[size=" + thesize + "]" + selContent + "[/size]";
			break;
		case "bold":
			endString = "[b]" + selContent + "[/b]";
			break;
		case "ital":
			endString = "[i]" + selContent + "[/i]";
			break;
		case "underline":
			endString = "[u]" + selContent + "[/u]";
			break;
		case "color":
			var theColor	= prompt("请输入字体颜色：\n(红：red；绿：green；蓝：blue；等)", "red");
			endString = "[color=" + theColor + "]" + selContent + "[/color]";
			break;
		case "font":
			endString = "[font=宋体]" + selContent + "[/font]";
			break;
		case "quote":
			endString = "[quote]" + selContent + "[/quote]";
			break;
		case "sup":
			endString = "[sup]" + selContent + "[/sup]";
			break;
		case "sub":
			endString = "[sub]" + selContent + "[/sub]";
			break;
		case "images":
			var imgUrl 	= prompt("请输入图片网址：", "http://");
			endString   = "[img]" + imgUrl + "[/img]";
			break;
	}
	return endString;
}

function insertUBB( objID, ubbtype )
{
	var selContent;
	if ( window.getSelection ) // FF
	{
		document.getElementById(objID).value += insertFFString( ubbtype );
	}
	else if ( document.getSelection ) // Opera
	{
		document.getElementById(objID).focus();
		document.getElementById(objID).document.selection.createRange().text = insertFFString( ubbtype );
	}
	else if ( document.selection ) // IE
	{
		selContent = document.selection.createRange().text;
		document.getElementById(objID).focus();
		document.getElementById(objID).document.selection.createRange().text = insertIEString( ubbtype, selContent );
	}
}

function ShowOrHideSearchBar( SetState )
{
	if( SetState )
	{
		document.getElementById("SearchBar").style.display="";
		document.getElementById("btnShowSearchBar").style.display="none";
		document.getElementById("btnHideSearchBar").style.display="";
	}
	else
	{
		document.getElementById("SearchBar").style.display="none";
		document.getElementById("btnShowSearchBar").style.display="";
		document.getElementById("btnHideSearchBar").style.display="none";
	}
}

function ShowHideArea( ObjID )
{
	try
	{
		var Obj = document.getElementById(ObjID);
		if( Obj.style.display == "" )
		{
			Obj.style.display = "none";
		}
		else
		{
			Obj.style.display = "";
		}
	}
	catch(err)
	{}
}

function DrawImage(ImgD)
{
	var image = new Image();
	var w = 550;
	var h = 350;
	image.src=ImgD.src;
	
	if(image.width>0 && image.height>0)
	{
		flag=true;
		if(image.width/image.height>= w/h)
		{
			if(image.width>w)
			{
				ImgD.width=w;
				ImgD.height=(image.height*w)/image.width;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			//ImgD.alt=image.width+"×"+image.height;
		}
		else
		{
			if(image.height>h)
			{
				ImgD.height=h;
				ImgD.width=(image.width*h)/image.height;
			}
			else
			{
				ImgD.width=image.width;
				ImgD.height=image.height;
			}
			//ImgD.alt=image.width+"×"+image.height;
		}
	}
}
//-->
