﻿function TxtBoxStyle(textId, StyleType)
    {
	    TxtValue = document.getElementById(textId).value;
	    theSelection = document.selection.createRange().text;
	    if (TxtValue.indexOf(theSelection) != -1 && theSelection != '')
	    {
		    document.selection.createRange().text = '<' + StyleType + '>' + theSelection + '</' + StyleType + '>';
		    document.getElementById(textId).focus();
	    }
    }

    function TxtBoxLink(textId)
    {
    		
	    TxtValue = document.getElementById(textId).value;
	    theSelection = document.selection.createRange().text;
	    if (TxtValue.indexOf(theSelection) != -1 && theSelection != '')
	    {
		    link_url = prompt('URL:','http://');
		    if (link_url != '' && link_url !='http://' && link_url)
		    {						
			    document.selection.createRange().text = '<A id="link" TARGET="_blank" HREF="' + link_url + '">' + theSelection + '</A>';
			    document.getElementById(textId).focus();
		    }
	    }						
    }