<script>
    var create_bar = $('.create-product-bar');
  var create_percent = $('.create-product-percent');
  $(document).ready(function() {

    $('form.edit-offer-form').ajaxForm({
          url: Wo_Ajax_Requests_File() + '?f=offer&s=edit_offer',
          beforeSend: function() {
           var percentVal = '0%';
           create_bar.width(percentVal);
           create_percent.html(percentVal);
           
           
            $('.edit-offer-form').find('.last-sett-btn .ball-pulse').fadeIn(100);
          },
          uploadProgress: function (event, position, total, percentComplete) {
             var percentVal = percentComplete + '%';
             create_bar.width(percentVal);
             $('.edit-offer-form').find('.create-product-progress').slideDown(200);
             create_percent.html(percentVal);
          },
          success: function(data) {
           if (data.status == 200) {
             $('.edit-offer-form').find('.app-general-alert').html("<div class='alert alert-success'><?php echo($wo['lang']['offer_successfully_edited']) ?></div>");
               $('.edit-offer-form').find('.alert-success').fadeIn(300);
               setTimeout(function (argument) {
                $('.edit-offer-form').find('.alert-success').fadeOut(300);
                window.location.reload(true);

               },3000);
           } else {
            $('.edit-offer-form').animate({
              scrollTop: $('html, body').offset().top //#DIV_ID is an example. Use the id of your destination on the page
          });
               $('.edit-offer-form').find('.app-general-alert').html('<div class="alert alert-danger">' + data.error + '</div>');
               $('.edit-offer-form').find('.alert-danger').fadeIn(300);
               setTimeout(function (argument) {
                $('.edit-offer-form').find('.alert-danger').fadeOut(300);

               },3000);
           }
           $('.edit-offer-form').find('.last-sett-btn .ball-pulse').fadeOut(100);
          }
      });
    
  });
  function Wo_GetNewActivities() {
      var before_activity_id = $('#activities-wrapper > .activity').attr('data-activity-id');
      if (typeof before_activity_id === 'undefined') {
           return false;
      }
      $.post(Wo_Ajax_Requests_File() + '?f=activities&s=get_new_activities', {
        before_activity_id: before_activity_id
      }, function (data) {
        if(data.status == 200) {
          $('.activities-wrapper').prepend(data.html);
        }
      });
    }
    function Wo_GetMoreActivities() {
      var activity_container = $('.activity-container');
      var after_activity_id = $('#activities-wrapper .activity:last').attr('data-activity-id');
      Wo_progressIconLoader(activity_container);
      $.post(Wo_Ajax_Requests_File() + '?f=activities&s=get_more_activities', {
        after_activity_id: after_activity_id
      }, function (data) {
        if(data.status == 200) {
          if(data.html.length == 0) {
            $('.no-activities').html(data.message);
          } else {
            $('#activities-wrapper').append(data.html);
          }
          $("#activities-wrapper").animate({
            scrollTop: $('#activities-wrapper')[0].scrollHeight
          }, 100);
          Wo_progressIconLoader(activity_container);
        }
      });
    };

function Wo_RegisterReactionLike(element,reaction_icon){
    var reaction = $(element).attr('data-reaction-id');
    var post_id = $(element).attr('data-post-id');
    if ($('#react_'+post_id).attr('data_react') == 1) {
      return false;
    }
    var path = "<?php echo $wo['config']['theme_url']?>";
    var lang = $(element).attr('data-reaction-lang');
    if (!post_id || !reaction) {
      return false;
    }

    $('.reactions-box-container-'+post_id).fadeOut(1);

    var reaction_color = '';

  //   switch (reaction) {
  //     case 'Like':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/like-sm.png" alt="<?php echo $wo['lang']['like'];?>"></div>';
  //         reaction_color = '#1da1f2';
  //         break;
  //     case 'Love':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/love-sm.png" alt="<?php echo $wo['lang']['love'];?>"></div>';
  //         reaction_color = '#f25268';
  //         break;
  //     case 'HaHa':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/haha-sm.png" alt="<?php echo $wo['lang']['haha'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Wow':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/wow-sm.png" alt="<?php echo $wo['lang']['wow'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Sad':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/sad-sm.png" alt="<?php echo $wo['lang']['sad'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Angry':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/angry-sm.png" alt="<?php echo $wo['lang']['angry'];?>"></div>';
  //         reaction_color = '#f7806c';
  //         break;
  // }
  reaction_icon = '<div class="inline_post_emoji"><img class="" src="'+reaction_icon+'"></div>';

    $('.status-reaction-'+post_id).html(reaction_icon+lang).css({"color": reaction_color});
    $('.status-reaction-'+post_id).addClass("active-like");
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'register_reaction', post_id: post_id, reaction: reaction}, function (data) {
      if(data.status == 200) {
        $('.post-reactions-icons-'+post_id).html(data.reactions);
        
      }
      if (data.can_send == 1) {
        Wo_SendMessages();
      }
      $('#react_'+post_id).attr('data_react','1');
    });
}


function Wo_RegisterReaction(element,reaction_icon){
    var reaction = $(element).attr('data-reaction-id');
    var post_id = $(element).attr('data-post-id');
    var path = "<?php echo $wo['config']['theme_url']?>";
    var lang = $(element).attr('data-reaction-lang');
    if (!post_id || !reaction) {
      return false;
    }

    $('.reactions-box-container-'+post_id).fadeOut(1);

    var reaction_color = '';
    reaction_icon = '<div class="inline_post_emoji"><img class="" src="'+reaction_icon+'"></div>';

  //   switch (reaction) {
  //     case 'Like':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/like-sm.png" alt="<?php echo $wo['lang']['like'];?>"></div>';
  //         reaction_color = '#1da1f2';
  //         break;
  //     case 'Love':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/love-sm.png" alt="<?php echo $wo['lang']['love'];?>"></div>';
  //         reaction_color = '#f25268';
  //         break;
  //     case 'HaHa':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/haha-sm.png" alt="<?php echo $wo['lang']['haha'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Wow':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/wow-sm.png" alt="<?php echo $wo['lang']['wow'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Sad':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/sad-sm.png" alt="<?php echo $wo['lang']['sad'];?>"></div>';
  //         reaction_color = '#f3b715';
  //         break;
  //     case 'Angry':
  //         reaction_icon = '<div class="inline_post_emoji"><img class="" src="<?php echo $wo['config']['theme_url'];?>/reaction/angry-sm.png" alt="<?php echo $wo['lang']['angry'];?>"></div>';
  //         reaction_color = '#f7806c';
  //         break;
  // }

    $('.status-reaction-'+post_id).html(reaction_icon+lang).css({"color": reaction_color});
    $('.status-reaction-'+post_id).addClass("active-like");
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'register_reaction', post_id: post_id, reaction: reaction}, function (data) {
      if(data.status == 200) {
        $('.post-reactions-icons-'+post_id).html(data.reactions);
		    
      }
      if (data.can_send == 1) {
        Wo_SendMessages();
      }
      $('#react_'+post_id).attr('data_react','1');
    });
}

function Wo_RegisterFollowNotify(id, type) {
  var _follow_con = $('[id=Notify-' + id + ']');
  data_next = $('[id=Notify-' + id + ']').attr('title');
  title = $('[id=Notify-' + id + ']').attr('data_next');
  html_ = '<span id="Notify-'+id+'" title="'+title+'" data_next="'+data_next+'"><button type="button" onclick="Wo_RegisterFollowNotify('+id+',0)" class="btn-active btn btn-default btn-sm wo_following_btn wo_user_folw_empty_btns"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell-off"><path d="M13.73 21a2 2 0 0 1-3.46 0"></path><path d="M18.63 13A17.89 17.89 0 0 1 18 8"></path><path d="M6.26 6.26A5.86 5.86 0 0 0 6 8c0 7-3 9-3 9h14"></path><path d="M18 8a6 6 0 0 0-9.33-5"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg></button></span>';
  if (type == 0) {
    html_ = '<span id="Notify-'+id+'" title="'+title+'" data_next="'+data_next+'"><button type="button" onclick="Wo_RegisterFollowNotify('+id+',1)" class="btn btn-default btn-sm wo_user_folw_empty_btns"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bell"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path><path d="M13.73 21a2 2 0 0 1-3.46 0"></path></svg></button></span>';
  }

  _follow_con.replaceWith(html_);

  $.get(Wo_Ajax_Requests_File(), {f: 'notify_user', following_id: id}, function(data) {});

}

function Wo_RegisterFollow(id, is_confirm,show_modal= false) {

  var _follow_con = $('[id=Follow-' + id + ']');
  is_confirm_f    = 0;

  if (is_confirm == 1) {
    is_confirm_f = 1;
  }
  if (show_modal == true) {
    $('#unfriend_btn').attr('onclick', 'Wo_RegisterFollow('+id+')');
    $('#un_friend_modal').modal('show');
    return false;
  }
  $('#un_friend_modal').modal('hide');

  <?php if ($wo['config']['connectivitySystem'] == 0): ?>
    html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ', ' + is_confirm_f + ')" class="btn-active btn btn-default btn-sm wo_following_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><polyline points="17 11 19 13 23 9"></polyline></svg><span class="button-text"> <?php echo $wo["lang"]["following_btn"];?></span></button>';
    if (is_confirm_f == 1) {
      html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ', ' + is_confirm_f + ')" class="btn-requested btn btn-default btn-sm wo_request_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg><span class="button-text"> <?php echo $wo["lang"]["requested"];?></span></button>';
    }
    if (_follow_con.find('button').hasClass('btn-active') || _follow_con.find('button').hasClass('btn-requested')) {
      html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ', ' + is_confirm_f + ')" class="btn btn-default btn-sm wo_follow_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg><span class="button-text"> <?php echo $wo["lang"]["follow"];?></span></button>';
    }
  <?php else: ?>
    // if (_follow_con.find('button').hasClass('btn-active')) {
    //   if (!confirm("<?php echo $wo['lang']['are_you_sure_unfriend'] ?>")) {
    //       return false;
    //   }
    // }

    html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ')" class="btn-requested btn btn-default btn-sm wo_request_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg><span class="button-text"> <?php echo $wo["lang"]["requested"];?></span></button>';
    if (_follow_con.find('button').hasClass('btn-requested') || _follow_con.find('button').hasClass('btn-active')) {
      html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ')" class="btn btn-default btn-sm wo_follow_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg><span class="button-text"> <?php echo $wo["lang"]["add_friend"];?></span></button>';
    }

  <?php endif; ?>

  _follow_con.html(html_);

  $.get(Wo_Ajax_Requests_File(), {f: 'follow_user', following_id: id}, function(data) {
    if (data.can_send == 1) {
      Wo_SendMessages();
    }

    else if(data.status == 400){
      html_ = '<button type="button" onclick="Wo_RegisterFollow(' + id + ')" class="btn btn-default btn-sm wo_follow_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path><circle cx="8.5" cy="7" r="4"></circle><line x1="20" y1="8" x2="20" y2="14"></line><line x1="23" y1="11" x2="17" y2="11"></line></svg><span class="button-text"> <?php echo $wo["lang"]["add_friend"];?></span></button>';
      _follow_con.html(html_);

      $("#modal-alert").modal('show');

      Wo_Delay(function(){
        $("#modal-alert").modal('hide');
      },3000);
    }
  });

}

function Wo_RegisterGroupJoin(id, is_confirm) {
  var _join_con = $('[id=join-' + id + ']');
  is_confirm_ = 0;
  if (is_confirm == 1) {
    is_confirm_ = 1;
  }
  html_join = '<button type="button" onclick="Wo_RegisterGroupJoin(' + id + ', ' + is_confirm_ + ')" class="btn-active btn btn-default btn-sm wo_following_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg><span class="button-text"> <?php echo $wo["lang"]["joined"];?></span></button>';
  if (is_confirm_ == 1) {
    html_join = '<button type="button" onclick="Wo_RegisterGroupJoin(' + id + ', ' + is_confirm_ + ')" class="btn-requested btn btn-default btn-sm wo_request_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg><span class="button-text"> <?php echo $wo["lang"]["requested"];?></span></button>';
  }
  if (_join_con.find('button').hasClass('btn-requested') || _join_con.find('button').hasClass('btn-active')) {
    html_join = '<button type="button" onclick="Wo_RegisterGroupJoin(' + id + ', ' + is_confirm_ + ')" class="btn btn-default btn-sm wo_follow_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="8" x2="12" y2="16"></line><line x1="8" y1="12" x2="16" y2="12"></line></svg><span class="button-text"> <?php echo $wo["lang"]["join"];?></span></button>';
  }
  _join_con.html(html_join);
  $.get(Wo_Ajax_Requests_File(), {f: 'join_group', group_id: id}, function (data) {
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}

function Wo_RegisterEventGoing(id) {
  var _join_con = $('[id=going-' + id + ']');
  html_join = '<button type="button" onclick="Wo_RegisterEventGoing(' + id + ')" class="btn-active btn btn-default btn-sm"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg><span class="button-text"> <?php echo $wo["lang"]["going"];?></span></button>';
  if (_join_con.find('button').hasClass('btn-active')) {
    html_join = '<button type="button" onclick="Wo_RegisterEventGoing(' + id + ')" class="btn btn-default btn-sm"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-calendar"><rect x="3" y="4" width="18" height="18" rx="2" ry="2"></rect><line x1="16" y1="2" x2="16" y2="6"></line><line x1="8" y1="2" x2="8" y2="6"></line><line x1="3" y1="10" x2="21" y2="10"></line></svg><span class="button-text"> <?php echo $wo["lang"]["go"];?></span></button>';
  }
  _join_con.html(html_join);
  $.get(Wo_Ajax_Requests_File(), {f: 'go_event', event_id: id}, function (data) {
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}

function Wo_RegisterEventInterested(id) {
  var _join_con = $('[id=interested-' + id + ']');
  html_join = '<button type="button" onclick="Wo_RegisterEventInterested(' + id + ')" class="btn-active btn btn-default btn-sm"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M10,17L5,12L6.41,10.58L10,14.17L17.59,6.58L19,8M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg><span class="button-text"> <?php echo $wo["lang"]["interested"];?></span></button>';
  if (_join_con.find('button').hasClass('btn-active')) {
    html_join = '<button type="button" onclick="Wo_RegisterEventInterested(' + id + ')" class="btn btn-default btn-sm"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="currentColor" d="M12.1,18.55L12,18.65L11.89,18.55C7.14,14.24 4,11.39 4,8.5C4,6.5 5.5,5 7.5,5C9.04,5 10.54,6 11.07,7.36H12.93C13.46,6 14.96,5 16.5,5C18.5,5 20,6.5 20,8.5C20,11.39 16.86,14.24 12.1,18.55M16.5,3C14.76,3 13.09,3.81 12,5.08C10.91,3.81 9.24,3 7.5,3C4.42,3 2,5.41 2,8.5C2,12.27 5.4,15.36 10.55,20.03L12,21.35L13.45,20.03C18.6,15.36 22,12.27 22,8.5C22,5.41 19.58,3 16.5,3Z" /></svg><span class="button-text"> <?php echo $wo["lang"]["interested"];?></span></button>';
  }
  _join_con.html(html_join);
  $.get(Wo_Ajax_Requests_File(), {f: 'interested_event', event_id: id}, function (data) {
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}


function Wo_RegisterPageLike(id) {
  element_like = $('[id=like-' + id + ']');
  html_like = '<button type="button" onclick="Wo_RegisterPageLike(' + id + ')" class="btn-active btn btn-default btn-sm wo_following_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg><span class="button-text"> <?php echo $wo["lang"]["liked"];?></span></button>';
  if (element_like.find('button').hasClass('btn-active')) {
  	html_like = '<button type="button" onclick="Wo_RegisterPageLike(' + id + ')" class="btn btn-default btn-sm wo_follow_btn" id="wo_useract_btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg><span class="button-text"> <?php echo $wo["lang"]["like"];?></span></button>';
  }
  element_like.html(html_like);
  $.get(Wo_Ajax_Requests_File(), {f: 'like_page', page_id: id}, function (data) {
    if(data.status == 200) {
      if ($('.sidebar-listed-page-like').attr('data-type') == "sidebar") {
        setTimeout(function () {
          Wo_ReloadSideBarPages();
        }, 500);
      }
    }
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}

function Wo_RegisterLike(post_id) {
  var post = $('[id=post-' + post_id + ']');
  html_like = '<span class="active-like"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-thumbs-up"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg><span class="like-btn-mobile"> <?php echo $wo["lang"]["liked"];?></span></span>';
  if (post.find("[id^=like-button]").parent().find('.active-like').length > 0) {
  	html_like = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> <path fill="currentColor" d="M23,10C23,8.89 22.1,8 21,8H14.68L15.64,3.43C15.66,3.33 15.67,3.22 15.67,3.11C15.67,2.7 15.5,2.32 15.23,2.05L14.17,1L7.59,7.58C7.22,7.95 7,8.45 7,9V19A2,2 0 0,0 9,21H18C18.83,21 19.54,20.5 19.84,19.78L22.86,12.73C22.95,12.5 23,12.26 23,12V10M1,21H5V9H1V21Z"></path> </svg> <span class="like-btn-mobile"> <?php echo $wo["lang"]["like"];?></span>';
  } 
  <?php if ($wo['config']['second_post_button'] == 'dislike') { ?>
   post.find("[id^=wonder-button]").html('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-thumbs-down"><path d="M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"></path></svg> <span class="like-btn-mobile"> <?php echo $wo["lang"]["dislike"];?></span>');
  <?php } ?>
  post.find("[id^=like-button]").html(html_like);
  $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'register_like', post_id: post_id}, function (data) {
    if(data.status == 200) {
      post.find("[id^=likes]").text(data.likes);
      post.find("[id^=wonders]").text(data.wonders);
    } else {
      post.find("[id^=likes]").text(data.likes);
      post.find("[id^=wonders]").text(data.wonders);
    }
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}

function Wo_RegisterWonder(post_id) {
  var post = $('[id=post-' + post_id + ']');
  wonder_icon = '<?php echo $wo["second_post_button_icon"]?>';
  wonder_lang = "<?php echo $wo['lang']['wonder']; ?>";
  wonder_lang_2 = "<?php echo $wo['lang']['wondered']; ?>";
  <?php if ($wo['config']['second_post_button'] == 'dislike') { ?>
  wonder_lang = "<?php echo $wo['lang']['dislike']; ?>";
  wonder_lang_2 = "<?php echo $wo['lang']['disliked']; ?>";
  <?php } ?>
  html_wonder = '<span class="active-wonder">' + wonder_icon + '<span class="like-btn-mobile">' + wonder_lang_2 + '</span></span>';
  if (post.find("[id^=wonder-button]").parent().find('.active-wonder').length > 0) {
  	html_wonder = '' + wonder_icon + '<span class="like-btn-mobile">' + wonder_lang + '</span>';
  } 
  post.find("[id^=wonder-button]").html(html_wonder);
  <?php if ($wo['config']['second_post_button'] == 'dislike') { ?>
   post.find("[id^=like-button]").html('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-thumbs-up"><path d="M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"></path></svg> <span class="like-btn-mobile"> <?php echo $wo["lang"]["like"];?></span>');
  <?php } ?>
  $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'register_wonder', post_id: post_id}, function (data) {
    if(data.status == 200) {
      post.find("[id^=wonders]").text(data.wonders);
      post.find("[id^=likes]").text(data.likes);
    } else {
      post.find("[id^=wonders]").text(data.wonders);
      post.find("[id^=likes]").text(data.likes);
    }
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
  });
}
function Wo_IsLangValid(lang){
  var langs = [ "en", "tr","fr","es","nl","de","it","pt","ru","ar"]; 
  if (lang && langs.indexOf(lang) != -1) {
    return true;
  }
  else{
    return false;
  }
}
function Wo_DetectTextLang(text){
  var lcode = false;
  if (text || typeof(text) == 'string') {
    guessLanguage.info(text, function(lang) {
    lcode = lang[0];
    });
  }
  return lcode;
}
function Wo_Translate(id,lang){
  if (!id || !lang && Wo_IsLangValid(lang)) {
    return false;
  }else{
    var translatable_text = $("[data-translate-text="+id+"]").text();
    if (lang == Wo_DetectTextLang(translatable_text)) {
      $("[data-trans-btn=" + id + "]").removeAttr('onclick')
      return false;
    }
    $.ajax({
      url: 'https://translate.yandex.net/api/v1.5/tr.json/translate',
      type: 'GET',
      dataType: 'json',
      data: {
        key:'<?php echo $wo['config']['yandex_translation_api']; ?>',
        text:String(translatable_text),
        lang:String(lang)},
    }).done(function(data) {
      if (data.code == 200) {
        $("[data-translate-text="+id+"]").text(data.text[0])
        $("[data-trans-btn=" + id + "]").removeAttr('onclick')
      }
    }).fail(function() {
      console.log("translation error");
    })
  }
}

$(document).on('click', '#night_mode_toggle', function(event) {
  mode = $(this).attr('data-mode');
  if (mode == 'night') {
      $('head').append('<link rel="stylesheet" href="<?php echo $wo['config']['theme_url'];?>/stylesheet/dark.css<?php echo $wo['update_cache']; ?>" id="night-mode-css">');
      $('#night_mode_toggle').attr('data-mode', 'day');
      $('#night-mode-text').text('<?php echo $wo['lang']['day_mode']?>');
  } else {
      $('#night-mode-css').remove();
      $('#night_mode_toggle').attr('data-mode', 'night');
      $('#night-mode-text').text('<?php echo $wo['lang']['night_mode']?>');
  }
  $.post(Wo_Ajax_Requests_File() + '?mode=' + mode);
});

$(document).on('click', '#share_post_on_btn', function(event) {
  text = $('#share_post_text').val();
  type = $('#SearchForInputType').val();
  post_id = $('#SearchForInputPostId').val();
  type_id = $('#SearchForInputTypeId').val();
  self = this;
  $(this).text('<?php echo($wo['lang']['please_wait']) ?>');
  $(this).attr('disabled', 'true');
    $.ajax({
      url: Wo_Ajax_Requests_File(),
      type: 'GET',
      dataType: 'json',
      data: {f: 'share_post_on',s:type,type_id:type_id,post_id:post_id,text:text},
    })
    .done(function(data) {
      $(self).text('<?php echo($wo['lang']['share']) ?>');
      $(self).removeAttr('disabled');
      if (data.status == 200) {
        $('.share_post_modal_alert').html('<div class="alert alert-success"><?php echo($wo['lang']['post_shared_successfully']) ?></div>');

        setTimeout(function () {
          $('#share_post_modal').modal('hide');
        },2000);
      }
      else{
        $('.share_post_modal_alert').html("<div class='alert alert-danger'><?php echo($wo['lang']['cant_share_own']) ?></div>");
        setTimeout(function () {
          $('.share_post_modal_alert').html('');
        },2000);
      }
    })
    .fail(function() {
    })
    .always(function() {
    });
});

$(document).on('change', '#share_type_select', function(event) {
  var type = $(this).val();
  if (type == 'user') {
    $('.search_for_form').hide(400);
    $('#type_user_name').show(400);
    $('#SearchForInputType').val('user');
  }
  else if(type == 'page'){
    $('.search_for_form').hide(400);
    $('#type_page_name').show(400);
    $('#SearchForInputType').val('page');
  }
  else if(type == 'group'){
    $('.search_for_form').hide(400);
    $('#type_group_name').show(400);
    $('#SearchForInputType').val('group');
  }
  else if(type == 'timeline'){
    $('.search_for_form').hide(400);
    $('#SearchForInputType').val('timeline');
  }
});

function Wo_LoadViewsInfo(self) {
  $('#load_more_info_btn').html('<?php echo $wo['lang']['please_wait'] ?>');
  var type = $(self).attr('data-type');
  var table = $(self).attr('table-type');
  var post_id = $(self).attr('post-id');
  var id   = $('.views_info_count').last().attr('data-row-id');
  var request = '';
  if (type == 'like') {
    request = 'get_post_likes';
  }
  if (type == 'wonder') {
    request = 'get_post_wonders';
  }
  if (type == 'share') {
    request = 'get_post_shared';
  }
  $.get(Wo_Ajax_Requests_File(), {
    f: 'posts',
    s: request,
    type:type,
    post_id: post_id,
    offset: id,
    table:table
  }, function (data) {
    if(data.status == 200) {
      if(data.html.length == 0) {
        $(self).css('display', 'none');
      } else {
        $('#views_info').append(data.html);
        $('#load_more_info_btn').html('<?php echo $wo['lang']['load_more'] ?>');
      }
    }
    $('#load_more_info_btn').html('<?php echo $wo['lang']['load_more'] ?>');
  });
}

function Wo_LoadReactedUsers(type) {
  $('#reacted_users_box').html('<div class="lb-preloader" style="display:block"><svg width="50px" height="50px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect><circle cx="50" cy="50" r="40" stroke="#676d76" fill="none" stroke-width="6" stroke-linecap="round"><animate attributeName="stroke-dashoffset" dur="1.5s" repeatCount="indefinite" from="0" to="502"></animate><animate attributeName="stroke-dasharray" dur="1.5s" repeatCount="indefinite" values="150.6 100.4;1 250;150.6 100.4"></animate></circle></svg></div>');
  var post_id = $('.reacted_users_load_more').attr('post-id');
  var col = $('.reacted_users_load_more').attr('col-type');
  $.get(Wo_Ajax_Requests_File(), {
    f: 'posts',
    s: 'get_post_reacted',
    type:type,
    post_id: post_id,
    col:col
  }, function (data) {
    if(data.status == 200) {
      if(data.html.length == 0) {
        $('.reacted_users_load_more').css('display', 'none');
        $('.reacted_users_load_more').attr('data-type', '');
        $('#reacted_users_box').html('<span class="view-more-wrapper text-center">' + data.message + '</span>');
      } else {
        $('.reacted_users_load_more').attr('data-type', type);
        $('.reacted_users_load_more').attr('post-id', post_id);
        $('.reacted_users_load_more').attr('col-type', col);
        $('#load_more_reacted_btn').html('<?php echo $wo['lang']['load_more'] ?>');
        $('.reacted_users_load_more').css('display', 'inline');
        $('#reacted_users_box').html(data.html);
      }
    }
    //$('#load_more_info_btn').html('<?php echo $wo['lang']['load_more'] ?>');
  });
}

function Wo_LoadMoreReactedUsers(self) {
  $('.reacted_users_load_more').find('#load_more_reacted_btn').html('<?php echo $wo['lang']['please_wait'] ?>');
  var type = $(self).attr('data-type');
  var post_id = $(self).attr('post-id');
  var id   = $('.views_info_count').last().attr('data-row-id');
  var col = $('.reacted_users_load_more').attr('col-type');
  var request = 'get_post_reacted';
  $.get(Wo_Ajax_Requests_File(), {
    f: 'posts',
    s: request,
    type:type,
    post_id: post_id,
    offset: id,
    col:col
  }, function (data) {
    if(data.status == 200) {
      if(data.html.length == 0) {
        $(self).css('display', 'none');
      } else {
        $('#reacted_users_box').append(data.html);
        $('.reacted_users_load_more').find('#load_more_reacted_btn').html('<?php echo $wo['lang']['load_more'] ?>');
      }
    }
    $('.reacted_users_load_more').find('#load_more_reacted_btn').html('<?php echo $wo['lang']['load_more'] ?>');
  });
}

function Wo_SortComments(type,post_id) {
  if (type == 'top') {
    $('.order-text-'+post_id).text('<?php echo($wo['lang']['top']) ?>');
  }
  else{
    $('.order-text-'+post_id).text('<?php echo($wo['lang']['latest']) ?>');
  }
  main_wrapper = $('#post-' + post_id);
  view_more_wrapper = main_wrapper.find('.view-more-wrapper');
  Wo_progressIconLoader(view_more_wrapper);
  $('#post-' + post_id).find('.view-more-wrapper .ball-pulse').fadeIn(100);
  $.get(Wo_Ajax_Requests_File(), {
    f: 'posts',
    s: 'load_more_comments_sort',
    post_id: post_id,
    type: type
  }, function (data) {
    if(data.status == 200) {
      main_wrapper.find('.comments-list').html(data.html);
      $('.ball-pulse-'+post_id).fadeOut('100');
    }
  });
}

function count_char(self,id) {
  <?php if ($wo['config']['maxCharacters'] != 10000) { ?>
  $(self).limit("<?php echo $wo['config']['maxCharacters']?>", '#charsLeft_'+id);
  <?php } ?>
}

function ApplyJobNow(job_id) {
  $.post(Wo_Ajax_Requests_File()+'?f=job&s=get_apply_modal', {job_id: job_id}, function(data, textStatus, xhr) {
    if (data.status == 200) {
      $('#apply-job-modal').html(data.html);
      $('#apply-job-modal').modal('show');
    }
  });
}

$(document).on('change', '#i_currently_work', function(event) {
  if ($('#i_currently_work').is(":checked")) {
    $('#experience_end_date').css('display', 'none');
  }
  else{
    $('#experience_end_date').css('display', 'block');
  }
});




function Wo_GetPaymentMethods(self) {
  var amount = $('#fund_donate_amount').val();
  var fund_id = $('#fund_donate_id').val();
  if (!amount || !fund_id) {
    $('#fund_donate_amount').attr('style', 'border-color: red !important');
    return false;
  }
  $('#fund_donate_amount').attr('style', 'border-color: unset');
  $(self).attr('disabled', 'true');
  $.get(Wo_Ajax_Requests_File() + '?f=funding&s=get_payment_donate_method&fund_id=' + fund_id + '&amount=' + amount, function (data) {
      if (data.status == 200) {
          $('#donate_for_fund_modal').html(data.html);
		  $('#dont_modal').modal('hide');
          $('#fund_payment_donate_modal').modal({
           show: true
          });
      }
      else{
        $('#amount_fund_alert').html('<div class="alert alert-danger">' + data['message'] + '</div>');
        setTimeout(function (argument) {
          $('#amount_fund_alert').html('');
        },2000);
      }
      $(self).removeAttr('disabled');
  });
}

function Wo_GetPayPalDonateLink(fund_id,amount) {
  if (!amount || !fund_id) {
    return false;
  }

  $('.btn-paypal').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");
  $.post(Wo_Ajax_Requests_File() + '?f=funding&s=get_paypal_url', {fund_id:fund_id,amount:amount}, function(data) {
    if (data.status == 200) {
      window.location.href = data.url;
    } else {
      $('.btn-paypal').attr('disabled', false).html("PayPal App not set yet.");
    }
  });
}

function Wo_StripeDonate(fund_id,amount,type = 'stripe') {
  if (!amount || !fund_id) {
    return false;
  }

  if (type == 'stripe') {
    $('.btn-cart').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");
  }
  else{
    $('.btn-alipay').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");
  }

  

  var handler = StripeCheckout.configure({
    key: "<?php echo $wo['config']['stripe_id'];?>",
    locale: 'english',
    image: '',
    token: function(token) {
    $('.modal-body').html('<i class="fa fa-spin fa-spinner"></i> <?php echo $wo['lang']['c_payment'] ?>');
    $('#pay-go-pro').modal({
      show: true
      });
      $.post(Wo_Ajax_Requests_File() + '?f=funding&s=stripe', {stripeToken:token.id,amount:amount,fund_id:fund_id}, function (data) {
        if (data.status == 200) {
          window.location.href = data.location;
        } else {
          $('.btn-cart').attr('disabled', false).html('<i class="fa fa-spin fa-spinner"></i> <?php echo $wo['lang']['payment_declined'] ?>');
        }
      });
    }
  });

  if (type == 'stripe') {
    handler.open({
      name: "<?php echo $wo['config']['siteName']?>",
      description: "<?php echo $wo['lang']['donate']?>",
      amount: amount*100,
      currency: '<?php echo $wo['config']['stripe_currency']?>',
      opened: function () {
        $('#pay-go-pro').modal('hide');
        $('.btn-cart').attr('disabled', false).html('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 58 58" xml:space="preserve"> <g id="XMLID_9_"> <path id="XMLID_114_" style="fill:#8798CC;" d="M54.783,50H3.217C1.44,50,0,48.56,0,46.783V11.217C0,9.44,1.44,8,3.217,8h51.566 C56.56,8,58,9.44,58,11.217v35.566C58,48.56,56.56,50,54.783,50"/> <rect id="XMLID_113_" y="13" style="fill:#556180;" width="58" height="8"/> <path id="XMLID_112_" style="fill:#B0D3F0;" d="M15,26H6c-0.553,0-1,0.448-1,1s0.447,1,1,1h9c0.553,0,1-0.448,1-1S15.553,26,15,26" /> <path id="XMLID_111_" style="fill:#B0D3F0;" d="M29,27c0-0.552-0.447-1-1-1h-9c-0.553,0-1,0.448-1,1s0.447,1,1,1h9 C28.553,28,29,27.552,29,27"/> <path id="XMLID_110_" style="fill:#B0D3F0;" d="M7,31H6c-0.553,0-1,0.448-1,1s0.447,1,1,1h1c0.553,0,1-0.448,1-1S7.553,31,7,31"/> <path id="XMLID_109_" style="fill:#B0D3F0;" d="M13,31h-2c-0.553,0-1,0.448-1,1s0.447,1,1,1h2c0.553,0,1-0.448,1-1S13.553,31,13,31 "/> <path id="XMLID_108_" style="fill:#B0D3F0;" d="M18,31h-1c-0.553,0-1,0.448-1,1s0.447,1,1,1h1c0.553,0,1-0.448,1-1S18.553,31,18,31 "/> <path id="XMLID_107_" style="fill:#B0D3F0;" d="M24,31h-2c-0.553,0-1,0.448-1,1s0.447,1,1,1h2c0.553,0,1-0.448,1-1S24.553,31,24,31 "/> <path id="XMLID_106_" style="fill:#B0D3F0;" d="M27.29,31.29C27.109,31.48,27,31.74,27,32c0,0.26,0.109,0.52,0.29,0.71 C27.478,32.89,27.728,33,28,33c0.26,0,0.519-0.11,0.71-0.29C28.89,32.52,29,32.26,29,32c0-0.26-0.11-0.52-0.29-0.71 C28.34,30.92,27.66,30.92,27.29,31.29"/> <rect id="XMLID_105_" x="36" y="34" style="fill:#91BAE1;" width="16" height="10"/> </g> </svg><?php echo $wo['lang']['credit_card'] ?>');
      }
    });
  }
  else{
    handler.open({
      name: "<?php echo $wo['config']['siteName']?>",
      description: "<?php echo $wo['lang']['donate']?>",
      amount: amount*100,
      alipay: true,
      currency: '<?php echo $wo['config']['stripe_currency']?>',
      opened: function () {
        $('#pay-go-pro').modal('hide');
        $('.btn-alipay').attr('disabled', false).html('<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 48 48" xml:space="preserve"><path d="M42 11v27a4 4 0 0 1-4 4H11a5 5 0 0 1-5-5V11a5 5 0 0 1 5-5h26a5 5 0 0 1 5 5z" fill="#5B9EDD"/><path d="M29.91 27.17C32 23.641 33 19 33 19h-7v-2h9v-2h-9v-3.98L22 11v4h-9v2h9v2h-8v2s13.125 0 14.5-.01c-.281.793-.99 3.189-2.015 5.055C22.602 24.84 19.019 24 16.143 24c-6.898 0-8.428 3.481-8.102 6.664.263 2.54 2.145 6.248 7.893 6.248 5.251 0 9.49-3.023 12.099-6.622C33.008 32.591 38.263 34.909 42 37v-6.038c-3.951-1.361-8.11-2.431-12.09-3.792zm-14.812 7.592c-4.858 0-5.61-2.75-5.694-4.392-.079-1.436.886-4.132 6.371-4.132 2.04 0 5.276 1.046 8.909 2.57-2.053 2.708-5.343 5.954-9.586 5.954z" fill="#FFF"/></svg>Alipay');
      }
    });
  }
}

function Wo_BankTransferDonate(fund_id,amount) {
  if (!amount || !fund_id) {
    return false;
  }

  $('.bank_payment').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");

  $('#configreset').click();
  $(".prv-img").html('<div class="thumbnail-rendderer"><div><h4 class="bold"><?php echo $wo['lang']['drop_img_here']; ?></h4><div class="error-text-renderer"></div><div><span><?php echo $wo['lang']['or']; ?></span><p><?php echo $wo['lang']['browse_to_upload']; ?></p></div></div> </div>');
  $("#blog-alert").html('');
  $('#bank_donate_price').val(amount);
  $('#bank_donate_fund_id').val(fund_id);
  $('#pay-go-pro').modal('hide');
  $('#bank_transfer_donate_modal').modal({
         show: true
        });
}

function Wo_BitcoinDonate(fund_id,amount) {
  if (!amount || !fund_id) {
    return false;
  }

  $('.btn-bitcoin').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");
  $('#pay-go-pro').modal('hide');
  $.get(Wo_Ajax_Requests_File() + '?f=donate_with_bitcoin&amount=' + amount+"&fund_id="+fund_id, function (data) {
    if (data.status == 200) {
      $(data.html).appendTo('body').submit();
    }
  });
}




function Wo_CheckOutCardDonate(fund_id,amount) {
  if (!amount || !fund_id) {
    return false;
  }

  $('.btn-check').attr('disabled', true).text("<?php echo $wo["lang"]["please_wait"]?>");
  $('#donate_check_amount').val(amount)
  $('#donate_check_fund_id').val(fund_id)

  $("#2checkout_alert_donate_wallet").html('');
  $('#pay-go-pro').modal('hide');
  $('#2checkout_wallet_donate_modal').modal({
        show: true
  });

}
function openInNewTab(url, id) {
   var myWindow = window.open(url, "", "width=600,height=700");
   return false;
}

function Wo_LiveComment(text,event,post_id,insert = 0) {
  text = $('[id=post-' + post_id + ']').find('.comment-textarea').val();
  if (text && (event.keyCode == 13 || insert == 1)) {
    if ($('#live_post_comments_'+post_id+' .live_comments').length >= 4) {
      $('#live_post_comments_'+post_id+' .live_comments').first().remove();
    }
      $('#live_post_comments_'+post_id).append('<div class="live_comments" live_comment_id=""><a class="pull-left" href="<?php echo($wo['user']['url']) ?>"><img class="live_avatar pull-left" src="<?php echo($wo['user']['avatar']) ?>" alt="avatar"></a><div class="comment-body" style="float: left;"><div class="comment-heading"><span><a href="<?php echo($wo['user']['url']) ?>" data-ajax="?link1=timeline&amp;u=<?php echo($wo['user']['username']) ?>" ><h4 class="live_user_h"> <?php echo($wo['user']['name']) ?> </h4></a></span><?php if ($wo['user']['verified'] == 1) { ?><span class="verified-color" data-toggle="tooltip" title="Verified User"><i class="fa fa-check-circle"></i></span><?php } ?><div class="comment-text">'+text+'</div></div></div><div class="clear"></div></div>');

  }
}

</script>