 var inTextEl = null;

 //-------------------------------------------------------------------------------------
 //stores the carte Position
 function storeCaret (textEl) {
   	   inTextEl = textEl;
	   textEl.focus();	
       if (textEl.createTextRange) 
	   		textEl.caretPos = document.selection.createRange().duplicate();
	   else	
	        textEl.caretPos = 0;

	   
  	   inTextEl = textEl;
 }

 //-------------------------------------------------------------------------------------
 //inserts Text at the caret Position
 function insertAtCaret (textEl, text) {
 	   if (textEl==null){
	   	textEl=inTextEl;
	   }
	   
	   if (textEl==null){
	   	return;
	   }
	   
       if (textEl.createTextRange && textEl.caretPos) {
         var caretPos = textEl.caretPos;
           caretPos.text = 
		     caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
             text + ' ' : text;
       }
       else
         textEl.value  = text;

	   textEl.focus();
 }

 //-------------------------------------------------------------------------------------
 //disable/enables all/button Form Elements in the give Form on the given page
 function disableForms(win, formName, dis, all) {
	var obj = eval('win.document.forms.'+formName);

	for (var i=0;i<obj.length;i++){
		if ((all)||(obj.elements[i].type=="button")||(obj.elements[i].type=="submit")||(obj.elements[i].type=="reset")){
			obj.elements[i].disabled=dis;
		}
	}
 }
 
 
 function NewImage(ImgName, FlName, win) {
///////////////////////////////////////		
	if (win==null) { win=window}
	win.document.images[ImgName].src = FlName;
}

