window.onload = function(){
  installEvent();
  (document.body ? document.body : document.documentElement).appendChild(
    createMessageBox(
      {
        backgroundColor : 'black',
        color           : 'white',
        broder          : 'solid thin',
//        position        : 'fixed',
        fromTop         : 0,
        fromLeft        : 0,
        height          : 200,
        width           : 200
      })
    );
  function installEvent(){
    $('data-editor').onsubmit = function(){
      $Ajax.Request(
        $('data-editor').action + '?req=JSON',
        function( req ){
          var json;
          eval( 'json=' +  req.responseText );
          $('msg_box').show( json.msg );
          if( json['ok'] ){
            window.setTimeout( function(){ location.href = json['next_page_url']; } , 1000 );
          }
          return false;
        },
        serializeForm( $('data-editor') ),
        'post'
        );
      return false;
    }
  }
}

