﻿<!--
function clearDefault(el) {
   if (el.defaultValue == el.value) el.value = ""
}

function bold(box){
	var $tb = document.getElementById(box);
		if (document.selection){
			var str=document.selection.createRange().text;
			var sel=document.selection.createRange();
			if (str.length != 0){
				sel.text="<b>"+str+"</b>";
			}
		}
		else if (typeof $tb.selectionStart != 'undefined'){
			var $before, $after, $selection;
			$before= $tb.value.substring(0, $tb.selectionStart)
			$selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
			$after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			$tb.value= String.concat($before, "<b>", $selection, "</b>", $after)
		}
	$tb.focus();
}

function bullet(box){
	var $tb = document.getElementById(box);
		if (document.selection){
			var str=document.selection.createRange().text;
			var sel=document.selection.createRange();
			if (str.length != 0){
				str = str.replace(new RegExp( "\\n", "g" ), "</li><li>" );
				sel.text="<ul><li>"+str+"</li></ul>";
			}
		}else if (typeof $tb.selectionStart != 'undefined'){
			var $before, $after, $selection;
			$before= $tb.value.substring(0, $tb.selectionStart)
			$selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
			$after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			$selection = $selection.replace(new RegExp( "\\n", "g" ), "</li>\n<li>" );
			$tb.value= String.concat($before, "<ul><li>", $selection, "</li></ul>", $after)
		}
	$tb.focus();
}

function underline(box){
	var $tb = document.getElementById(box);
		if (document.selection){
			var str=document.selection.createRange().text;
			var sel=document.selection.createRange();
			if (str.length != 0){
				sel.text="<u>"+str+"</u>";
			}
		}else if (typeof $tb.selectionStart != 'undefined'){
			var $before, $after, $selection;
			$before= $tb.value.substring(0, $tb.selectionStart)
			$selection = $tb.value.substring($tb.selectionStart, $tb.selectionEnd)
			$after = $tb.value.substring($tb.selectionEnd, $tb.value.length)
			$tb.value= String.concat($before, "<u>", $selection, "</u>", $after)
		}
	$tb.focus();
}

// -->