/**
 * TOPページ画面
 */

function top_menu_sbmt( act ) {
    var actions;
    switch( act ) {
        case 'new':
            actions = 'manage_article_edit.php';
            break;
        case 'list':
            actions = 'manage_article_list.php';
            break;
        case 'staff_list':
            actions = 'manage_staff_list.php';
            break;
        case 'staff_new':
            actions = 'manage_staff_edit.php';
            break;
        case 'banner':
            actions = 'manage_banner_edit.php';
            break;
        case 'banner_list':
            actions = 'manage_banner_list.php';
            break;
		case 'w_new':
            actions = 'manage_news_edit.php';
            break;
        case 'w_list':
            actions = 'manage_news_list.php';
            break;
        case 'topics_new':
            actions = 'manage_topics_edit.php';
            break;
        case 'topics_list':
            actions = 'manage_topics_list.php';
            break;

    }
    document.MainForm.act.value = act;
    document.MainForm.action = actions;
    document.MainForm.submit();
}

/**
 * 記事リスト画面
 */
function article_list_sbmt( act , id ) {
    var actions;
    var res;
    switch( act ) {
        case 'search':
            res     = true;
            actions = 'manage_article_list.php';
            document.MainForm.pages.value = '';
            break;
        case 'detail':
            res     = true;
            actions = 'manage_article_edit.php';
            document.MainForm.article_id.value = id;
            break;
        case 'delete':
            res = window.confirm( 'この記事を削除します。' );
            actions = 'manage_article_regist.php';
            document.MainForm.article_id.value = id;
            break;
        case 'pages':
            res     = true;
            actions = 'manage_article_list.php';
            document.MainForm.pages.value = id;
            document.MainForm.submit();
            break;
        default:
            res = false;
            alert( '不明' );
            break;
    }
    if( res == true ) {
        document.MainForm.act.value = act;
        document.MainForm.action = actions;
        document.MainForm.submit();
    }
}

function article_preview(id) {
    var acitons;
        actions ='http://www.palm.charmworld.jp/frontend/content.php';
        document.preform.preid = id;
        document.preform.action = actions;
        document.preform.submit();
    }

/**
 * 記事編集画面
 */
function article_edit_sbmt( act , bk_kbn ) {
    var actions;
    var res = true;
    switch( act ) {
        case 'regist':
            actions = 'manage_article_regist.php';
            break;
        case 'thumb_del':
            res = window.confirm( 'このサムネイルを削除します。' );
            if( res == true ) {
                document.MainForm.act.value = act;
            }
            actions = 'manage_article_regist.php';
            break;
        case 'back':
            if( bk_kbn == 1 ) {
                actions = 'manage_top.php';
            }else {
                actions = 'manage_article_list.php';
            }
            break;
        default:
            actions = 'manage_article_edit.php';
            break;
    }
    if( res == true ) {
        document.MainForm.action = actions;
        document.MainForm.submit();
    }

}

/**
 * スタッフ登録画面
 */
function staff_edit_sbmt( act , bk_kbn ) {
     var actions;
     switch( act ) {
         case 'regist':
             actions = 'manage_staff_edit.php';
             break;
         case 'back':
             if( bk_kbn == 1 ) {
                 actions = 'manage_top.php';
             }else {
                 actions = 'manage_staff_list.php';
             }
             break;
     }
     document.MainForm.action = actions;
     document.MainForm.act.value = act;
     document.MainForm.submit();
}

/**
 * スタッフ登録画面
 */
function staff_list_sbmt( act , id ) {
    var actions;
    var res;
    switch( act ) {
        case 'edit':
            res = true;
            actions = 'manage_staff_edit.php';
            document.MainForm.staff_id.value = id;
            break;
        case 'delete':
            res = window.confirm( 'この記事を削除します。' );
            actions = 'manage_staff_regist.php';
            document.MainForm.staff_id.value = id;
            break;
        case 'pages':
            res = true;
            document.MainForm.staff_id.value = '';
            actions = 'manage_staff_list.php';
            document.MainForm.now_pages.value = id;
            break;
            
    }
    if( res == true ) {
       document.MainForm.act.value = act;
       document.MainForm.action = actions;
       document.MainForm.submit();
    }
}

/**
 * バナーリスト画面
 */
function banner_list_sbmt(act, page) {
    res     = true;
    actions = 'manage_banner_list.php';
    document.MainForm.pages.value = page;
    document.MainForm.banner_style_sch.value = document.form.banner_style_sch.value;
    
    document.MainForm.action = actions;
    document.MainForm.submit();
}

/**
 * トピックスリスト画面
 */
function topics_list_sbmt(act, page) {
    res     = true;
    actions = 'manage_topics_list.php';
    document.MainForm.pages.value = page;
    document.MainForm.search_y.value = document.form.search_y.value;
    document.MainForm.search_m.value = document.form.search_m.value;
    document.MainForm.search_d.value = document.form.search_d.value;
    
    document.MainForm.action = actions;
    document.MainForm.submit();
}