function setTag(inizio,fine)
{
  //se usa IE
  if (document.selection) 
  {
    document.form1.txtcomment.focus();  //txtcomment è la texttxtcomment
    selText = document.selection.createRange();
    selText.text = inizio+document.selection.createRange().text+fine;
	document.form1.txtcomment.focus();
  }
  //MOZILLA/NETSCAPE
  else if (document.form1.txtcomment.selectionStart || document.form1.txtcomment.selectionStart == "0")
  {
    var startPos = document.form1.txtcomment.selectionStart;  //txtcomment è la texttxtcomment
    var endPos = document.form1.txtcomment.selectionEnd;
    var testo = document.form1.txtcomment.value;
	document.form1.txtcomment.value=testo.substring(0, startPos) + inizio + testo.substring(startPos,endPos) + fine + testo.substring(endPos, testo.length);
  	document.form1.txtcomment.focus();
  }
  else     //in caso di browser ignoto i tag vengono aggiunti alla fine
  {
    txtcomment.value = txtcomment.value + inizio + fine;
	document.form1.txtcomment.focus();
  }
  CheckLength();
}
