function ajaxSubscribeBlog(obj,idBlog) {
  obj=$(obj);
  JsHttpRequest.query(
      DIR_WEB_ROOT+'/include/ajax/subscribeBlog.php',
        { idBlog: idBlog },
        function(result, errors) {
          if (!result) {
                msgErrorBox.alert('Error','Please try again later');
          }
            if (result.bStateError) {
              msgErrorBox.alert(result.sMsgTitle,result.sMsg);
            } else {
              msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
              if (obj)  {
                obj.set('value', aLang['subscribe_blog_subscribe']);
                if (result.bState) {
                  obj.set('value', aLang['subscribe_blog_unsubscribe']);
                }
              }
            }
        },
        true
    );
}

function ajaxSubscribeTopic(obj,idTopic) {
  obj=$(obj);
  JsHttpRequest.query(
      DIR_WEB_ROOT+'/include/ajax/subscribeTopic.php',
        { idTopic: idTopic },
        function(result, errors) {
          if (!result) {
                msgErrorBox.alert('Error','Please try again later');
          }
            if (result.bStateError) {
              msgErrorBox.alert(result.sMsgTitle,result.sMsg);
            } else {
              msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
              if (obj)  {
                obj.set('value', aLang['subscribe_topic_subscribe']);
                if (result.bState) {
                  obj.set('value', aLang['subscribe_topic_unsubscribe']);
                }
              }
            }
        },
        true
    );
}


function ajaxSetTopicRead(obj,idTopic) {
  obj=$(obj);
  obj.set('disable', 'disable');
  JsHttpRequest.query(
      DIR_WEB_ROOT+'/include/ajax/readTopic.php',
        { idTopic: idTopic },
        function(result, errors) {
          if (!result) {
                msgErrorBox.alert('Error','Please try again later');
                obj.set('disable', 'false');
          }
            if (result.bStateError) {
              msgErrorBox.alert(result.sMsgTitle,result.sMsg);
              obj.set('disable', 'false');
            } else {
              msgNoticeBox.alert(result.sMsgTitle,result.sMsg);
              newnote = obj.getPrevious();
              obj.destroy();
              newnote.destroy();
            }
        },
        true
    );
}

