function EAL(){this.version="0.7.1";date=new Date();this.start_time=date.getTime();this.win="loading";this.error=false;this.baseURL="";this.template="";this.lang=new Object();this.load_syntax=new Object();this.syntax=new Object();this.loadedFiles=new Array();this.waiting_loading=new Object();this.scripts_to_load=new Array();this.sub_scripts_to_load=new Array();this.resize=new Array();this.hidden=new Object();this.default_settings={debug: false ,smooth_selection: true ,font_size: "10" ,font_family: "monospace" ,start_highlight: false ,toolbar: "search, go_to_line, fullscreen, |, undo, redo, |, select_font,|, change_smooth_selection, highlight, reset_highlight, |, help" ,begin_toolbar: "" ,end_toolbar: "" ,is_multi_files: false ,allow_resize: "both" ,min_width: 400 ,min_height: 125 ,replace_tab_by_spaces: false ,allow_toggle: true ,language: "en" ,syntax: "" ,syntax_selection_allow: "basic,brainfuck,c,cpp,css,html,js,pas,php,python,ruby,sql,vb,xml" ,display: "onload" ,max_undo: 30 ,browsers: "known" ,plugins: "" ,gecko_spellcheck: false ,fullscreen: false ,is_editable: true ,load_callback: "" ,save_callback: "" ,change_callback: "" ,submit_callback: "" ,EA_init_callback: "" ,EA_delete_callback: "" ,EA_load_callback: "" ,EA_unload_callback: "" ,EA_toggle_on_callback: "" ,EA_toggle_off_callback: "" ,EA_file_switch_on_callback: "" ,EA_file_switch_off_callback: "" ,EA_file_close_callback: "" };this.advanced_buttons=[ ['new_document', 'newdocument.gif', 'new_document', false], ['search', 'search.gif', 'show_search', false], ['go_to_line', 'go_to_line.gif', 'go_to_line', false], ['undo', 'undo.gif', 'undo', true], ['redo', 'redo.gif', 'redo', true], ['change_smooth_selection', 'smooth_selection.gif', 'change_smooth_selection_mode', true], ['reset_highlight', 'reset_highlight.gif', 'resync_highlight', true], ['highlight', 'highlight.gif','change_highlight', true], ['help', 'help.gif', 'show_help', false], ['save', 'save.gif', 'save', false], ['load', 'load.gif', 'load', false], ['fullscreen', 'fullscreen.gif', 'toggle_full_screen', false] ];ua=navigator.userAgent;this.nav=new Object();this.nav['isMacOS']=(ua.indexOf('Mac OS') !=-1);this.nav['isIE']=(navigator.appName=="Microsoft Internet Explorer");if(this.nav['isIE']){this.nav['isIE']=ua.replace(/^.*?MSIE ([0-9\.]*).*$/, "$1");if(this.nav['isIE']<6) this.has_error();}if(this.nav['isNS']=ua.indexOf('Netscape/') !=-1){this.nav['isNS']=ua.substr(ua.indexOf('Netscape/')+9);if(this.nav['isNS']<8 || !this.nav['isIE']) this.has_error();}if(this.nav['isOpera']=(ua.indexOf('Opera') !=-1)){this.nav['isOpera']=ua.replace(/^.*?Opera.*?([0-9\.]+).*$/i, "$1");if(this.nav['isOpera']<9) this.has_error();this.nav['isIE']=false;}this.nav['isGecko']=(ua.indexOf('Gecko') !=-1);if(this.nav['isFirefox'] =(ua.indexOf('Firefox') !=-1)) this.nav['isFirefox']=ua.replace(/^.*?Firefox.*?([0-9\.]+).*$/i, "$1");if(this.nav['isIceweasel'] =(ua.indexOf('Iceweasel') !=-1)) this.nav['isFirefox']=this.nav['isIceweasel']=ua.replace(/^.*?Iceweasel.*?([0-9\.]+).*$/i, "$1");if(this.nav['isCamino'] =(ua.indexOf('Camino') !=-1)) this.nav['isCamino']=ua.replace(/^.*?Camino.*?([0-9\.]+).*$/i, "$1");if(this.nav['isSafari'] =(ua.indexOf('Safari') !=-1)) this.nav['isSafari']=ua.replace(/^.*?Version\/([0-9]+\.[0-9]+).*$/i, "$1");if(this.nav['isIE']>=6 || this.nav['isOpera']>=9 || this.nav['isFirefox'] || this.nav['isCamino'] || this.nav['isSafari']>=3) this.nav['isValidBrowser']=true; else this.nav['isValidBrowser']=false;this.set_base_url();for(var i=0;i0) settings["toolbar"]=settings["begin_toolbar"] +","+ settings["toolbar"];if(settings["end_toolbar"].length>0) settings["toolbar"]=settings["toolbar"] +","+ settings["end_toolbar"];settings["tab_toolbar"]=settings["toolbar"].replace(/ /g,"").split(",");settings["plugins"]=settings["plugins"].replace(/ /g,"").split(",");for(var i=0;i0){settings["syntax"]=settings["syntax"].toLowerCase();this.load_script(this.baseURL + "reg_syntax/"+ settings["syntax"] + ".js");}eAs[settings["id"]]={"settings": settings};eAs[settings["id"]]["displayed"]=false;eAs[settings["id"]]["hidden"]=false;eAL.start(settings["id"]);};EAL.prototype.delete_instance=function(id){eAL.execCommand(id, "EA_delete");if(window.frames["frame_"+id] && window.frames["frame_"+id].editArea){if(eAs[id]["displayed"]) eAL.toggle(id, "off");window.frames["frame_"+id].editArea.execCommand("EA_unload");}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.parentNode.removeChild(span);}var iframe=document.getElementById("frame_"+id);if(iframe){iframe.parentNode.removeChild(iframe);try{delete window.frames["frame_"+id];}catch (e){}}delete eAs[id];};EAL.prototype.start=function(id){if(this.win!="loaded"){setTimeout("eAL.start('"+id+"');", 50);return;}for(var i in eAL.waiting_loading){if(eAL.waiting_loading[i]!="loaded" && typeof(eAL.waiting_loading[i])!="function"){setTimeout("eAL.start('"+id+"');", 50);return;}}if(!eAL.lang[eAs[id]["settings"]["language"]] || (eAs[id]["settings"]["syntax"].length>0 && !eAL.load_syntax[eAs[id]["settings"]["syntax"]]) ){setTimeout("eAL.start('"+id+"');", 50);return;}if(eAs[id]["settings"]["syntax"].length>0) eAL.init_syntax_regexp();if(!document.getElementById("EditAreaArroundInfos_"+id) && (eAs[id]["settings"]["debug"] || eAs[id]["settings"]["allow_toggle"])){var span=document.createElement("span");span.id="EditAreaArroundInfos_"+id;var html="";if(eAs[id]["settings"]["allow_toggle"]){checked=(eAs[id]["settings"]["display"]=="onload")?"checked":"";html+="
";html+="";html+="
";}if(eAs[id]["settings"]["debug"]) html+="
";html=eAL.translate(html, eAs[id]["settings"]["language"]);span.innerHTML=html;var father=document.getElementById(id).parentNode;var next=document.getElementById(id).nextSibling;if(next==null) father.appendChild(span); else father.insertBefore(span, next);}if(!eAs[id]["initialized"]){this.execCommand(id, "EA_init");if(eAs[id]["settings"]["display"]=="later"){eAs[id]["initialized"]=true;return;}}if(this.nav['isIE']){eAL.init_ie_textarea(id);}var html_toolbar_content="";area=eAs[id];for(var i=0;i';}for(var i=0;i';this.iframe_script+='';}if(!this.iframe_css){this.iframe_css="";}var template=this.template.replace(/\[__BASEURL__\]/g, this.baseURL);template=template.replace("[__TOOLBAR__]",html_toolbar_content);template=this.translate(template, area["settings"]["language"], "template");template=template.replace("[__CSSRULES__]", this.iframe_css);template=template.replace("[__JSCODE__]", this.iframe_script);template=template.replace("[__EA_VERSION__]", this.version);area.textarea=document.getElementById(area["settings"]["id"]);eAs[area["settings"]["id"]]["textarea"]=area.textarea;if(typeof(window.frames["frame_"+area["settings"]["id"]])!='undefined') delete window.frames["frame_"+area["settings"]["id"]];var father=area.textarea.parentNode;var content=document.createElement("iframe");content.name="frame_"+area["settings"]["id"];content.id="frame_"+area["settings"]["id"];content.style.borderWidth="0px";setAttribute(content, "frameBorder", "0");content.style.overflow="hidden";content.style.display="none";var next=area.textarea.nextSibling;if(next==null) father.appendChild(content); else father.insertBefore(content, next);var frame=window.frames["frame_"+area["settings"]["id"]];frame.document.open();frame.eAs=eAs;frame.area_id=area["settings"]["id"];frame.document.area_id=area["settings"]["id"];frame.document.write(template);frame.document.close();};EAL.prototype.toggle=function(id, toggle_to){if(!toggle_to) toggle_to=(eAs[id]["displayed"]==true)?"off":"on";if(eAs[id]["displayed"]==true && toggle_to=="off"){this.toggle_off(id);} else if(eAs[id]["displayed"]==false && toggle_to=="on"){this.toggle_on(id);}return false;};EAL.prototype.toggle_off=function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];if(frame.editArea.fullscreen['isFull']) frame.editArea.toggle_full_screen(false);eAs[id]["displayed"]=false;eAs[id]["textarea"].wrap="off";setAttribute(eAs[id]["textarea"], "wrap", "off");var parNod=eAs[id]["textarea"].parentNode;var nxtSib=eAs[id]["textarea"].nextSibling;parNod.removeChild(eAs[id]["textarea"]);parNod.insertBefore(eAs[id]["textarea"], nxtSib);eAs[id]["textarea"].value=frame.editArea.textarea.value;var selStart=frame.editArea.last_selection["selectionStart"];var selEnd=frame.editArea.last_selection["selectionEnd"];var scrollTop=frame.document.getElementById("result").scrollTop;var scrollLeft=frame.document.getElementById("result").scrollLeft;document.getElementById("frame_"+id).style.display='none';eAs[id]["textarea"].style.display="inline";eAs[id]["textarea"].focus();if(this.nav['isIE']){eAs[id]["textarea"].selectionStart=selStart;eAs[id]["textarea"].selectionEnd=selEnd;eAs[id]["textarea"].focused=true;set_IE_selection(eAs[id]["textarea"]);} else{if(this.nav['isOpera']){eAs[id]["textarea"].setSelectionRange(0, 0);}try{eAs[id]["textarea"].setSelectionRange(selStart, selEnd);}catch(e){};}eAs[id]["textarea"].scrollTop=scrollTop;eAs[id]["textarea"].scrollLeft=scrollLeft;frame.editArea.execCommand("toggle_off");}};EAL.prototype.toggle_on=function(id){if(window.frames["frame_"+id]){var frame=window.frames["frame_"+id];area=window.frames["frame_"+id].editArea;area.textarea.value=eAs[id]["textarea"].value;var selStart=0;var selEnd=0;var scrollTop=0;var scrollLeft=0;if(eAs[id]["textarea"].use_last==true){var selStart=eAs[id]["textarea"].last_selectionStart;var selEnd=eAs[id]["textarea"].last_selectionEnd;var scrollTop=eAs[id]["textarea"].last_scrollTop;var scrollLeft=eAs[id]["textarea"].last_scrollLeft;eAs[id]["textarea"].use_last=false;} else{try{var selStart=eAs[id]["textarea"].selectionStart;var selEnd=eAs[id]["textarea"].selectionEnd;var scrollTop=eAs[id]["textarea"].scrollTop;var scrollLeft=eAs[id]["textarea"].scrollLeft;}catch(ex){}}this.set_editarea_size_from_textarea(id, document.getElementById("frame_"+id));eAs[id]["textarea"].style.display="none";document.getElementById("frame_"+id).style.display="inline";area.execCommand("focus");eAs[id]["displayed"]=true;area.execCommand("update_size");window.frames["frame_"+id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+id].document.getElementById("result").scrollLeft=scrollLeft;area.area_select(selStart, selEnd-selStart);area.execCommand("toggle_on");} else{var elem=document.getElementById(id);elem.last_selectionStart=elem.selectionStart;elem.last_selectionEnd=elem.selectionEnd;elem.last_scrollTop=elem.scrollTop;elem.last_scrollLeft=elem.scrollLeft;elem.use_last=true;eAL.start(id);}};EAL.prototype.set_editarea_size_from_textarea=function(id, frame){var elem=document.getElementById(id);var width=Math.max(eAs[id]["settings"]["min_width"], elem.offsetWidth)+"px";var height=Math.max(eAs[id]["settings"]["min_height"], elem.offsetHeight)+"px";if(elem.style.width.indexOf("%")!=-1) width=elem.style.width;if(elem.style.height.indexOf("%")!=-1) height=elem.style.height;frame.style.width=width;frame.style.height=height;};EAL.prototype.set_base_url=function(){if (!this.baseURL){var elements=document.getElementsByTagName('script');for (var i=0;i';html+='';return html;};EAL.prototype.get_control_html=function(button_name, lang){for (var i=0;i";case "|": case "separator": return '';case "select_font": html="";return html;case "syntax_selection": var html="";return html;}return "["+button_name+"]";};EAL.prototype.get_template=function(){if(this.template==""){var xhr_object=null;if(window.XMLHttpRequest) xhr_object=new XMLHttpRequest(); else if(window.ActiveXObject) xhr_object=new ActiveXObject("Microsoft.XMLHTTP"); else{alert("XMLHTTPRequest not supported. EditArea not loaded");return;}xhr_object.open("GET", this.baseURL+"template.html", false);xhr_object.send(null);if(xhr_object.readyState==4) this.template=xhr_object.responseText; else this.has_error();}};EAL.prototype.translate=function(text, lang, mode){if(mode=="word") text=eAL.get_word_translation(text, lang); else if(mode="template"){eAL.current_language=lang;text=text.replace(/\{\$([^\}]+)\}/gm, eAL.translate_template);}return text;};EAL.prototype.translate_template=function(){return eAL.get_word_translation(EAL.prototype.translate_template.arguments[1], eAL.current_language);};EAL.prototype.get_word_translation=function(val, lang){for(var i in eAL.lang[lang]){if(i==val) return eAL.lang[lang][i];}return "_"+val;};EAL.prototype.load_script=function(url){if (this.loadedFiles[url]) return;try{var script=document.createElement("script");script.type="text/javascript";script.src=url;script.charset="UTF-8";var head=document.getElementsByTagName("head");head[0].appendChild(script);}catch(e){document.write('');}this.loadedFiles[url]=true;};EAL.prototype.add_event=function(obj, name, handler){if (obj.attachEvent){obj.attachEvent("on" + name, handler);} else{obj.addEventListener(name, handler, false);}};EAL.prototype.remove_event=function(obj, name, handler){if (obj.detachEvent) obj.detachEvent("on" + name, handler); else obj.removeEventListener(name, handler, false);};EAL.prototype.reset=function(e){var formObj=eAL.nav['isIE'] ? window.event.srcElement : e.target;if(formObj.tagName!='FORM') formObj=formObj.form;for(var i in eAs){var is_child=false;for (var x=0;x old_sel["start"]) this.setSelectionRange(id, new_sel["end"], new_sel["end"]); else this.setSelectionRange(id, old_sel["start"]+open_tag.length, old_sel["start"]+open_tag.length);};EAL.prototype.hide=function(id){if(document.getElementById(id) && !this.hidden[id]){this.hidden[id]=new Object();this.hidden[id]["selectionRange"]=this.getSelectionRange(id);if(document.getElementById(id).style.display!="none"){this.hidden[id]["scrollTop"]=document.getElementById(id).scrollTop;this.hidden[id]["scrollLeft"]=document.getElementById(id).scrollLeft;}if(window.frames["frame_"+id]){this.hidden[id]["toggle"]=eAs[id]["displayed"];if(window.frames["frame_"+id] && eAs[id]["displayed"]==true){var scrollTop=window.frames["frame_"+ id].document.getElementById("result").scrollTop;var scrollLeft=window.frames["frame_"+ id].document.getElementById("result").scrollLeft;} else{var scrollTop=document.getElementById(id).scrollTop;var scrollLeft=document.getElementById(id).scrollLeft;}this.hidden[id]["scrollTop"]=scrollTop;this.hidden[id]["scrollLeft"]=scrollLeft;if(eAs[id]["displayed"]==true) eAL.toggle_off(id);}var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='none';}document.getElementById(id).style.display="none";}};EAL.prototype.show=function(id){if((elem=document.getElementById(id)) && this.hidden[id]){elem.style.display="inline";elem.scrollTop=this.hidden[id]["scrollTop"];elem.scrollLeft=this.hidden[id]["scrollLeft"];var span=document.getElementById("EditAreaArroundInfos_"+id);if(span){span.style.display='inline';}if(window.frames["frame_"+id]){elem.style.display="inline";if(this.hidden[id]["toggle"]==true) eAL.toggle_on(id);scrollTop=this.hidden[id]["scrollTop"];scrollLeft=this.hidden[id]["scrollLeft"];if(window.frames["frame_"+id] && eAs[id]["displayed"]==true){window.frames["frame_"+ id].document.getElementById("result").scrollTop=scrollTop;window.frames["frame_"+ id].document.getElementById("result").scrollLeft=scrollLeft;} else{elem.scrollTop=scrollTop;elem.scrollLeft=scrollLeft;}}sel=this.hidden[id]["selectionRange"];this.setSelectionRange(id, sel["start"], sel["end"]);delete this.hidden[id];}};EAL.prototype.getCurrentFile=function(id){return this.execCommand(id, 'get_file', this.execCommand(id, 'curr_file'));};EAL.prototype.getFile=function(id, file_id){return this.execCommand(id, 'get_file', file_id);};EAL.prototype.getAllFiles=function(id){return this.execCommand(id, 'get_all_files()');};EAL.prototype.openFile=function(id, file_infos){return this.execCommand(id, 'open_file', file_infos);};EAL.prototype.closeFile=function(id, file_id){return this.execCommand(id, 'close_file', file_id);};EAL.prototype.setFileEditedMode=function(id, file_id, to){var reg1=new RegExp('\\\\', 'g');var reg2=new RegExp('"', 'g');return this.execCommand(id, 'set_file_edited_mode("'+ file_id.replace(reg1, '\\\\').replace(reg2, '\\"') +'", '+ to +')');};EAL.prototype.execCommand=function(id, cmd, fct_param){switch(cmd){case "EA_init": if(eAs[id]['settings']["EA_init_callback"].length>0) eval(eAs[id]['settings']["EA_init_callback"]+"('"+ id +"');");break;case "EA_delete": if(eAs[id]['settings']["EA_delete_callback"].length>0) eval(eAs[id]['settings']["EA_delete_callback"]+"('"+ id +"');");break;case "EA_submit": if(eAs[id]['settings']["submit_callback"].length>0) eval(eAs[id]['settings']["submit_callback"]+"('"+ id +"');");break;}if(window.frames["frame_"+id] && window.frames["frame_"+ id].editArea){if(fct_param!=undefined) return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +'(fct_param);'); else return eval('window.frames["frame_'+ id +'"].editArea.'+ cmd +';');}return false;};var eAL=new EAL();var eAs=new Object(); function getAttribute( elm, aname ){try{var avalue=elm.getAttribute( aname );}catch(exept){}if ( ! avalue ){for ( var i=0;i < elm.attributes.length;i ++ ){var taName=elm.attributes [i] .name.toLowerCase();if ( taName==aname ){avalue=elm.attributes [i] .value;return avalue;}}}return avalue;};function setAttribute( elm, attr, val ){if(attr=="class"){elm.setAttribute("className", val);elm.setAttribute("class", val);} else{elm.setAttribute(attr, val);}};function getChildren(elem, elem_type, elem_attribute, elem_attribute_match, option, depth){if(!option) var option="single";if(!depth) var depth=-1;if(elem){var children=elem.childNodes;var result=null;var results=new Array();for (var x=0;x0){results=results.concat(result);}} else if(result!=null){return result;}}}}if(option=="all") return results;}return null;};function isChildOf(elem, parent){if(elem){if(elem==parent) return true;while(elem.parentNode !='undefined'){return isChildOf(elem.parentNode, parent);}}return false;};function getMouseX(e){if(e!=null && typeof(e.pageX)!="undefined"){return e.pageX;} else{return (e!=null?e.x:event.x)+ document.documentElement.scrollLeft;}};function getMouseY(e){if(e!=null && typeof(e.pageY)!="undefined"){return e.pageY;} else{return (e!=null?e.y:event.y)+ document.documentElement.scrollTop;}};function calculeOffsetLeft(r){return calculeOffset(r,"offsetLeft") };function calculeOffsetTop(r){return calculeOffset(r,"offsetTop") };function calculeOffset(element,attr){var offset=0;while(element){offset+=element[attr];element=element.offsetParent}return offset;};function get_css_property(elem, prop){if(document.defaultView){return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop);} else if(elem.currentStyle){var prop=prop.replace(/-\D/gi, function(sMatch){return sMatch.charAt(sMatch.length - 1).toUpperCase();});return elem.currentStyle[prop];} else return null;}var move_current_element;function start_move_element(e, id, frame){var elem_id=(e.target || e.srcElement).id;if(id) elem_id=id;if(!frame) frame=window;if(frame.event) e=frame.event;move_current_element=frame.document.getElementById(elem_id);move_current_element.frame=frame;frame.document.onmousemove=move_element;frame.document.onmouseup=end_move_element;mouse_x=getMouseX(e);mouse_y=getMouseY(e);move_current_element.start_pos_x=mouse_x - (move_current_element.style.left.replace("px","") || calculeOffsetLeft(move_current_element));move_current_element.start_pos_y=mouse_y - (move_current_element.style.top.replace("px","") || calculeOffsetTop(move_current_element));return false;};function end_move_element(e){move_current_element.frame.document.onmousemove="";move_current_element.frame.document.onmouseup="";move_current_element=null;};function move_element(e){if(move_current_element.frame && move_current_element.frame.event) e=move_current_element.frame.event;var mouse_x=getMouseX(e);var mouse_y=getMouseY(e);var new_top=mouse_y - move_current_element.start_pos_y;var new_left=mouse_x - move_current_element.start_pos_x;var max_left=move_current_element.frame.document.body.offsetWidth- move_current_element.offsetWidth;max_top=move_current_element.frame.document.body.offsetHeight- move_current_element.offsetHeight;new_top=Math.min(Math.max(0, new_top), max_top);new_left=Math.min(Math.max(0, new_left), max_left);move_current_element.style.top=new_top+"px";move_current_element.style.left=new_left+"px";return false;};var nav=eAL.nav;function getSelectionRange(textarea){return {"start": textarea.selectionStart, "end": textarea.selectionEnd};};function setSelectionRange(textarea, start, end){textarea.focus();start=Math.max(0, Math.min(textarea.value.length, start));end=Math.max(start, Math.min(textarea.value.length, end));if(nav['isOpera']){textarea.selectionEnd=1;textarea.selectionStart=0;textarea.selectionEnd=1;textarea.selectionStart=0;}textarea.selectionStart=start;textarea.selectionEnd=end;if(nav['isIE']) set_IE_selection(textarea);};function get_IE_selection(textarea){if(textarea && textarea.focused){if(!textarea.ea_line_height){var div=document.createElement("div");div.style.fontFamily=get_css_property(textarea, "font-family");div.style.fontSize=get_css_property(textarea, "font-size");div.style.visibility="hidden";div.innerHTML="0";document.body.appendChild(div);textarea.ea_line_height=div.offsetHeight;document.body.removeChild(div);}var range=document.selection.createRange();var stored_range=range.duplicate();stored_range.moveToElementText( textarea );stored_range.setEndPoint( 'EndToEnd', range );if(stored_range.parentElement()==textarea){var elem=textarea;var scrollTop=0;while(elem.parentNode){scrollTop+=elem.scrollTop;elem=elem.parentNode;}var relative_top=range.offsetTop - calculeOffsetTop(textarea)+ scrollTop;var line_start=Math.round((relative_top / textarea.ea_line_height) +1);var line_nb=Math.round(range.boundingHeight / textarea.ea_line_height);var range_start=stored_range.text.length - range.text.length;var tab=textarea.value.substr(0, range_start).split("\n");range_start+=(line_start - tab.length)*2;textarea.selectionStart=range_start;var range_end=textarea.selectionStart + range.text.length;tab=textarea.value.substr(0, range_start + range.text.length).split("\n");range_end+=(line_start + line_nb - 1 - tab.length)*2;textarea.selectionEnd=range_end;}}setTimeout("get_IE_selection(document.getElementById('"+ textarea.id +"'));", 50);};function IE_textarea_focus(){event.srcElement.focused=true;}function IE_textarea_blur(){event.srcElement.focused=false;}function set_IE_selection(textarea){if(!window.closed){var nbLineStart=textarea.value.substr(0, textarea.selectionStart).split("\n").length - 1;var nbLineEnd=textarea.value.substr(0, textarea.selectionEnd).split("\n").length - 1;var range=document.selection.createRange();range.moveToElementText( textarea );range.setEndPoint( 'EndToStart', range );range.moveStart('character', textarea.selectionStart - nbLineStart);range.moveEnd('character', textarea.selectionEnd - nbLineEnd - (textarea.selectionStart - nbLineStart) );range.select();}};eAL.waiting_loading["elements_functions.js"]="loaded"; EAL.prototype.start_resize_area=function(){document.onmouseup=eAL.end_resize_area;document.onmousemove=eAL.resize_area;eAL.toggle(eAL.resize["id"]);var textarea=eAs[eAL.resize["id"]]["textarea"];var div=document.getElementById("edit_area_resize");if(!div){div=document.createElement("div");div.id="edit_area_resize";div.style.border="dashed #888888 1px";}var width=textarea.offsetWidth -2;var height=textarea.offsetHeight -2;div.style.display="block";div.style.width=width+"px";div.style.height=height+"px";var father=textarea.parentNode;father.insertBefore(div, textarea);textarea.style.display="none";eAL.resize["start_top"]=calculeOffsetTop(div);eAL.resize["start_left"]=calculeOffsetLeft(div);};EAL.prototype.end_resize_area=function(e){document.onmouseup="";document.onmousemove="";var div=document.getElementById("edit_area_resize");var textarea=eAs[eAL.resize["id"]]["textarea"];var width=Math.max(eAs[eAL.resize["id"]]["settings"]["min_width"], div.offsetWidth-4);var height=Math.max(eAs[eAL.resize["id"]]["settings"]["min_height"], div.offsetHeight-4);if(eAL.nav['isIE']==6){width-=2;height-=2;}textarea.style.width=width+"px";textarea.style.height=height+"px";div.style.display="none";textarea.style.display="inline";textarea.selectionStart=eAL.resize["selectionStart"];textarea.selectionEnd=eAL.resize["selectionEnd"];eAL.toggle(eAL.resize["id"]);return false;};EAL.prototype.resize_area=function(e){var allow=eAs[eAL.resize["id"]]["settings"]["allow_resize"];if(allow=="both" || allow=="y"){new_y=getMouseY(e);var new_height=Math.max(20, new_y- eAL.resize["start_top"]);document.getElementById("edit_area_resize").style.height=new_height+"px";}if(allow=="both" || allow=="x"){new_x=getMouseX(e);var new_width=Math.max(20, new_x- eAL.resize["start_left"]);document.getElementById("edit_area_resize").style.width=new_width+"px";}return false;};eAL.waiting_loading["resize_area.js"]="loaded"; EAL.prototype.get_regexp=function(text_array){res="(\\b)(";for(i=0;i0) res+="|";res+=this.get_escaped_regexp(text_array[i]);}res+=")(\\b)";reg=new RegExp(res);return res;};EAL.prototype.get_escaped_regexp=function(str){return str.replace(/(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g, "\\$1");};EAL.prototype.init_syntax_regexp=function(){var lang_style=new Object();for(var lang in this.load_syntax){if(!this.syntax[lang]){this.syntax[lang]=new Object();this.syntax[lang]["keywords_reg_exp"]=new Object();this.keywords_reg_exp_nb=0;if(this.load_syntax[lang]['KEYWORDS']){param="g";if(this.load_syntax[lang]['KEYWORD_CASE_SENSITIVE']===false) param+="i";for(var i in this.load_syntax[lang]['KEYWORDS']){if(typeof(this.load_syntax[lang]['KEYWORDS'][i])=="function") continue;this.syntax[lang]["keywords_reg_exp"][i]=new RegExp(this.get_regexp( this.load_syntax[lang]['KEYWORDS'][i] ), param);this.keywords_reg_exp_nb++;}}if(this.load_syntax[lang]['OPERATORS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['OPERATORS']){if(typeof(this.load_syntax[lang]['OPERATORS'][i])=="function") continue;if(nb>0) str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['OPERATORS'][i]);nb++;}if(str.length>0) this.syntax[lang]["operators_reg_exp"]=new RegExp("("+str+")","g");}if(this.load_syntax[lang]['DELIMITERS']){var str="";var nb=0;for(var i in this.load_syntax[lang]['DELIMITERS']){if(typeof(this.load_syntax[lang]['DELIMITERS'][i])=="function") continue;if(nb>0) str+="|";str+=this.get_escaped_regexp(this.load_syntax[lang]['DELIMITERS'][i]);nb++;}if(str.length>0) this.syntax[lang]["delimiters_reg_exp"]=new RegExp("("+str+")","g");}var syntax_trace=new Array();this.syntax[lang]["quotes"]=new Object();var quote_tab=new Array();if(this.load_syntax[lang]['QUOTEMARKS']){for(var i in this.load_syntax[lang]['QUOTEMARKS']){if(typeof(this.load_syntax[lang]['QUOTEMARKS'][i])=="function") continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['QUOTEMARKS'][i]);this.syntax[lang]["quotes"][x]=x;quote_tab[quote_tab.length]="("+x+"(?:[^"+x+"\\\\]*(\\\\\\\\)*(\\\\"+x+"?)?)*("+x+"|$))";syntax_trace.push(x);}}this.syntax[lang]["comments"]=new Object();if(this.load_syntax[lang]['COMMENT_SINGLE']){for(var i in this.load_syntax[lang]['COMMENT_SINGLE']){if(typeof(this.load_syntax[lang]['COMMENT_SINGLE'][i])=="function") continue;var x=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_SINGLE'][i]);quote_tab[quote_tab.length]="("+x+"(.|\\r|\\t)*(\\n|$))";syntax_trace.push(x);this.syntax[lang]["comments"][x]="\n";}}if(this.load_syntax[lang]['COMMENT_MULTI']){for(var i in this.load_syntax[lang]['COMMENT_MULTI']){if(typeof(this.load_syntax[lang]['COMMENT_MULTI'][i])=="function") continue;var start=this.get_escaped_regexp(i);var end=this.get_escaped_regexp(this.load_syntax[lang]['COMMENT_MULTI'][i]);quote_tab[quote_tab.length]="("+start+"(.|\\n|\\r)*?("+end+"|$))";syntax_trace.push(start);syntax_trace.push(end);this.syntax[lang]["comments"][i]=this.load_syntax[lang]['COMMENT_MULTI'][i];}}if(quote_tab.length>0) this.syntax[lang]["comment_or_quote_reg_exp"]=new RegExp("("+quote_tab.join("|")+")","gi");if(syntax_trace.length>0) this.syntax[lang]["syntax_trace_regexp"]=new RegExp("((.|\n)*?)(\\\\*("+ syntax_trace.join("|") +"|$))", "gmi");if(this.load_syntax[lang]['SCRIPT_DELIMITERS']){this.syntax[lang]["script_delimiters"]=new Object();for(var i in this.load_syntax[lang]['SCRIPT_DELIMITERS']){if(typeof(this.load_syntax[lang]['SCRIPT_DELIMITERS'][i])=="function") continue;this.syntax[lang]["script_delimiters"][i]=this.load_syntax[lang]['SCRIPT_DELIMITERS'];}}this.syntax[lang]["custom_regexp"]=new Object();if(this.load_syntax[lang]['REGEXPS']){for(var i in this.load_syntax[lang]['REGEXPS']){if(typeof(this.load_syntax[lang]['REGEXPS'][i])=="function") continue;var val=this.load_syntax[lang]['REGEXPS'][i];if(!this.syntax[lang]["custom_regexp"][val['execute']]) this.syntax[lang]["custom_regexp"][val['execute']]=new Object();this.syntax[lang]["custom_regexp"][val['execute']][i]={'regexp' : new RegExp(val['search'], val['modifiers']) , 'class' : val['class']};}}if(this.load_syntax[lang]['STYLES']){lang_style[lang]=new Object();for(var i in this.load_syntax[lang]['STYLES']){if(typeof(this.load_syntax[lang]['STYLES'][i])=="function") continue;if(typeof(this.load_syntax[lang]['STYLES'][i]) !="string"){for(var j in this.load_syntax[lang]['STYLES'][i]){lang_style[lang][j]=this.load_syntax[lang]['STYLES'][i][j];}} else{lang_style[lang][i]=this.load_syntax[lang]['STYLES'][i];}}}var style="";for(var i in lang_style[lang]){if(lang_style[lang][i].length>0){style+="."+ lang +" ."+ i.toLowerCase() +" span{"+lang_style[lang][i]+"}\n";style+="."+ lang +" ."+ i.toLowerCase() +"{"+lang_style[lang][i]+"}\n";}}this.syntax[lang]["styles"]=style;}}};eAL.waiting_loading["reg_syntax.js"]="loaded"; var editAreaLoader= eAL;var editAreas=eAs;EditAreaLoader=EAL;editAreaLoader.iframe_script= ""; editAreaLoader.template= " EditArea [__CSSRULES__] [__JSCODE__]
[__TOOLBAR__]
 
 
{$position}: {$line_abbr} 0, {$char_abbr} 0 {$total}: {$line_abbr} 0, {$char_abbr} 0 resize
{$processing}
{$search} {$close_popup}
{$replace} {$move_popup}

{$find_next} {$replace} {$replace_all}
{$close_popup}

Editarea [__EA_VERSION__]


{$shortcuts}:

{$tab}: {$add_tab}
{$shift}+{$tab}: {$remove_tab}
{$ctrl}+f: {$search_command}
{$ctrl}+r: {$replace_command}
{$ctrl}+h: {$highlight}
{$ctrl}+g: {$go_to_line}
{$ctrl}+z: {$undo}
{$ctrl}+y: {$redo}
{$ctrl}+e: {$help}
{$ctrl}+q, {$esc}: {$close_popup}
{$accesskey} E: {$toggle}

{$about_notice}
"; editAreaLoader.iframe_css= "";