document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.ui.core.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.ui.datepicker.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/i18n/jquery.ui.datepicker-zh-CN.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/i18n/jquery.ui.datepicker-zh-TW.js\"><\/script>");

document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.bw.check.js\"><\/script>");
document.writeln("<script type=\"text\/javascript\" src=\"lib\/jquery\/jquery.bw.copyer.js\"><\/script>");

document.writeln("<script type=\"text\/javascript\" src=\"lib\/lib.editor.php\"><\/script>");

$(document).ready(function(){
    if (php_get_ope.match(/^add|amend$/i)){
        $("#if_enable_begin").datepicker({changeMonth: true, changeYear: true, yearRange: '-50:+50', dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: 'admin/template/default/{$dir_images_admin}/icon_calendar.gif', buttonImageOnly: true});
        $("#if_enable_end").datepicker({changeMonth: true, changeYear: true, yearRange: '-50:+50', dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: 'admin/template/default/{$dir_images_admin}/icon_calendar.gif', buttonImageOnly: true});
        $("#if_top_begin").datepicker({changeMonth: true, changeYear: true, yearRange: '-50:+50', dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: 'admin/template/default/{$dir_images_admin}/icon_calendar.gif', buttonImageOnly: true});
        $("#if_top_end").datepicker({changeMonth: true, changeYear: true, yearRange: '-50:+50', dateFormat: 'yy-mm-dd', showOn: 'button', buttonImage: 'admin/template/default/{$dir_images_admin}/icon_calendar.gif', buttonImageOnly: true});

        $("#check_on").bwcheck({find:"input[handle='topic']",value:'on'});
        $("#check_off").bwcheck({find:"input[handle='topic']",value:'off'});
        $("#check_toggle").bwcheck({find:"input[handle='topic']",value:'toggle'});

        xajax_article_if_enable('if_enable_time', $("#if_enable").val());
        xajax_article_if_top('if_top_time', $("#if_top").val());
        xajax_article_if_turn('if_turn_detail', $("#if_turn").attr("checked"), 'form_detail');
        xajax_page_type('detail_page_word_detail', $("#detail_page_type").val(), 'detail_page_word');

        CKEDITOR.replace('detail');
    }
});
