

Ubb = function()
	{
		this.Insert = function(Form, Element, Begin, Eind)
			{
				var Obj = document.forms[Form].elements[Element];

				if(Obj != null)
					{
						var ScrollNu	= (!isNaN(parseInt(Obj.scrollTop))) ? Obj.scrollTop : 0;
						if(typeof(Eind) != "string")
							{
								var Eind	= Begin;
								var Begin	= '';
							};
		
						if(Obj.createTextRange)
							{
								Obj.focus();
								document.selection.createRange().text = Begin + document.selection.createRange().text + Eind;
								document.selection.createRange().select();
							}
						else if(Obj.selectionStart || Obj.selectionStart == 0)
							{
								SelectieStart	= Obj.selectionStart;
								SelectieEind	= Obj.selectionEnd;
								Obj.value		= Obj.value.substring(0, SelectieStart) + Begin + Obj.value.substring(SelectieStart, SelectieEind) + Eind + Obj.value.substring(SelectieEind, Obj.value.length);
								if(Begin.length > 0)
									{
										Obj.selectionStart	= SelectieStart;
										Obj.selectionEnd	= SelectieEind + Begin.length + Eind.length;
									}
								else
									{
										Obj.selectionStart	= SelectieStart + SelectieStart.length + SelectieEind.length;
										Obj.selectionEnd	= Obj.selectionStart;
									}
								Obj.focus();
							}
						else
							{
								Obj.value = Obj.value + Begin + Eind;
							}
						Obj.scrollTop = ScrollNu;
					}
			}
	}

$Ubb = new Ubb();
