function boldThis(unit){
				var tb = document.getElementById(unit);
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  if (str=="") {alert("Please Select Text to Bold");}
				  else { sel.text="<strong>"+str+"</strong>";}
				}
				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, "<strong>", selection, "</strong>", after)
				}
				 tb.focus();

}

function italicsThis(unit){
				var tb = document.getElementById(unit);
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  if (str=="") {alert("Please Select Text to Italicize");}
				  else { sel.text="<em>"+str+"</em>";}
				}
				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, "<em>", selection, "</em>", after)
				}
				 tb.focus();

}

function underlineThis(unit){
				var tb = document.getElementById(unit);
				if (document.selection){
				  var str=document.selection.createRange().text;
				  var sel=document.selection.createRange();
				  if (str=="") {alert("Please Select Text to Underline");}
				  else {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();

}

function linkThis(unit, link){ 
		if (link == 0) {			
			var txt=prompt("URL for the link.","http://");
			var doclevel = document;
		}
		else {		  
			var txt= link;
			var doclevel = window.parent.document;
		}
			if (doclevel.selection){
				  var str=doclevel.selection.createRange().text;			
				  if (str=="") {alert("Please Select Text to Link to"); return false;}
			}
				var tb = doclevel.getElementById(unit);	   
				 var newWind=confirm("Open link in a new window?");				
			if (txt!=null) {
				
				if (newWind==true) {var newScreen = " target=\"_New\"";}
				else {var newScreen = "";}
				
				if (doclevel.selection){
				  var sel=doclevel.selection.createRange();
				  sel.text="<a href=\""+txt+"\""+newScreen+">"+str+"</a>";
				}
				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, "<a href=\""+txt+"\""+newScreen+">", selection, "</a>", after)
				}
				 tb.focus();
			}	 
}			 

function docThis(unit) {
	document.getElementById("doc"+unit).style.display = "block";
}  




function uploaddoc(unit) {											
}

function lineThis(from) {document.AddEntry.bcontent.focus(); document.AddEntry.bcontent.value += " <hr>"}
