var editor_buttonPath='http://static.desi-planet.com/images/htmleditor/';var defaultcontrols='';var editor_cssFile='http://static.desi-planet.com/skin/global0.css';var editor_gentleClean='true';var editor_styles='user_normal,(Remove style),user_small,Small,user_comic,Hand Written,user_quote,Quotted Text,user_large,Heading,user_hilite,Hi-lite';var sColorForeground='';var sColorBackground='';var aEditorsList=new Array();var editor_TA;var editor_HTML;var editor_IFrame;var editor_IFrameContent;var editor_PromptDialog;var editor_cW;var editor_d;var editor_jqTextbox;var editor_Idx=-1;var sel,rng,papa,trail;function editor_init(editor_TA,controls,idForm){editor_Idx=-1;editor_setactive(editor_TA,1);if(editor_Idx==-1){for(i=0;i<=aEditorsList.length;i++){if(aEditorsList[i]==''||aEditorsList[i]==undefined){editor_Idx=i;aEditorsList[i]=editor_TA;break;};};if(!document.designMode){aEditorsList[editor_Idx]='';return;} editor_jqTextbox='#'+editor_TA;if(!$(editor_jqTextbox).css('rows')<5)$(editor_jqTextbox).css('rows','15');var taWidth=$(editor_jqTextbox).css('width')?$(editor_jqTextbox).css('width'):$(editor_jqTextbox)[0].cols+"ex";var taHeight=$(editor_jqTextbox).css('height')?$(editor_jqTextbox).css('height'):$(editor_jqTextbox)[0].rows+"em";if(idForm!=''&&idForm!=undefined) $('#'+idForm).bind('submit',syncTextarea);editor_HTML='editor_HTML_'+editor_TA;editor_idMenu='editor_idMenu_'+editor_TA;editor_IFrame='editor_IFrame_'+editor_TA;editor_IFrameContent='editor_IFrameContent_'+editor_TA;editor_PromptDialog='editor_PromptDialog_'+editor_TA;$(editor_jqTextbox).before('
' +'' +'
Loading...
' +'
' +'' +'
'+"\n");if(controls==undefined)controls=defaultcontrols;var aButtons=controls.split(' ');var sMenuHTML='';for(var i=0;i ';else sMenuHTML=sMenuHTML+' ';};};$('#'+editor_idMenu).html(sMenuHTML);};var taContent=editor_cleanup4designmode($(editor_jqTextbox).val());if(taContent=='')taContent='
 
' var editorHTMLContent="" +(editor_cssFile?'\n':'') +'' +'\n'+taContent+'\n';try{editor_cW=$('#'+editor_IFrame)[0].contentWindow;}catch(e){alert('unable to set editor_cW');};editor_d=editor_cW.document;try{editor_d.designMode='on';}catch(e){setTimeout("editor_d.designMode='on';",10);};editor_d.open();editor_d.write(editorHTMLContent);editor_d.close();$(editor_jqTextbox).css('zIndex',2).hide();$('#'+editor_HTML).show();try{if(editor_cW.addEventListener) editor_cW.addEventListener('keypress',editor_keyboard,true);else{editor_d.body.attachEvent('onpaste',function(){setTimeout('editor_cleanUp()',20);});}}catch(e){};editor_jqTextbox=null;} function editor_hide(editor_TA){editor_setactive(editor_TA,1);if(editor_Idx>-1) $('#'+editor_HTML).hide();};function editor_destroy(editor_TA,idForm){editor_setactive(editor_TA,1);if(editor_Idx>-1){try{if(idForm!=''&&idForm!=undefined)$('#'+idForm).bind('submit',syncTextarea);$('#'+editor_HTML).hide();$(editor_jqTextbox).show();try{editor_d.designMode='off';}catch(e){} $('#'+editor_HTML).replaceWith('');aEditorsList[editor_Idx]='';editor_HTML=null;editor_IFrame=null;editor_IFrameContent=null;editor_PromptDialog=null;editor_cW=null;editor_d=null;editor_Idx=null;}catch(e){};};};function editor_syncall(){for(var i=0;i-1){var t=(window.get_xhtml)?get_xhtml(editor_cW.document.body.innerHTML):editor_cW.document.body.innerHTML;$(editor_jqTextbox).val(editor_cleanup_after_designmode(t));if(nClearHTML==1){editor_cW.document.execCommand('selectall',false,null);editor_cW.document.execCommand('delete',false,null);};};};function editor_html_set(editor_TA,sHTML,nAppend){editor_setactive(editor_TA);if(editor_Idx>-1){editor_cW.document.body.innerHTML=(nAppend==1?editor_cW.document.body.innerHTML:'')+sHTML;};};function editor_resize(editor_TA){editor_jqTextbox='#'+editor_TA;if(!$(editor_jqTextbox).css('rows')<5)$(editor_jqTextbox).css('rows','15');var taWidth=$(editor_jqTextbox).css('width')?$(editor_jqTextbox).css('width'):$(editor_jqTextbox)[0].cols+"ex";var taHeight=$(editor_jqTextbox).css('height')?$(editor_jqTextbox).css('height'):$(editor_jqTextbox)[0].rows+"em";$('#'+editor_HTML).css('width',taWidth).css('height',taHeight);$('#'+editor_idMenu).css('width',taWidth);$('#'+editor_IFrame).css('width',taWidth).css('height',(parseInt(taHeight)-18));};function editor_focus(editor_TA){editor_setactive(editor_TA);};function editor_bold(editor_Idx){editor_setactive(editor_Idx);editor_cmd('bold',false);} function editor_italic(editor_Idx){editor_setactive(editor_Idx);editor_cmd('italic',false);} function editor_color(editor_Idx){editor_setactive(editor_Idx);var sColorPicker=editor_colorpicker('editor_setcolor');editor_setdialog('Font Color:
'+sColorPicker,100,100);} function editor_setcolor(sColor){editor_hidedialog();if(rng)rng.select();editor_cW.document.execCommand('forecolor',false,sColor);editor_cW.focus();};function editor_hilite(editor_Idx){editor_setactive(editor_Idx);var sColorPicker=editor_colorpicker('editor_hilitecolor');editor_setdialog('Font Color:
'+sColorPicker,100,100);} function editor_hilitecolor(sColor){editor_hidedialog();if(rng)rng.select();if(!$.browser.msie){try{editor_cW.document.execCommand('hilitecolor',false,sColor);}catch(e){editor_cW.document.execCommand('backcolor',false,sColor);};}else{editor_cW.document.execCommand('backcolor',false,sColor);};editor_cW.focus();};function editor_style(editor_Idx){editor_setactive(editor_Idx);var sStyle='';var sStyleName='';var sStyleHTML='';var aStyles=editor_styles.split(',');for(i=0;i'+sStyleName+'
-
';};editor_setdialog('Styles:
'+sStyleHTML,150,130);} function editor_styleset(sStyle){editor_hidedialog();if(sStyle!='user_normal') editor_insertHTML("");else editor_cW.document.execCommand('removeformat',false,null);};function editor_showhtml(editor_Idx){editor_setactive(editor_Idx);$('#'+editor_IFrameContent).html(editor_cleanup4designmode($('#'+editor_TA).val()));$('#'+editor_TA).hide();$('#'+editor_HTML).show();$('#'+editor_IFrame).show();try{editor_d.designMode='on';}catch(e){setTimeout('editor_d.designMode=\'on\';',100);} editor_cW.focus();} function editor_showtext(editor_Idx){editor_setactive(editor_Idx);var t=(window.get_xhtml)?get_xhtml(editor_cW.document.body.innerHTML):editor_cW.document.body.innerHTML;$(editor_jqTextbox).val(editor_cleanup_after_designmode(t));$('#'+editor_HTML).hide();$('#'+editor_IFrame).hide();$('#'+editor_TA).show();$('#'+editor_TA)[0].focus();} function editor_setdialog(sHTML,nWidth,nHeight){$('#'+editor_PromptDialog).html(""+sHTML).css('width',nWidth+'px').css('height',nHeight+'px').show();};function editor_colorpicker(sFunction){var sColor='';var sColorRGB='';var sColorHTML='';if(sFunction=='color'&&sColorForeground!='')return sColorForeground;if(sFunction=='backcolor'&&sColorBackground!='')return sColorBackground;var aColors=new Array('Black','Brown','Olive Green','Dark Green','Dark Teal','Dark Blue','Indigo','Gray-80%','Dark Red','Orange','Dark Yellow','Green','Teal','Blue','Blue-Gray','Gray-50%','Red','Light Orange','Lime','Sea Green','Aqua','Light Blue','Violet','Gray-40%','Pink','Gold','Yellow','Bright Green','Turquoise','Sky Blue','Plum','Gray-25%','Rose','Tan','Light Yellow','Light Green','Light Turquoise','Pale Blue','Lavender','White');var aColorsRGB=new Array('#000000','#993300','#333300','#003300','#003366','#000080','#333399','#333333','#800000','#FF6600','#808000','#008000','#008080','#0000FF','#666699','#808080','#FF0000','#FF9900','#99CC00','#339966','#33CCCC','#3366FF','#800080','#969696','#FF00FF','#FFCC00','#FFFF00','#00FF00','#00FFFF','#00CCFF','#993366','#C0C0C0','#FF99CC','#FFCC99','#FFFF99','#CCFFCC','#CCFFFF','#99CCFF','#CC99FF','#FFFFFF');sColorHTML='';for(j=0;j<5;j++){sColorHTML=sColorHTML+'';for(i=0;i<8;i++) sColorHTML=sColorHTML+'';sColorHTML=sColorHTML+'';};sColorHTML=sColorHTML+'
 
';if(sFunction=='color')sColorForeground=sColorHTML;if(sFunction=='backcolor')sColorBackground=sColorHTML;return sColorHTML;};function editor_setactive(editor_TA,nNoFocus){if(isNaN(editor_TA)){var nFound=false;for(i=0;i]*>/gi,"").replace(/\b(CLASS|STYLE)=\"[^\"]*\"/gi,"").replace(/\b(CLASS|STYLE)=\w+/gi,"");} if(!o('fontname'+editor_jqTextbox)||!o('fontsize'+editor_jqTextbox))h=h.replace(/<\?FONT[^>]*>/gi,"");h=h.replace(/<\/?(SPAN|COL|XML|ST1|SHAPE|V:|O:|F:|F |PATH|LOCK|IMAGEDATA|STROKE|FORMULAS)[^>]*>/gi,"").replace(/\bCLASS=\"?MSO\w*\"?/gi,"").replace(/[–]/g,'-').replace(/[‘’]/g,"'").replace(/[“”]/g,'"').replace(/align="?justify"?/gi,"").replace(/<(TABLE|TD|TH|COL)(.*)(WIDTH|HEIGHT)=["'0-9A-Z]*/gi,"<$1$2").replace(/<([^>]+)>\s*<\/\1>/gi,"").replace(location.href+'#','#');$('#'+editor_IFrameContent).html(h);} function editor_cleanup4designmode(h){if(!h.match(/<([^>]+)>/))h=h.replace(/\n/g,'
');return h;} function editor_cleanup_after_designmode(h){h=h.replace(/(
( | )?<\/DIV>)/gi,'
 
');h=h.replace(location.href+'#','#');return h;} function editor_hidedialog(){$('#'+editor_PromptDialog).html('').hide();};function editor_cmd(command,option){editor_hidedialog();if(!document.all) try{editor_d.execCommand('styleWithCSS',false,true);}catch(e){editor_d.execCommand('useCSS',false,true);} if("leftrightcenterjustify".indexOf(command)>-1)command="justify"+command;else if(command=="number")command="insertorderedlist";else if(command=="bullet")command="insertunorderedlist";else if(command=="rule")command="inserthorizontalrule";switch(command){case"image":doImage();break;case"link":doLink();break;case"html":editor_showtext();break;case"clean":cleanUp();break;case"word":editor_cW.document.execCommand("paste",false,false);editor_gentleClean=false;editor_cleanUp();break;case"editor_spellCheck":editor_spellCheck();break;default:editor_cW.document.execCommand(command,false,option);}} function editor_keyboard(e){var cmd=false,prm=false;if(e&&(e.ctrlKey&&e.keyCode==e.DOM_VK_V)||(e.shiftKey&&e.keyCode==e.DOM_VK_INSERT)){setTimeout('editor_cleanUp()',10);}else if(e&&e.ctrlKey){var k=String.fromCharCode(e.charCode).toLowerCase();var cmd=(k=='b')?'bold':(k=='i')?'italic':(k=='l')?'link':(k=='m')?'image':false;} if(cmd){editor_cmd(cmd,prm);e.preventDefault();e.stopPropagation();} if(prm=="

"){var h=editor_cW.document.body.innerHTML;h=h.replace(/


<\/p>/gi,'

 

');}} function editor_textbox_insert(html){if(html!=''){var close_tag='';if(html.indexOf('<')==0&&html.indexOf('br')!=1&&html.indexOf('img')!=1) close_tag=html.replace(/<([a-z0-6]+).*/,"<\/$1>");if(html!=''&&html!='')close_tag+='\n';if(document.selection){sel=document.selection.createRange();sel.text=html+sel.text+close_tag;}else{before=$(editor_jqTextbox)[0].value.slice(0,$(editor_jqTextbox)[0].selectionStart);sel=$(editor_jqTextbox)[0].value.slice($(editor_jqTextbox)[0].selectionStart,$(editor_jqTextbox)[0].selectionEnd);after=$(editor_jqTextbox)[0].value.slice($(editor_jqTextbox)[0].selectionEnd);$(editor_jqTextbox)[0].value=before+html+sel+close+after;$(editor_jqTextbox)[0].focus();}};};function editor_insertHTML(html){if(html!=''){try{if(sel.type&&sel.type!="Text")sel="";editor_cW.document.execCommand("inserthtml",false,html+sel);}catch(e){if(document.selection) if(papa&&papa.nodeName=='IMG'){papa.outerHTML=html;} else if(rng){rng.select();rng.pasteHTML(html+rng.htmlText);}}} editor_cursorpos();} function editor_cursorpos(e){if(!e)var e=window.event;if(window.getSelection){sel=editor_cW.getSelection();papa=(e&&e.type=='mouseup')?e.target:(sel.anchorNode.nodeName=='#text')?sel.anchorNode.parentNode:sel.anchorNode;}else{sel=editor_cW.document.selection;rng=sel.createRange();papa=(e&&e.type=='mouseup')?e.srcElement:(sel.type=="Control")?rng.item(0):rng.parentElement();} var paNode=papa;trail=papa.nodeName;while(!paNode.nodeName.match(/^(HTML|BODY)/)&&paNode.className!="htmleditor_button"){paNode=paNode.parentNode;trail=paNode.nodeName+'>'+trail;} if(paNode.className=="htmleditor_button")trail=sel=rng=null;var id=paNode.nodeName=="HTML"?paNode.getElementsByTagName("BODY")[0].id:paNode.id.replace("CONTROL","");} function textSel(){if(sel&&sel.type!="None"){return true;}else{alert(t("First highlight text for this"));return false;}} function doDbl(){if(papa.nodeName=='IMG')doImage();else if(papa.nodeName=='A')doLink();} function fGo(id){return'