//
// Customized epoz_scrpt_widget.jp for COREBlog
//
// Based on epoz_script_widget.js.dtml
// 
// 2004.01.14
// Modification 'b','i' to 'strong','em' , contributed by Yamagishi,Masahiro
// 
// Create HTML for Epoz-Editor
//
// Comment out the parts you don't want to be shown.
//

<dtml-call "REQUEST.set('tags',['b','a','i','pre','blockquote','br','p','h3','ul','li','br'] + _.string.split(body_tags,','))">


function CreateEpoz() {

    var widget = '';

    widget += '<div id="EpozToolbar">';

/*
    The select-box for formats
*/

    widget += '<select id="formatblock" onchange="SelectFormat(this);" style="margin-bottom: 2px;">';
    widget += '<option value="">'+EpozLang["Normal"]+'</option>';
    widget += '<option value="<p>">'+EpozLang["Paragraph"]+'</option>';
    widget += '<option value="<h3>">'+EpozLang["Heading3"]+'</option>';
    widget += '<option value="<pre>">'+EpozLang["Formatted"]+'</option>';
    widget += '</select>';
    //widget += '<br />';

/*
    The font-face-buttons (bold, italic, underline)
*/
    <dtml-if "'strong' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_bold.gif" width="23" height="22" alt="'+EpozLang["Bold"]+'" title="'+EpozLang["Bold"]+'" onClick="FormatText(\'bold\', \'\');">';
    </dtml-if>
    <dtml-if "'em' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_italic.gif" width="23" height="22" alt="'+EpozLang["Italic"]+'" title="'+EpozLang["Italic"]+'" onClick="FormatText(\'italic\', \'\');">';
    </dtml-if>
    <dtml-if "'u' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_underline.gif" width="23" height="22" alt="'+EpozLang["Underline"]+'" title="'+EpozLang["Underline"]+'" onClick="FormatText(\'underline\', \'\');">';
    </dtml-if>
    <dtml-if "'strike' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_strikethrough.gif" width="23" height="22" alt="'+EpozLang["Strikethrough"]+'" title="'+EpozLang["Strikethrough"]+'" onClick="FormatText(\'strikethrough\', \'\');">';
    </dtml-if>
    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';

/*
    The sub-/superscript-buttons
*/

    <dtml-if "'sub' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_subscript.gif" width="23" height="22" alt="'+EpozLang["Subscript"]+'" title="'+EpozLang["Subscript"]+'" onClick="FormatText(\'subscript\', \'\');">';
    </dtml-if>
    <dtml-if "'sup' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_superscript.gif" width="23" height="22" alt="'+EpozLang["Superscript"]+'" title="'+EpozLang["Superscript"]+'" onClick="FormatText(\'superscript\', \'\');">';
    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';
    </dtml-if>

/*
    The color-selections (foreground, background)
*/
    <dtml-if "'font' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_textcolor.gif" width="23" height="22" alt="'+EpozLang["TextColor"]+'" title="'+EpozLang["TextColor"]+'" onClick="SetTextColor();">';
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_bgcolor.gif" width="23" height="22" alt="'+EpozLang["BackColor"]+'" title="'+EpozLang["BackColor"]+'" onClick="SetBackColor();">';
    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';
    </dtml-if>

/*
    Alignment-controls
*/
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_left_just.gif" width="23" height="22" alt="'+EpozLang["AlignLeft"]+'" title="'+EpozLang["AlignLeft"]+'" onClick="FormatText(\'justifyleft\', \'\');">';
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_centre.gif" width="23" height="22" alt="'+EpozLang["Center"]+'" title="'+EpozLang["Center"]+'" onClick="FormatText(\'justifycenter\', \'\');">';
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_right_just.gif" width="23" height="22" alt="'+EpozLang["AlignRight"]+'" title="'+EpozLang["AlignRight"]+'" onClick="FormatText(\'justifyright\', \'\');">';
    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';

/*
    Lists and In/Outdent
*/
    <dtml-if "'ol' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_numbered_list.gif" width="23" height="22" alt="'+EpozLang["OrderedList"]+'" title="'+EpozLang["OrderedList"]+'" onClick="FormatText(\'insertorderedlist\', \'\');">';
    </dtml-if>
    <dtml-if "'ul' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_list.gif" width="23" height="22" alt="'+EpozLang["UnorderedList"]+'" title="'+EpozLang["UnorderedList"]+'" onClick="FormatText(\'insertunorderedlist\', \'\');">';
    </dtml-if>
    <dtml-if "'blockquote' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_outdent.gif" width="23" height="22" alt="'+EpozLang["Outdent"]+'" title="'+EpozLang["Outdent"]+'" onClick="FormatText(\'outdent\', \'\');">';
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_indent.gif" width="23" height="22" alt="'+EpozLang["Indent"]+'" title="'+EpozLang["Indent"]+'" onClick="FormatText(\'indent\', \'\');">';
    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';
    </dtml-if>


/*  
    Insert Link, Image, Rule, Table
*/
    <dtml-if "'a' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_hyperlink.gif" width="23" height="22" alt="'+EpozLang["InsertLink"]+'" title="'+EpozLang["InsertLink"]+'" onClick="CreateLink();">';
    </dtml-if>
    <dtml-if "'img' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_image.gif" width="23" height="22" alt="'+EpozLang["InsertImage"]+'" title="'+EpozLang["InsertImage"]+'" onClick="CreateImage();">';
    </dtml-if>
    <dtml-if "'hr' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_hr.gif" width="23" height="22" alt="'+EpozLang["InsertRule"]+'" title="'+EpozLang["InsertRule"]+'" onClick="FormatText(\'inserthorizontalrule\');">';
    </dtml-if>
    <dtml-if "'table' in tags">
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_table.gif" width="23" height="22" alt="'+EpozLang["InsertTable"]+'" title="'+EpozLang["InsertTable"]+'" onClick="window.open(\''+form_path+'epoz_script_table.html\',\'EpozTable\',\'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=220,height=220\');">';
    </dtml-if>

<dtml-comment>
/*
    The optional toolbox
*/
    if ((form_toolbox != null) && (form_toolbox != "")) {
        widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';
        widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_tools.gif" width="23" height="22" alt="'+EpozLang["Toolbox"]+'" title="'+EpozLang["Toolbox"]+'"" onClick="window.open(\''+form_toolbox+'\',\'EpozToolbox\',\'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400\');">';
    }

    widget += '<img src="'+form_path+'epoz_button_space.gif" width="2" height="1">';
</dtml-comment>

/*
    Undo & Redo
*/

    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_undo.gif" width="23" height="22" alt="'+EpozLang["Undo"]+'" title="'+EpozLang["Undo"]+'" onClick="FormatText(\'undo\');">';
    widget += '<img style="'+form_button_style+'" src="'+form_path+'epoz_button_redo.gif" width="23" height="22" alt="'+EpozLang["Redo"]+'" title="'+EpozLang["Redo"]+'" onClick="FormatText(\'redo\');">';


/*
     Don't remove!!!
*/

    widget += '\n<br />\n';
    widget += '<iframe src="'+form_path+'epoz_blank_iframe.html" frameborder="0" id="' + Epoz + '" style="' + form_area_style + '" onload="InitDocument();"></iframe>';
    widget += '</div>';
    
    widget += '<textarea style="display: none; ' + form_area_style + '"  id="' + form_name + '" name="' + form_name + '" value=""></textarea>';
    widget += '<div style="margin: 0px;"><input id="EpozViewMode" style="margin: 0px; width: 10px; height: 10px;" type="checkbox" onclick="SwitchViewMode(this.checked)"></div>'; 

    document.writeln(widget);
}


// Create a default-textbox for browsers without Rich-Text-Features

function CreateTextarea() {
    document.writeln('<textarea name="' + form_name + '" id="' + Epoz + '" style="' + form_area_style + '">'+form_data+'</textarea>');
}

