Zamiana skryptu edytora z editArea na CodeMirror.
[redakcja.git] / project / static / js / edit_area_functions.js
diff --git a/project/static/js/edit_area_functions.js b/project/static/js/edit_area_functions.js
deleted file mode 100755 (executable)
index 984d4c6..0000000
+++ /dev/null
@@ -1,1203 +0,0 @@
-       //replace tabulation by the good number of white spaces\r
-       EditArea.prototype.replace_tab= function(text){\r
-               return text.replace(/((\n?)([^\t\n]*)\t)/gi, editArea.smartTab);                // slower than simple replace...        \r
-       };\r
-       \r
-       // call by the replace_tab function\r
-       EditArea.prototype.smartTab= function(){\r
-               val="                   ";\r
-               return EditArea.prototype.smartTab.arguments[2] + EditArea.prototype.smartTab.arguments[3] + val.substr(0, editArea.tab_nb_char - (EditArea.prototype.smartTab.arguments[3].length)%editArea.tab_nb_char);\r
-       };\r
-       \r
-       EditArea.prototype.show_waiting_screen= function(){\r
-               width   = this.editor_area.offsetWidth;\r
-               height  = this.editor_area.offsetHeight;\r
-               if( !(this.isIE && this.isIE<6) )\r
-               {\r
-                       width   -= 2;\r
-                       height  -= 2;\r
-               }\r
-               this.processing_screen.style.display= "block";\r
-               this.processing_screen.style.width      = width+"px";\r
-               this.processing_screen.style.height     = height+"px";\r
-               this.waiting_screen_displayed           = true;\r
-       };\r
-       \r
-       EditArea.prototype.hide_waiting_screen= function(){\r
-               this.processing_screen.style.display="none";\r
-               this.waiting_screen_displayed= false;\r
-       };\r
-       \r
-       EditArea.prototype.add_style= function(styles){\r
-               if(styles.length>0){\r
-                       newcss = document.createElement("style");\r
-                       newcss.type="text/css";\r
-                       newcss.media="all";\r
-                       if(newcss.styleSheet){ // IE\r
-                               newcss.styleSheet.cssText = styles;\r
-                       } else { // W3C\r
-                               newcss.appendChild(document.createTextNode(styles));\r
-                       }\r
-                       document.getElementsByTagName("head")[0].appendChild(newcss);\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.set_font= function(family, size){\r
-               var t=this, a=this.textarea, s=this.settings, elem_font, i, elem;\r
-               // list all elements concerned by font changes\r
-               var elems= ["textarea", "content_highlight", "cursor_pos", "end_bracket", "selection_field", "selection_field_text", "line_number"];\r
-               \r
-               if(family && family!="")\r
-                       s["font_family"]= family;\r
-               if(size && size>0)\r
-                       s["font_size"]  = size;\r
-               if( t.isOpera && t.isOpera < 9.6 )      // opera<9.6 can't manage non monospace font\r
-                       s['font_family']="monospace";\r
-                       \r
-               // update the select tag\r
-               if( elem_font = _$("area_font_size") )\r
-               {       \r
-                       for( i = 0; i < elem_font.length; i++ )\r
-                       {\r
-                               if( elem_font.options[i].value && elem_font.options[i].value == s["font_size"] )\r
-                                       elem_font.options[i].selected=true;\r
-                       }\r
-               }\r
-               \r
-               /*\r
-                * somethimes firefox has rendering mistake with non-monospace font for text width in textarea vs in div for changing font size (eg: verdana change between 11pt to 12pt)\r
-                * => looks like a browser internal random bug as text width can change while content_highlight is updated\r
-                * we'll check if the font-size produce the same text width inside textarea and div and if not, we'll increment the font-size\r
-                * \r
-                * This is an ugly fix \r
-                */ \r
-               if( t.isFirefox )\r
-               {\r
-                       var nbTry = 3;\r
-                       do {\r
-                               var div1 = document.createElement( 'div' ), text1 = document.createElement( 'textarea' );\r
-                               var styles = {\r
-                                       width:          '40px',\r
-                                       overflow:       'scroll',\r
-                                       zIndex:         50,\r
-                                       visibility:     'hidden',\r
-                                       fontFamily:     s["font_family"],\r
-                                       fontSize:       s["font_size"]+"pt",\r
-                                       lineHeight:     t.lineHeight+"px",\r
-                                       padding:        '0',\r
-                                       margin:         '0',\r
-                                       border:         'none',\r
-                                       whiteSpace:     'nowrap'\r
-                               };\r
-                               var diff, changed = false;\r
-                               for( i in styles )\r
-                               {\r
-                                       div1.style[ i ]         = styles[i];\r
-                                       text1.style[ i ]        = styles[i];\r
-                               }\r
-                               // no wrap for this text\r
-                               text1.wrap = 'off';\r
-                               text1.setAttribute('wrap', 'off');\r
-                               t.container.appendChild( div1 );\r
-                               t.container.appendChild( text1 );\r
-                               // try to make FF to bug\r
-                               div1.innerHTML          = text1.value   = 'azertyuiopqsdfghjklm';\r
-                               div1.innerHTML          = text1.value   = text1.value+'wxcvbn^p*รน$!:;,,';\r
-                               diff    =  text1.scrollWidth - div1.scrollWidth;
-                               \r
-                               // firefox return here a diff of 1 px between equals scrollWidth (can't explain)\r
-                               if( Math.abs( diff ) >= 2 )\r
-                               {\r
-                                       s["font_size"]++;\r
-                                       changed = true;\r
-                               }\r
-                               t.container.removeChild( div1 );\r
-                               t.container.removeChild( text1 );\r
-                               nbTry--;\r
-                       }while( changed && nbTry > 0 );\r
-               }\r
-               \r
-               \r
-               // calc line height\r
-               elem                                    = t.test_font_size;\r
-               elem.style.fontFamily   = ""+s["font_family"];\r
-               elem.style.fontSize             = s["font_size"]+"pt";                          \r
-               elem.innerHTML                  = "0";          \r
-               t.lineHeight                    = elem.offsetHeight;\r
-\r
-               // update font for all concerned elements\r
-               for( i=0; i<elems.length; i++)\r
-               {\r
-                       elem    = _$(elems[i]); \r
-                       elem.style.fontFamily   = s["font_family"];\r
-                       elem.style.fontSize             = s["font_size"]+"pt";\r
-                       elem.style.lineHeight   = t.lineHeight+"px";\r
-               }\r
-               // define a css for <pre> tags\r
-               t.add_style("pre{font-family:"+s["font_family"]+"}");\r
-               \r
-               // old opera and IE>=8 doesn't update font changes to the textarea\r
-               if( ( t.isOpera && t.isOpera < 9.6 ) || t.isIE >= 8 )\r
-               {\r
-                       var parNod = a.parentNode, nxtSib = a.nextSibling, start= a.selectionStart, end= a.selectionEnd;\r
-                       parNod.removeChild(a);\r
-                       parNod.insertBefore(a, nxtSib);\r
-                       t.area_select(start, end-start);\r
-               }\r
-               \r
-               // force update of selection field\r
-               this.focus();\r
-               this.update_size();\r
-               this.check_line_selection();\r
-       };\r
-       \r
-       EditArea.prototype.change_font_size= function(){\r
-               var size=_$("area_font_size").value;\r
-               if(size>0)\r
-                       this.set_font("", size);                        \r
-       };\r
-       \r
-       \r
-       EditArea.prototype.open_inline_popup= function(popup_id){\r
-               this.close_all_inline_popup();\r
-               var popup= _$(popup_id);                \r
-               var editor= _$("editor");\r
-               \r
-               // search matching icon\r
-               for(var i=0; i<this.inlinePopup.length; i++){\r
-                       if(this.inlinePopup[i]["popup_id"]==popup_id){\r
-                               var icon= _$(this.inlinePopup[i]["icon_id"]);\r
-                               if(icon){\r
-                                       this.switchClassSticky(icon, 'editAreaButtonSelected', true);                   \r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-               // check size\r
-               popup.style.height="auto";\r
-               popup.style.overflow= "visible";\r
-                       \r
-               if(document.body.offsetHeight< popup.offsetHeight){\r
-                       popup.style.height= (document.body.offsetHeight-10)+"px";\r
-                       popup.style.overflow= "auto";\r
-               }\r
-               \r
-               if(!popup.positionned){\r
-                       var new_left= editor.offsetWidth /2 - popup.offsetWidth /2;\r
-                       var new_top= editor.offsetHeight /2 - popup.offsetHeight /2;\r
-                       //var new_top= area.offsetHeight /2 - popup.offsetHeight /2;\r
-                       //var new_left= area.offsetWidth /2 - popup.offsetWidth /2;\r
-                       //alert("new_top: ("+new_top+") = calculeOffsetTop(area) ("+calculeOffsetTop(area)+") + area.offsetHeight /2("+ area.offsetHeight /2+") - popup.offsetHeight /2("+popup.offsetHeight /2+") - scrollTop: "+document.body.scrollTop);\r
-                       popup.style.left= new_left+"px";\r
-                       popup.style.top= new_top+"px";\r
-                       popup.positionned=true;\r
-               }\r
-               popup.style.visibility="visible";\r
-               \r
-               //popup.style.display="block";\r
-       };\r
-\r
-       EditArea.prototype.close_inline_popup= function(popup_id){\r
-               var popup= _$(popup_id);                \r
-               // search matching icon\r
-               for(var i=0; i<this.inlinePopup.length; i++){\r
-                       if(this.inlinePopup[i]["popup_id"]==popup_id){\r
-                               var icon= _$(this.inlinePopup[i]["icon_id"]);\r
-                               if(icon){\r
-                                       this.switchClassSticky(icon, 'editAreaButtonNormal', false);                    \r
-                                       break;\r
-                               }\r
-                       }\r
-               }\r
-               \r
-               popup.style.visibility="hidden";        \r
-       };\r
-       \r
-       EditArea.prototype.close_all_inline_popup= function(e){\r
-               for(var i=0; i<this.inlinePopup.length; i++){\r
-                       this.close_inline_popup(this.inlinePopup[i]["popup_id"]);               \r
-               }\r
-               this.textarea.focus();\r
-       };\r
-       \r
-       EditArea.prototype.show_help= function(){\r
-               \r
-               this.open_inline_popup("edit_area_help");\r
-               \r
-       };\r
-                       \r
-       EditArea.prototype.new_document= function(){\r
-               this.textarea.value="";\r
-               this.area_select(0,0);\r
-       };\r
-       \r
-       EditArea.prototype.get_all_toolbar_height= function(){\r
-               var area= _$("editor");\r
-               var results= parent.getChildren(area, "div", "class", "area_toolbar", "all", "0");      // search only direct children\r
-               //results= results.concat(getChildren(area, "table", "class", "area_toolbar", "all", "0"));\r
-               var height=0;\r
-               for(var i=0; i<results.length; i++){                    \r
-                       height+= results[i].offsetHeight;\r
-               }\r
-               //alert("toolbar height: "+height);\r
-               return height;\r
-       };\r
-       \r
-       EditArea.prototype.go_to_line= function(line){  \r
-               if(!line)\r
-               {       \r
-                       var icon= _$("go_to_line");\r
-                       if(icon != null){\r
-                               this.restoreClass(icon);\r
-                               this.switchClassSticky(icon, 'editAreaButtonSelected', true);\r
-                       }\r
-                       \r
-                       line= prompt(this.get_translation("go_to_line_prompt"));\r
-                       if(icon != null)\r
-                               this.switchClassSticky(icon, 'editAreaButtonNormal', false);\r
-               }\r
-               if(line && line!=null && line.search(/^[0-9]+$/)!=-1){\r
-                       var start=0;\r
-                       var lines= this.textarea.value.split("\n");\r
-                       if(line > lines.length)\r
-                               start= this.textarea.value.length;\r
-                       else{\r
-                               for(var i=0; i<Math.min(line-1, lines.length); i++)\r
-                                       start+= lines[i].length + 1;\r
-                       }\r
-                       this.area_select(start, 0);\r
-               }\r
-               \r
-               \r
-       };\r
-       \r
-       \r
-       EditArea.prototype.change_smooth_selection_mode= function(setTo){\r
-               //alert("setTo: "+setTo);\r
-               if(this.do_highlight)\r
-                       return;\r
-                       \r
-               if(setTo != null){\r
-                       if(setTo === false)\r
-                               this.smooth_selection=true;\r
-                       else\r
-                               this.smooth_selection=false;\r
-               }\r
-               var icon= _$("change_smooth_selection");\r
-               this.textarea.focus();\r
-               if(this.smooth_selection===true){\r
-                       //setAttribute(icon, "class", getAttribute(icon, "class").replace(/ selected/g, "") );\r
-                       /*setAttribute(icon, "oldClassName", "editAreaButtonNormal" );\r
-                       setAttribute(icon, "className", "editAreaButtonNormal" );*/\r
-                       //this.restoreClass(icon);\r
-                       //this.restoreAndSwitchClass(icon,'editAreaButtonNormal');\r
-                       this.switchClassSticky(icon, 'editAreaButtonNormal', false);\r
-                       \r
-                       this.smooth_selection=false;\r
-                       this.selection_field.style.display= "none";\r
-                       _$("cursor_pos").style.display= "none";\r
-                       _$("end_bracket").style.display= "none";\r
-               }else{\r
-                       //setAttribute(icon, "class", getAttribute(icon, "class") + " selected");\r
-                       //this.switchClass(icon,'editAreaButtonSelected');\r
-                       this.switchClassSticky(icon, 'editAreaButtonSelected', false);\r
-                       this.smooth_selection=true;\r
-                       this.selection_field.style.display= "block";\r
-                       _$("cursor_pos").style.display= "block";\r
-                       _$("end_bracket").style.display= "block";\r
-               }       \r
-       };\r
-       \r
-       // the auto scroll of the textarea has some lacks when it have to show cursor in the visible area when the textarea size change\r
-       // show specifiy whereas it is the "top" or "bottom" of the selection that is showned\r
-       EditArea.prototype.scroll_to_view= function(show){\r
-               var zone, lineElem;\r
-               if(!this.smooth_selection)\r
-                       return;\r
-               zone= _$("result");\r
-               \r
-               // manage height scroll\r
-               var cursor_pos_top= _$("cursor_pos").cursor_top;\r
-               if(show=="bottom")\r
-               {\r
-                       //cursor_pos_top+=  (this.last_selection["line_nb"]-1)* this.lineHeight;\r
-                       cursor_pos_top+= this.getLinePosTop( this.last_selection['line_start'] + this.last_selection['line_nb'] - 1 );\r
-               }\r
-                       \r
-               var max_height_visible= zone.clientHeight + zone.scrollTop;\r
-               var miss_top    = cursor_pos_top + this.lineHeight - max_height_visible;\r
-               if(miss_top>0){\r
-                       //alert(miss_top);\r
-                       zone.scrollTop=  zone.scrollTop + miss_top;\r
-               }else if( zone.scrollTop > cursor_pos_top){\r
-                       // when erase all the content -> does'nt scroll back to the top\r
-                       //alert("else: "+cursor_pos_top);\r
-                       zone.scrollTop= cursor_pos_top;  \r
-               }\r
-               \r
-               // manage left scroll\r
-               //var cursor_pos_left= parseInt(_$("cursor_pos").style.left.replace("px",""));\r
-               var cursor_pos_left= _$("cursor_pos").cursor_left;\r
-               var max_width_visible= zone.clientWidth + zone.scrollLeft;\r
-               var miss_left= cursor_pos_left + 10 - max_width_visible;\r
-               if(miss_left>0){                        \r
-                       zone.scrollLeft= zone.scrollLeft + miss_left + 50;\r
-               }else if( zone.scrollLeft > cursor_pos_left){\r
-                       zone.scrollLeft= cursor_pos_left ;\r
-               }else if( zone.scrollLeft == 45){\r
-                       // show the line numbers if textarea align to it's left\r
-                       zone.scrollLeft=0;\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.check_undo= function(only_once){\r
-               if(!editAreas[this.id])\r
-                       return false;\r
-               if(this.textareaFocused && editAreas[this.id]["displayed"]==true){\r
-                       var text=this.textarea.value;\r
-                       if(this.previous.length<=1)\r
-                               this.switchClassSticky(_$("undo"), 'editAreaButtonDisabled', true);\r
-               \r
-                       if(!this.previous[this.previous.length-1] || this.previous[this.previous.length-1]["text"] != text){\r
-                               this.previous.push({"text": text, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd});\r
-                               if(this.previous.length > this.settings["max_undo"]+1)\r
-                                       this.previous.shift();\r
-                               \r
-                       }\r
-                       if(this.previous.length >= 2)\r
-                               this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);              \r
-               }\r
-\r
-               if(!only_once)\r
-                       setTimeout("editArea.check_undo()", 3000);\r
-       };\r
-       \r
-       EditArea.prototype.undo= function(){\r
-               //alert("undo"+this.previous.length);\r
-               if(this.previous.length > 0)\r
-               {\r
-                       this.getIESelection();\r
-               //      var pos_cursor=this.textarea.selectionStart;\r
-                       this.next.push( { "text": this.textarea.value, "selStart": this.textarea.selectionStart, "selEnd": this.textarea.selectionEnd } );\r
-                       var prev= this.previous.pop();\r
-                       if( prev["text"] == this.textarea.value && this.previous.length > 0 )\r
-                               prev    =this.previous.pop();                                           \r
-                       this.textarea.value     = prev["text"];\r
-                       this.last_undo          = prev["text"];\r
-                       this.area_select(prev["selStart"], prev["selEnd"]-prev["selStart"]);\r
-                       this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);\r
-                       this.resync_highlight(true);\r
-                       //alert("undo"+this.previous.length);\r
-                       this.check_file_changes();\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.redo= function(){\r
-               if(this.next.length > 0)\r
-               {\r
-                       /*this.getIESelection();*/\r
-                       //var pos_cursor=this.textarea.selectionStart;\r
-                       var next= this.next.pop();\r
-                       this.previous.push(next);\r
-                       this.textarea.value= next["text"];\r
-                       this.last_undo= next["text"];\r
-                       this.area_select(next["selStart"], next["selEnd"]-next["selStart"]);\r
-                       this.switchClassSticky(_$("undo"), 'editAreaButtonNormal', false);\r
-                       this.resync_highlight(true);\r
-                       this.check_file_changes();\r
-               }\r
-               if(     this.next.length == 0)\r
-                       this.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);\r
-       };\r
-       \r
-       EditArea.prototype.check_redo= function(){\r
-               if(editArea.next.length == 0 || editArea.textarea.value!=editArea.last_undo){\r
-                       editArea.next= [];      // undo the ability to use "redo" button\r
-                       editArea.switchClassSticky(_$("redo"), 'editAreaButtonDisabled', true);\r
-               }\r
-               else\r
-               {\r
-                       this.switchClassSticky(_$("redo"), 'editAreaButtonNormal', false);\r
-               }\r
-       };\r
-       \r
-       \r
-       // functions that manage icons roll over, disabled, etc...\r
-       EditArea.prototype.switchClass = function(element, class_name, lock_state) {\r
-               var lockChanged = false;\r
-       \r
-               if (typeof(lock_state) != "undefined" && element != null) {\r
-                       element.classLock = lock_state;\r
-                       lockChanged = true;\r
-               }\r
-       \r
-               if (element != null && (lockChanged || !element.classLock)) {\r
-                       element.oldClassName = element.className;\r
-                       element.className = class_name;\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.restoreAndSwitchClass = function(element, class_name) {\r
-               if (element != null && !element.classLock) {\r
-                       this.restoreClass(element);\r
-                       this.switchClass(element, class_name);\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.restoreClass = function(element) {\r
-               if (element != null && element.oldClassName && !element.classLock) {\r
-                       element.className = element.oldClassName;\r
-                       element.oldClassName = null;\r
-               }\r
-       };\r
-       \r
-       EditArea.prototype.setClassLock = function(element, lock_state) {\r
-               if (element != null)\r
-                       element.classLock = lock_state;\r
-       };\r
-       \r
-       EditArea.prototype.switchClassSticky = function(element, class_name, lock_state) {\r
-               var lockChanged = false;\r
-               if (typeof(lock_state) != "undefined" && element != null) {\r
-                       element.classLock = lock_state;\r
-                       lockChanged = true;\r
-               }\r
-       \r
-               if (element != null && (lockChanged || !element.classLock)) {\r
-                       element.className = class_name;\r
-                       element.oldClassName = class_name;\r
-               }\r
-       };\r
-       \r
-       //make the "page up" and "page down" buttons works correctly\r
-       EditArea.prototype.scroll_page= function(params){\r
-               var dir= params["dir"], shift_pressed= params["shift"];\r
-               var lines= this.textarea.value.split("\n");             \r
-               var new_pos=0, length=0, char_left=0, line_nb=0, curLine=0;\r
-               var toScrollAmount      = _$("result").clientHeight -30;\r
-               var nbLineToScroll      = 0, diff= 0;\r
-               \r
-               if(dir=="up"){\r
-                       nbLineToScroll  = Math.ceil( toScrollAmount / this.lineHeight );\r
-                       \r
-                       // fix number of line to scroll\r
-                       for( i = this.last_selection["line_start"]; i - diff > this.last_selection["line_start"] - nbLineToScroll ; i-- )\r
-                       {\r
-                               if( elem = _$('line_'+ i) )\r
-                               {\r
-                                       diff +=  Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );\r
-                               }\r
-                       }\r
-                       nbLineToScroll  -= diff;\r
-                       \r
-                       if(this.last_selection["selec_direction"]=="up"){\r
-                               for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]-nbLineToScroll, lines.length); line_nb++){\r
-                                       new_pos+= lines[line_nb].length + 1;\r
-                               }\r
-                               char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);\r
-                               if(shift_pressed)\r
-                                       length=this.last_selection["selectionEnd"]-new_pos-char_left;   \r
-                               this.area_select(new_pos+char_left, length);\r
-                               view="top";\r
-                       }else{                  \r
-                               view="bottom";\r
-                               for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-1-nbLineToScroll, lines.length); line_nb++){\r
-                                       new_pos+= lines[line_nb].length + 1;\r
-                               }\r
-                               char_left=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]-1);\r
-                               if(shift_pressed){\r
-                                       //length=this.last_selection["selectionEnd"]-new_pos-char_left; \r
-                                       start= Math.min(this.last_selection["selectionStart"], new_pos+char_left);\r
-                                       length= Math.max(new_pos+char_left, this.last_selection["selectionStart"] )- start ;\r
-                                       if(new_pos+char_left < this.last_selection["selectionStart"])\r
-                                               view="top";\r
-                               }else\r
-                                       start=new_pos+char_left;\r
-                               this.area_select(start, length);\r
-                               \r
-                       }\r
-               }\r
-               else\r
-               {\r
-                       var nbLineToScroll= Math.floor( toScrollAmount / this.lineHeight );\r
-                       // fix number of line to scroll\r
-                       for( i = this.last_selection["line_start"]; i + diff < this.last_selection["line_start"] + nbLineToScroll ; i++ )\r
-                       {\r
-                               if( elem = _$('line_'+ i) )\r
-                               {\r
-                                       diff +=  Math.floor( ( elem.offsetHeight - 1 ) / this.lineHeight );\r
-                               }\r
-                       }\r
-                       nbLineToScroll  -= diff;\r
-                               \r
-                       if(this.last_selection["selec_direction"]=="down"){\r
-                               view="bottom";\r
-                               for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+this.last_selection["line_nb"]-2+nbLineToScroll, lines.length); line_nb++){\r
-                                       if(line_nb==this.last_selection["line_start"]-1)\r
-                                               char_left= this.last_selection["selectionStart"] -new_pos;\r
-                                       new_pos+= lines[line_nb].length + 1;\r
-                                                                       \r
-                               }\r
-                               if(shift_pressed){\r
-                                       length=Math.abs(this.last_selection["selectionStart"]-new_pos); \r
-                                       length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"]);\r
-                                       //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);\r
-                                       this.area_select(Math.min(this.last_selection["selectionStart"], new_pos), length);\r
-                               }else{\r
-                                       this.area_select(new_pos+char_left, 0);\r
-                               }\r
-                               \r
-                       }else{\r
-                               view="top";\r
-                               for(line_nb=0; line_nb< Math.min(this.last_selection["line_start"]+nbLineToScroll-1, lines.length, lines.length); line_nb++){\r
-                                       if(line_nb==this.last_selection["line_start"]-1)\r
-                                               char_left= this.last_selection["selectionStart"] -new_pos;\r
-                                       new_pos+= lines[line_nb].length + 1;                                                                    \r
-                               }\r
-                               if(shift_pressed){\r
-                                       length=Math.abs(this.last_selection["selectionEnd"]-new_pos-char_left); \r
-                                       length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, this.last_selection["curr_pos"])- char_left-1;\r
-                                       //length+=Math.min(lines[Math.min(lines.length-1, line_nb)].length, char_left);\r
-                                       this.area_select(Math.min(this.last_selection["selectionEnd"], new_pos+char_left), length);\r
-                                       if(new_pos+char_left > this.last_selection["selectionEnd"])\r
-                                               view="bottom";\r
-                               }else{\r
-                                       this.area_select(new_pos+char_left, 0);\r
-                               }\r
-                               \r
-                       }\r
-               }\r
-               //console.log( new_pos, char_left, length, nbLineToScroll, toScrollAmount, _$("result").clientHeigh );\r
-               this.check_line_selection();\r
-               this.scroll_to_view(view);\r
-       };\r
-       \r
-       EditArea.prototype.start_resize= function(e){\r
-               parent.editAreaLoader.resize["id"]              = editArea.id;          \r
-               parent.editAreaLoader.resize["start_x"] = (e)? e.pageX : event.x + document.body.scrollLeft;            \r
-               parent.editAreaLoader.resize["start_y"] = (e)? e.pageY : event.y + document.body.scrollTop;\r
-               if(editArea.isIE)\r
-               {\r
-                       editArea.textarea.focus();\r
-                       editArea.getIESelection();\r
-               }\r
-               parent.editAreaLoader.resize["selectionStart"]  = editArea.textarea.selectionStart;\r
-               parent.editAreaLoader.resize["selectionEnd"]    = editArea.textarea.selectionEnd;\r
-               parent.editAreaLoader.start_resize_area();\r
-       };\r
-       \r
-       EditArea.prototype.toggle_full_screen= function(to){\r
-               var t=this, p=parent, a=t.textarea, html, frame, selStart, selEnd, old, icon;\r
-               if(typeof(to)=="undefined")\r
-                       to= !t.fullscreen['isFull'];\r
-               old                     = t.fullscreen['isFull'];\r
-               t.fullscreen['isFull']= to;\r
-               icon            = _$("fullscreen");\r
-               selStart        = t.textarea.selectionStart;\r
-               selEnd          = t.textarea.selectionEnd;\r
-               html            = p.document.getElementsByTagName("html")[0];\r
-               frame           = p.document.getElementById("frame_"+t.id);\r
-               \r
-               if(to && to!=old)\r
-               {       // toogle on fullscreen         \r
-                       \r
-                       t.fullscreen['old_overflow']    = p.get_css_property(html, "overflow");\r
-                       t.fullscreen['old_height']              = p.get_css_property(html, "height");\r
-                       t.fullscreen['old_width']               = p.get_css_property(html, "width");\r
-                       t.fullscreen['old_scrollTop']   = html.scrollTop;\r
-                       t.fullscreen['old_scrollLeft']  = html.scrollLeft;\r
-                       t.fullscreen['old_zIndex']              = p.get_css_property(frame, "z-index");\r
-                       if(t.isOpera){\r
-                               html.style.height       = "100%";\r
-                               html.style.width        = "100%";       \r
-                       }\r
-                       html.style.overflow     = "hidden";\r
-                       html.scrollTop          = 0;\r
-                       html.scrollLeft         = 0;\r
-                       \r
-                       frame.style.position    = "absolute";\r
-                       frame.style.width               = html.clientWidth+"px";\r
-                       frame.style.height              = html.clientHeight+"px";\r
-                       frame.style.display             = "block";\r
-                       frame.style.zIndex              = "999999";\r
-                       frame.style.top                 = "0px";\r
-                       frame.style.left                = "0px";\r
-                       \r
-                       // if the iframe was in a div with position absolute, the top and left are the one of the div, \r
-                       // so I fix it by seeing at witch position the iframe start and correcting it\r
-                       frame.style.top                 = "-"+p.calculeOffsetTop(frame)+"px";\r
-                       frame.style.left                = "-"+p.calculeOffsetLeft(frame)+"px";\r
-                       \r
-               //      parent.editAreaLoader.execCommand(t.id, "update_size();");\r
-               //      var body=parent.document.getElementsByTagName("body")[0];\r
-               //      body.appendChild(frame);\r
-                       \r
-                       t.switchClassSticky(icon, 'editAreaButtonSelected', false);\r
-                       t.fullscreen['allow_resize']= t.resize_allowed;\r
-                       t.allow_resize(false);\r
-       \r
-                       //t.area_select(selStart, selEnd-selStart);\r
-                       \r
-               \r
-                       // opera can't manage to do a direct size update\r
-                       if(t.isFirefox){\r
-                               p.editAreaLoader.execCommand(t.id, "update_size();");\r
-                               t.area_select(selStart, selEnd-selStart);\r
-                               t.scroll_to_view();\r
-                               t.focus();\r
-                       }else{\r
-                               setTimeout("p.editAreaLoader.execCommand('"+ t.id +"', 'update_size();');editArea.focus();", 10);\r
-                       }       \r
-                       \r
-       \r
-               }\r
-               else if(to!=old)\r
-               {       // toogle off fullscreen\r
-                       frame.style.position="static";\r
-                       frame.style.zIndex= t.fullscreen['old_zIndex'];\r
-               \r
-                       if(t.isOpera)\r
-                       {\r
-                               html.style.height       = "auto"; \r
-                               html.style.width        = "auto";\r
-                               html.style.overflow     = "auto";\r
-                       }\r
-                       else if(t.isIE && p!=top)\r
-                       {       // IE doesn't manage html overflow in frames like in normal page... \r
-                               html.style.overflow     = "auto";\r
-                       }\r
-                       else\r
-                       {\r
-                               html.style.overflow     = t.fullscreen['old_overflow'];\r
-                       }\r
-                       html.scrollTop  = t.fullscreen['old_scrollTop'];\r
-                       html.scrollLeft = t.fullscreen['old_scrollLeft'];\r
-               \r
-                       p.editAreaLoader.hide(t.id);\r
-                       p.editAreaLoader.show(t.id);\r
-                       \r
-                       t.switchClassSticky(icon, 'editAreaButtonNormal', false);\r
-                       if(t.fullscreen['allow_resize'])\r
-                               t.allow_resize(t.fullscreen['allow_resize']);\r
-                       if(t.isFirefox){\r
-                               t.area_select(selStart, selEnd-selStart);\r
-                               setTimeout("editArea.scroll_to_view();", 10);\r
-                       }                       \r
-                       \r
-                       //p.editAreaLoader.remove_event(p.window, "resize", editArea.update_size);\r
-               }\r
-               \r
-       };\r
-       \r
-       EditArea.prototype.allow_resize= function(allow){\r
-               var resize= _$("resize_area");\r
-               if(allow){\r
-                       \r
-                       resize.style.visibility="visible";\r
-                       parent.editAreaLoader.add_event(resize, "mouseup", editArea.start_resize);\r
-               }else{\r
-                       resize.style.visibility="hidden";\r
-                       parent.editAreaLoader.remove_event(resize, "mouseup", editArea.start_resize);\r
-               }\r
-               this.resize_allowed= allow;\r
-       };\r
-       \r
-       \r
-       EditArea.prototype.change_syntax= function(new_syntax, is_waiting){\r
-       //      alert("cahnge to "+new_syntax);\r
-               // the syntax is the same\r
-               if(new_syntax==this.settings['syntax'])\r
-                       return true;\r
-               \r
-               // check that the syntax is one allowed\r
-               var founded= false;\r
-               for(var i=0; i<this.syntax_list.length; i++)\r
-               {\r
-                       if(this.syntax_list[i]==new_syntax)\r
-                               founded= true;\r
-               }\r
-               \r
-               if(founded==true)\r
-               {\r
-                       // the reg syntax file is not loaded\r
-                       if(!parent.editAreaLoader.load_syntax[new_syntax])\r
-                       {\r
-                               // load the syntax file and wait for file loading\r
-                               if(!is_waiting)\r
-                                       parent.editAreaLoader.load_script(parent.editAreaLoader.baseURL + "reg_syntax/" + new_syntax + ".js");\r
-                               setTimeout("editArea.change_syntax('"+ new_syntax +"', true);", 100);\r
-                               this.show_waiting_screen();\r
-                       }\r
-                       else\r
-                       {\r
-                               if(!this.allready_used_syntax[new_syntax])\r
-                               {       // the syntax has still not been used\r
-                                       // rebuild syntax definition for new languages\r
-                                       parent.editAreaLoader.init_syntax_regexp();\r
-                                       // add style to the new list\r
-                                       this.add_style(parent.editAreaLoader.syntax[new_syntax]["styles"]);\r
-                                       this.allready_used_syntax[new_syntax]=true;\r
-                               }\r
-                               // be sure that the select option is correctly updated\r
-                               var sel= _$("syntax_selection");\r
-                               if(sel && sel.value!=new_syntax)\r
-                               {\r
-                                       for(var i=0; i<sel.length; i++){\r
-                                               if(sel.options[i].value && sel.options[i].value == new_syntax)\r
-                                                       sel.options[i].selected=true;\r
-                                       }\r
-                               }\r
-                               \r
-                       /*      if(this.settings['syntax'].length==0)\r
-                               {\r
-                                       this.switchClassSticky(_$("highlight"), 'editAreaButtonNormal', false);\r
-                                       this.switchClassSticky(_$("reset_highlight"), 'editAreaButtonNormal', false);\r
-                                       this.change_highlight(true);\r
-                               }\r
-                               */\r
-                               this.settings['syntax']= new_syntax;\r
-                               this.resync_highlight(true);\r
-                               this.hide_waiting_screen();\r
-                               return true;\r
-                       }\r
-               }\r
-               return false;\r
-       };\r
-       \r
-       \r
-       // check if the file has changed\r
-       EditArea.prototype.set_editable= function(is_editable){\r
-               if(is_editable)\r
-               {\r
-                       document.body.className= "";\r
-                       this.textarea.readOnly= false;\r
-                       this.is_editable= true;\r
-               }\r
-               else\r
-               {\r
-                       document.body.className= "non_editable";\r
-                       this.textarea.readOnly= true;\r
-                       this.is_editable= false;\r
-               }\r
-               \r
-               if(editAreas[this.id]["displayed"]==true)\r
-                       this.update_size();\r
-       };\r
-       \r
-       /***** Wrap mode *****/\r
-       \r
-       // toggling function for set_wrap_mode\r
-       EditArea.prototype.toggle_word_wrap= function(){\r
-               this.set_word_wrap( !this.settings['word_wrap'] );\r
-       };\r
-       \r
-       \r
-       // open a new tab for the given file\r
-       EditArea.prototype.set_word_wrap= function(to){\r
-               var t=this, a= t.textarea;\r
-               \r
-               if( t.isOpera )\r
-               {\r
-                       this.settings['word_wrap']= false;\r
-                       t.switchClassSticky( _$("word_wrap"), 'editAreaButtonDisabled', true );\r
-                       return false;\r
-               }\r
-               \r
-               if( to )\r
-               {\r
-                       wrap_mode = 'soft';\r
-                       this.container.className+= ' word_wrap';\r
-                       this.container.style.width="";\r
-                       this.content_highlight.style.width="";\r
-                       a.style.width="100%";\r
-                       if( t.isIE && t.isIE < 7 )      // IE 6 count 50 px too much\r
-                       {\r
-                               a.style.width   = ( a.offsetWidth-5 )+"px";\r
-                       }\r
-                       \r
-                       t.switchClassSticky( _$("word_wrap"), 'editAreaButtonSelected', false );\r
-               }\r
-               else\r
-               {\r
-                       wrap_mode = 'off';\r
-                       this.container.className        = this.container.className.replace(/word_wrap/g, '');\r
-                       t.switchClassSticky( _$("word_wrap"), 'editAreaButtonNormal', true );\r
-               }\r
-               this.textarea.previous_scrollWidth = '';\r
-               this.textarea.previous_scrollHeight = '';\r
-               \r
-               a.wrap= wrap_mode;\r
-               a.setAttribute('wrap', wrap_mode);\r
-               // only IE can change wrap mode on the fly without element reloading\r
-               if(!this.isIE)\r
-               {\r
-                       var start=a.selectionStart, end= a.selectionEnd;\r
-                       var parNod = a.parentNode, nxtSib = a.nextSibling;\r
-                       parNod.removeChild(a);\r
-                       parNod.insertBefore(a, nxtSib);\r
-                       this.area_select(start, end-start);\r
-               }\r
-               // reset some optimisation\r
-               this.settings['word_wrap']      = to;\r
-               this.focus();\r
-               this.update_size();\r
-               this.check_line_selection();\r
-       };      \r
-       /***** tabbed files managing functions *****/\r
-       \r
-       // open a new tab for the given file\r
-       EditArea.prototype.open_file= function(settings){\r
-               \r
-               if(settings['id']!="undefined")\r
-               {\r
-                       var id= settings['id'];\r
-                       // create a new file object with defautl values\r
-                       var new_file= {};\r
-                       new_file['id']                  = id;\r
-                       new_file['title']               = id;\r
-                       new_file['text']                = "";\r
-                       new_file['last_selection']      = "";           \r
-                       new_file['last_text_to_highlight']      = "";\r
-                       new_file['last_hightlighted_text']      = "";\r
-                       new_file['previous']    = [];\r
-                       new_file['next']                = [];\r
-                       new_file['last_undo']   = "";\r
-                       new_file['smooth_selection']    = this.settings['smooth_selection'];\r
-                       new_file['do_highlight']= this.settings['start_highlight'];\r
-                       new_file['syntax']              = this.settings['syntax'];\r
-                       new_file['scroll_top']  = 0;\r
-                       new_file['scroll_left'] = 0;\r
-                       new_file['selection_start']= 0;\r
-                       new_file['selection_end']= 0;\r
-                       new_file['edited']              = false;\r
-                       new_file['font_size']   = this.settings["font_size"];\r
-                       new_file['font_family'] = this.settings["font_family"];\r
-                       new_file['word_wrap']   = this.settings["word_wrap"];\r
-                       new_file['toolbar']             = {'links':{}, 'selects': {}};\r
-                       new_file['compare_edited_text']= new_file['text'];\r
-                       \r
-                       \r
-                       this.files[id]= new_file;\r
-                       this.update_file(id, settings);\r
-                       this.files[id]['compare_edited_text']= this.files[id]['text'];\r
-                       \r
-                       \r
-                       var html_id= 'tab_file_'+encodeURIComponent(id);\r
-                       this.filesIdAssoc[html_id]= id;\r
-                       this.files[id]['html_id']= html_id;\r
-               \r
-                       if(!_$(this.files[id]['html_id']) && id!="")\r
-                       {\r
-                               // be sure the tab browsing area is displayed\r
-                               this.tab_browsing_area.style.display= "block";\r
-                               var elem= document.createElement('li');\r
-                               elem.id= this.files[id]['html_id'];\r
-                               var close= "<img src=\""+ parent.editAreaLoader.baseURL +"images/close.gif\" title=\""+ this.get_translation('close_tab', 'word') +"\" onclick=\"editArea.execCommand('close_file', editArea.filesIdAssoc['"+ html_id +"']);return false;\" class=\"hidden\" onmouseover=\"this.className=''\" onmouseout=\"this.className='hidden'\" />";\r
-                               elem.innerHTML= "<a onclick=\"javascript:editArea.execCommand('switch_to_file', editArea.filesIdAssoc['"+ html_id +"']);\" selec=\"none\"><b><span><strong class=\"edited\">*</strong>"+ this.files[id]['title'] + close +"</span></b></a>";\r
-                               _$('tab_browsing_list').appendChild(elem);\r
-                               var elem= document.createElement('text');\r
-                               this.update_size();\r
-                       }\r
-                       \r
-                       // open file callback (for plugin)\r
-                       if(id!="")\r
-                               this.execCommand('file_open', this.files[id]);\r
-                       \r
-                       this.switch_to_file(id, true);\r
-                       return true;\r
-               }\r
-               else\r
-                       return false;\r
-       };\r
-       \r
-       // close the given file\r
-       EditArea.prototype.close_file= function(id){\r
-               if(this.files[id])\r
-               {\r
-                       this.save_file(id);\r
-                       \r
-                       // close file callback\r
-                       if(this.execCommand('file_close', this.files[id])!==false)\r
-                       {\r
-                               // remove the tab in the toolbar\r
-                               var li= _$(this.files[id]['html_id']);\r
-                               li.parentNode.removeChild(li);\r
-                               // select a new file\r
-                               if(id== this.curr_file)\r
-                               {\r
-                                       var next_file= "";\r
-                                       var is_next= false;\r
-                                       for(var i in this.files)\r
-                                       {\r
-                                               if( is_next )\r
-                                               {\r
-                                                       next_file       = i;\r
-                                                       break;\r
-                                               }\r
-                                               else if( i == id )\r
-                                                       is_next         = true;\r
-                                               else\r
-                                                       next_file       = i;\r
-                                       }\r
-                                       // display the next file\r
-                                       this.switch_to_file(next_file);\r
-                               }\r
-                               // clear datas\r
-                               delete (this.files[id]);\r
-                               this.update_size();\r
-                       }       \r
-               }\r
-       };\r
-       \r
-       // backup current file datas\r
-       EditArea.prototype.save_file= function(id){\r
-               var t= this, save, a_links, a_selects, save_butt, img, i;\r
-               if(t.files[id])\r
-               {\r
-                       var save= t.files[id];\r
-                       save['last_selection']                  = t.last_selection;             \r
-                       save['last_text_to_highlight']  = t.last_text_to_highlight;\r
-                       save['last_hightlighted_text']  = t.last_hightlighted_text;\r
-                       save['previous']                                = t.previous;\r
-                       save['next']                                    = t.next;\r
-                       save['last_undo']                               = t.last_undo;\r
-                       save['smooth_selection']                = t.smooth_selection;\r
-                       save['do_highlight']                    = t.do_highlight;\r
-                       save['syntax']                                  = t.settings['syntax'];\r
-                       save['text']                                    = t.textarea.value;\r
-                       save['scroll_top']                              = t.result.scrollTop;\r
-                       save['scroll_left']                             = t.result.scrollLeft;\r
-                       save['selection_start']                 = t.last_selection["selectionStart"];\r
-                       save['selection_end']                   = t.last_selection["selectionEnd"];\r
-                       save['font_size']                               = t.settings["font_size"];\r
-                       save['font_family']                             = t.settings["font_family"];\r
-                       save['word_wrap']                               = t.settings["word_wrap"];\r
-                       save['toolbar']                                 = {'links':{}, 'selects': {}};\r
-                       \r
-                       // save toolbar buttons state for fileSpecific buttons\r
-                       a_links= _$("toolbar_1").getElementsByTagName("a");\r
-                       for( i=0; i<a_links.length; i++ )\r
-                       {\r
-                               if( a_links[i].getAttribute('fileSpecific') == 'yes' )\r
-                               {\r
-                                       save_butt       = {};\r
-                                       img                     = a_links[i].getElementsByTagName('img')[0];\r
-                                       save_butt['classLock']          = img.classLock;\r
-                                       save_butt['className']          = img.className;\r
-                                       save_butt['oldClassName']       = img.oldClassName;\r
-                                       \r
-                                       save['toolbar']['links'][a_links[i].id]= save_butt;\r
-                               }\r
-                       }\r
-                       \r
-                       // save toolbar select state for fileSpecific buttons\r
-                       a_selects= _$("toolbar_1").getElementsByTagName("select");\r
-                       for( i=0; i<a_selects.length; i++)\r
-                       {\r
-                               if(a_selects[i].getAttribute('fileSpecific')=='yes')\r
-                               {\r
-                                       save['toolbar']['selects'][a_selects[i].id]= a_selects[i].value;\r
-                               }\r
-                       }\r
-                               \r
-                       t.files[id]= save;\r
-                       \r
-                       return save;\r
-               }\r
-               \r
-               return false;\r
-       };\r
-       \r
-       // update file_datas\r
-       EditArea.prototype.update_file= function(id, new_values){\r
-               for(var i in new_values)\r
-               {\r
-                       this.files[id][i]= new_values[i];\r
-               }\r
-       };\r
-       \r
-       // display file datas\r
-       EditArea.prototype.display_file= function(id){\r
-               var t = this, a= t.textarea, new_file, a_lis, a_selects, a_links, a_options, i, j;\r
-               \r
-               // we're showing the empty file\r
-               if(id=='')\r
-               {\r
-                       a.readOnly= true;\r
-                       t.tab_browsing_area.style.display= "none";\r
-                       _$("no_file_selected").style.display= "block";\r
-                       t.result.className= "empty";\r
-                       // clear current datas\r
-                       if(!t.files[''])\r
-                       {\r
-                               t.open_file({id: ''});\r
-                       }\r
-               }\r
-               // we try to show a non existent file, so we left\r
-               else if( typeof( t.files[id] ) == 'undefined' )\r
-               {\r
-                       return false;\r
-               }\r
-               // display a normal file\r
-               else\r
-               {\r
-                       t.result.className= "";\r
-                       a.readOnly= !t.is_editable;\r
-                       _$("no_file_selected").style.display= "none";\r
-                       t.tab_browsing_area.style.display= "block";\r
-               }\r
-               \r
-               // ensure to have last state for undo/redo actions\r
-               t.check_redo(true);\r
-               t.check_undo(true);\r
-               t.curr_file= id;\r
-               \r
-               // replace selected tab file\r
-               a_lis= t.tab_browsing_area.getElementsByTagName('li');\r
-               for( i=0; i<a_lis.length; i++)\r
-               {\r
-                       if(a_lis[i].id == t.files[id]['html_id'])\r
-                               a_lis[i].className='selected';\r
-                       else\r
-                               a_lis[i].className='';\r
-               }\r
-               \r
-               // replace next files datas\r
-               new_file= t.files[id];\r
-       \r
-               // restore text content\r
-               a.value= new_file['text'];\r
-               \r
-               // restore font-size\r
-               t.set_font(new_file['font_family'], new_file['font_size']);\r
-               \r
-               // restore selection and scroll\r
-               t.area_select(new_file['last_selection']['selection_start'], new_file['last_selection']['selection_end'] - new_file['last_selection']['selection_start']);\r
-               t.manage_size(true);\r
-               t.result.scrollTop= new_file['scroll_top'];\r
-               t.result.scrollLeft= new_file['scroll_left'];\r
-               \r
-               // restore undo, redo\r
-               t.previous=     new_file['previous'];\r
-               t.next= new_file['next'];\r
-               t.last_undo=    new_file['last_undo'];\r
-               t.check_redo(true);\r
-               t.check_undo(true);\r
-               \r
-               // restore highlight\r
-               t.execCommand("change_highlight", new_file['do_highlight']);\r
-               t.execCommand("change_syntax", new_file['syntax']);\r
-               \r
-               // smooth mode\r
-               t.execCommand("change_smooth_selection_mode", new_file['smooth_selection']);\r
-               \r
-               // word_wrap\r
-               t.execCommand("set_word_wrap", new_file['word_wrap']);\r
-                       \r
-               // restore links state in toolbar\r
-               a_links= new_file['toolbar']['links'];\r
-               for( i in a_links)\r
-               {\r
-                       if( img =  _$(i).getElementsByTagName('img')[0] )\r
-                       {\r
-                               img.classLock   = a_links[i]['classLock'];\r
-                               img.className   = a_links[i]['className'];\r
-                               img.oldClassName= a_links[i]['oldClassName'];\r
-                       }\r
-               }\r
-               \r
-               // restore select state in toolbar\r
-               a_selects = new_file['toolbar']['selects'];\r
-               for( i in a_selects)\r
-               {\r
-                       a_options       = _$(i).options;\r
-                       for( j=0; j<a_options.length; j++)\r
-                       {\r
-                               if( a_options[j].value == a_selects[i] )\r
-                                       _$(i).options[j].selected=true;\r
-                       }\r
-               }\r
-       \r
-       };\r
-\r
-       // change tab for displaying a new one\r
-       EditArea.prototype.switch_to_file= function(file_to_show, force_refresh){\r
-               if(file_to_show!=this.curr_file || force_refresh)\r
-               {\r
-                       this.save_file(this.curr_file);\r
-                       if(this.curr_file!='')\r
-                               this.execCommand('file_switch_off', this.files[this.curr_file]);\r
-                       this.display_file(file_to_show);\r
-                       if(file_to_show!='')\r
-                               this.execCommand('file_switch_on', this.files[file_to_show]);\r
-               }\r
-       };\r
-\r
-       // get all infos for the given file\r
-       EditArea.prototype.get_file= function(id){\r
-               if(id==this.curr_file)\r
-                       this.save_file(id);\r
-               return this.files[id];\r
-       };\r
-       \r
-       // get all available files infos\r
-       EditArea.prototype.get_all_files= function(){\r
-               tmp_files= this.files;\r
-               this.save_file(this.curr_file);\r
-               if(tmp_files[''])\r
-                       delete(this.files['']);\r
-               return tmp_files;\r
-       };\r
-       \r
-       \r
-       // check if the file has changed\r
-       EditArea.prototype.check_file_changes= function(){\r
-       \r
-               var id= this.curr_file;\r
-               if(this.files[id] && this.files[id]['compare_edited_text']!=undefined)\r
-               {\r
-                       if(this.files[id]['compare_edited_text'].length==this.textarea.value.length && this.files[id]['compare_edited_text']==this.textarea.value)\r
-                       {\r
-                               if(this.files[id]['edited']!= false)\r
-                                       this.set_file_edited_mode(id, false);\r
-                       }\r
-                       else\r
-                       {\r
-                               if(this.files[id]['edited']!= true)\r
-                                       this.set_file_edited_mode(id, true);\r
-                       }\r
-               }\r
-       };\r
-       \r
-       // set if the file is edited or not\r
-       EditArea.prototype.set_file_edited_mode= function(id, to){\r
-               // change CSS for edited tab\r
-               if(this.files[id] && _$(this.files[id]['html_id']))\r
-               {\r
-                       var link= _$(this.files[id]['html_id']).getElementsByTagName('a')[0];\r
-                       if(to==true)\r
-                       {\r
-                               link.className= 'edited';\r
-                       }\r
-                       else\r
-                       {\r
-                               link.className= '';\r
-                               if(id==this.curr_file)\r
-                                       text= this.textarea.value;\r
-                               else\r
-                                       text= this.files[id]['text'];\r
-                               this.files[id]['compare_edited_text']= text;\r
-                       }\r
-                               \r
-                       this.files[id]['edited']= to;\r
-               }\r
-       };\r
-\r
-       EditArea.prototype.set_show_line_colors = function(new_value){\r
-               this.show_line_colors = new_value;\r
-               \r
-               if( new_value )\r
-                       this.selection_field.className  += ' show_colors';\r
-               else\r
-                       this.selection_field.className  = this.selection_field.className.replace( / show_colors/g, '' );\r
-       };
\ No newline at end of file