function insertAtCursor(Field, tag, Return_select) 
	{
	//IE support
	if (document.selection) 
		{
		Field.focus();
		var sel = document.selection.createRange();
		if(sel.text == "")
			{
			sel.text = "["+tag+"] [/"+tag+"]";
			}
		else
			{
			sel.text = "["+tag+"]"+sel.text+"[/"+tag+"]";
			}
		}

	//MOZILLA/NETSCAPE support

	else if (Field.selectionStart || Field.selectionStart == '0') 
		{ 
		var startPos = Field.selectionStart; 
		var endPos = Field.selectionEnd; 
		
		if (typeof Field.selectionStart != 'undefined') //เพื่อทำการ select text ใน textarea
			{
			var xxx = Field.value.substring(Field.selectionStart, Field.selectionEnd);
			Field.value = Field.value.substring(0, startPos)+ "["+tag+"]" + xxx + "[/"+tag+"]" + Field.value.substring(endPos, Field.value.length); 
			} 
		else 
			{ 
			Field.value += "["+tag+"] [/"+tag+"]"; 
			} 
		}
	Return_select.selectedIndex='0';
	} 
function formatEmo(Field, tag)
		{ 
		//IE support
		if (document.selection) 
			{
			Field.focus();
			var sel = document.selection.createRange();

			sel.text = " ["+tag+"]";

			}

	//MOZILLA/NETSCAPE support

		else if (Field.selectionStart || Field.selectionStart == '0') 
			{ 
			var startPos = Field.selectionStart; 
			var endPos = Field.selectionEnd; 
		
			if (typeof Field.selectionStart != 'undefined') //เพื่อทำการ select text ใน textarea
				{
				var xxx = Field.value.substring(Field.selectionStart, Field.selectionEnd);
				Field.value = Field.value.substring(0, startPos)+ " ["+tag+"]" + xxx + "" + Field.value.substring(endPos, Field.value.length); 
				} 
			else 
				{ 
				Field.value += " ["+tag+"]"; 
				}
			}
		}
function insertPicture(Field, tag) //INSERT IMG TAG ///////////////////////////////////////////////
	{
	//IE support
	if (document.selection) 
		{
		Field.focus();
		var sel = document.selection.createRange();
		if(sel.text == "")
			{
			sel.text = "["+tag+"] [/img]";
			}
		else
			{
			sel.text = "["+tag+"]"+sel.text+"[/img]";
			}
		}

	//MOZILLA/NETSCAPE support

	else if (Field.selectionStart || Field.selectionStart == '0') 
		{ 
		var startPos = Field.selectionStart; 
		var endPos = Field.selectionEnd; 
		
		if (typeof Field.selectionStart != 'undefined') //เพื่อทำการ select text ใน textarea
			{
			var xxx = Field.value.substring(Field.selectionStart, Field.selectionEnd);
			Field.value = Field.value.substring(0, startPos)+ "["+tag+"]"+xxx+"[/img]" + Field.value.substring(endPos, Field.value.length); 
			} 
		else 
			{ 
			Field.value += "["+tag+"] [/img]"; 
			} 
		} 
	
	} 