/* ==============================================================

	SystemHouseFukuchiyama 
	http://www.shfweb.com

*/

YAHOO.namespace("shf");

/* ===================================================================================================================================================
    確認ダイアログ

*/
function message_dialog_init() {

    // Define various event handlers for Dialog
    var handleSubmit = function() {
        this.submit();
    };
    var handleCancel = function() {
        this.cancel();
    };
    var handleSuccess = function(o) {
        document.getElementById("dialog_form").action = "";
        document.getElementById("dialog_form").submit();
    };

    // Instantiate the Dialog

    YAHOO.shf.msgdialog = new YAHOO.widget.Dialog("dialog_messages", { 
                                                        width : "500px",
                                                        fixedcenter : true,
                                                        close : false,
                                                        zindex : 8,
                                                        modal : true,
                                                        visible : false,
                                                        buttons : [
                                                                { text:"はい", handler:handleSubmit, isDefault:true },
                                                                { text:"いいえ", handler:handleCancel}
                                                                ]
                                                       } );

    // Wire up the success and failure handlers
    YAHOO.shf.msgdialog.callback = { success: handleSuccess };

    // Render the Dialog
    YAHOO.shf.msgdialog.render();


    YAHOO.shf.confirmdialog = new YAHOO.widget.Dialog("confirmdialog_messages", { 
                                                        width : "500px",
                                                        fixedcenter : true,
                                                        close : false,
                                                        zindex : 8,
                                                        modal : true,
                                                        visible : false,
                                                        buttons : [
                                                                { text:"ＯＫ", handler:handleCancel, isDefault:true }
                                                                ]
                                                       } );

    // Render the Dialog
    YAHOO.shf.confirmdialog.render();


}


/* ===================================================================================================================================================
    確認ダイアログ（ロードと同時に開く）

*/
function message_showdialog_init() {

    // Define various event handlers for Dialog
    var handleClose = function() {
        this.cancel();
    };

    // Instantiate the Dialog
    YAHOO.shf.showdialog = new YAHOO.widget.Dialog("showdialog_messages", { 
                                                        width : "500px",
                                                        fixedcenter : true,
                                                        close : false,
                                                        zindex : 8,
                                                        modal : true,
                                                        visible : false,
                                                        buttons : [
                                                                { text:"ＯＫ", handler:handleClose, isDefault:true }
                                                                ]
                                                       } );

    // Render the Dialog
    YAHOO.shf.showdialog.render();

    YAHOO.shf.showdialog.show();
}

/* ===================================================================================================================================================
    ローディングダイアログ

*/

function message_loading_init() {

    var handleCancel = function() {
        if (YAHOO.shf.conn != null) {
            YAHOO.shf.conn.conn.abort();
        }
        this.cancel();
    };
    YAHOO.shf.loading = 
            new YAHOO.widget.Dialog("wait",  
                                            { width: "240px", 
                                              fixedcenter: true, 
                                              close: false, 
                                              draggable: false, 
                                              zindex:4,
                                              modal: true,
                                              visible: false,
                                              buttons : [
                                                      { text:"キャンセル", handler:handleCancel}
                                                      ]
                                             } );

    YAHOO.shf.loading.setHeader("読み込み中");
    YAHOO.shf.loading.setBody("<img src=\"./images/loading.gif\"/>");
    YAHOO.shf.loading.render(document.body);

}
