  function comment_add()
  {
      var month = document.getElementById("T_month").options[ document.getElementById("T_month").selectedIndex].value;
      var content = document.getElementById("postBody");

      var obj = document.getElementById("process_result");
      var url= "graphComment_process.php?";
      var qstr= 'type=post&month=' + month + "&content=" + encodeURIComponent(content.value);
      Element.update(obj, loading_text());

      var ajax= new Ajax.Request(url,{
          method: 'post',
          parameters: qstr,
          onSuccess:function (reqObj){
                      Element.update(obj, reqObj.responseText);
                        alert("新增留言完成 並 寄信通知記綠者!");
                        content.value=""; 
                        load_comment();
                      }
          });

  }

  function comment_del(cid)
  {
    if(confirm('確定要刪除此筆留言嗎？'))
    {
      var obj = document.getElementById("process_result");
      var url= "graphComment_process.php?";
      var qstr= 'type=del&cid=' + cid;

      Element.update(obj, loading_text());
      var ajax= new Ajax.Request(url,{
          method: 'post',
          parameters: qstr,
          onSuccess:function (reqObj){
                      Element.update(obj, reqObj.responseText);
                        alert("刪除留言完成!");
                        load_comment();
                      }
          });
    }
  }

  function reply_add(cid)
  {
      var content = document.getElementById("reply_" + cid).value;

      var obj = document.getElementById("process_result");
      var url= "graphReply_process.php?";
      var qstr= 'type=post&cid=' + cid + "&content=" + encodeURIComponent(content);

      Element.update(obj, loading_text());

      var ajax= new Ajax.Request(url,{
          method: 'post',
          parameters: qstr,
          onSuccess:function (reqObj){
                      Element.update(obj, reqObj.responseText);
                         alert("回覆留言完成  並 寄信通知記綠者!");
                        load_comment();
                      }
          });

  }

function showno2()
{
        alert("請先登錄為會員");
        location.href='MemRegPolicy.php';
}

function toExpand(content)
{
  object = document.getElementById(content);

 if(object.style.display == 'none')
   object.style.display = 'inline';
 else
   object.style.display = 'none';
}

function toShow(content)
{
  object = document.getElementById(content);
  object.style.display = 'inline';
}

function toHide(content)
{
  object = document.getElementById(content);
  object.style.display = 'none';
}


function reply(cid,mid)
{
var content = document.getElementById("reply_" + cid).value;
document.location.href='value.php?cid='+cid+'&mid='+mid+'&content='+content;
}




