/**
 * /js/alike/bug_report.js
 * Encoding: UTF-8
 * Copyright: Alike Co.,Ltd.
 */
(function($){
    // 初期化実行
    $(function(){
        //
        setTimeout(init, 0);
    });
    
    /**
     * 初期化
     * 
     * @param
     * @return
     */
    function init()
    {
        // バグレポート
        $('#bugReportSubmitButton').click(function(){
            submitBugReport();
        });
    };
     
     /**
      * 
      * 
      * @param
      * @return
      */
     function submitBugReport()
     {
         var commentElem = $('#bugReportComment');
         var ckey = $('#bugReportConfirmKey').val();
         
         if (commentElem.val() == "")
         {
             $('#bugReportError').show();
             commentElem.focus();
             return;
         }
         
         $.post("/service/flag.php",
             {   
                 ckey: ckey,
                 report_type: "bug_report", 
                 report_reason: "anything", 
                 comment: commentElem.val()
             },
             function(data)
             {
                 if(data == "true")
                 {
                     $('#bugReportForm').toggle();
                     $('#bugReportMessage').toggle();
                     $('#bugReportError').hide();
                 }
             }
         );
     }
})(jQuery);

