/**
  @param        textObj could be a text area or a text field
                        Only required for IE
*/
function setCaret (textObj) {
  if (textObj.createTextRange) {
    textObj.caretPos = document.selection.createRange().duplicate();
  }
}


function InsertText(inputId, strText)
{
textObj = document.getElementById(inputId);
textFeildValue = strText;
	//implementat
	 if(document.all){  
     if (textObj.createTextRange && textObj.caretPos) {
       var caretPos = textObj.caretPos;
       caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?textFeildValue + ' ' : textFeildValue;
     }else{
       textObj.value  = textFeildValue;
     }
  }else{
    if(textObj.setSelectionRange){
      var rangeStart = textObj.selectionStart;
      var rangeEnd   = textObj.selectionEnd;
      var tempStr1 = textObj.value.substring(0,rangeStart);
      var tempStr2 = textObj.value.substring(rangeEnd);
      textObj.value = tempStr1 + textFeildValue + tempStr2;
    }else{
      alert("This version of Mozilla based browser does not support setSelectionRange");
    }
  }
}


Color = new Array (11);
Color[1] = "argintiu";
Color[2] = "albastru";
Color[3] = "bleu";
Color[4] = "auriu";
Color[5] = "mov";
Color[6] = "maro";
Color[7] = "negru";
Color[8] = "portocaliu";
Color[9] = "roz";
Color[10] = "verde";
Color[11] = "visiniu";


function changeColor(textColor,indexColor)   {
	Index = indexColor + 1;
    document.getElementById('imageColor').setAttribute('src','img_misc/' + Color[Index]+".png");
}




Font = new Array (13);
Font[1]  = "Adorable";
Font[2]  = "AlexeiCopperlate";
Font[3]  = "AmazoneBT";
Font[4]  = "BlackChancery";
Font[5]  = "Dauphin";
Font[6]  = "EnglischeSchT";
Font[7]  = "English111_Vivace_BT";
Font[8]  = "Harrington";
Font[9]  = "Lucida_Handwriting";
Font[10] = "Murray";
Font[11] = "President";
Font[12] = "TypoUpright_BT";
Font[13] = "Wellsley";

function changeFont(textFont,indexFont){
		Index = indexFont + 1;
		document.getElementById('imageFont').setAttribute('src','img_misc/FontTypes/' + Font[Index] + ".png");
}



