<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_RegisterStoryReaction(element,reaction_icon,is_html) {
  var reaction = parseInt($(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;
  }
  $('.like-story-lightbox').addClass('active');
  $.get(Wo_Ajax_Requests_File(), {f: 'status', s: 'register_reaction', story_id: post_id, reaction: reaction}, function (data) {
    if(data.status == 200) {
      <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
  if ($('#react_'+post_id).attr('data_react') == 0) {
    //socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "added" });
  }
  <?php } ?>
      $('.post-reactions-icons-'+post_id).html(data.reactions);
      
    }
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
    //$('#react_'+post_id).attr('data_react','1');
  });
}
function Wo_RegisterMessageReaction(element,reaction_icon,is_html) {
  var reaction = parseInt($(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;
  }
  <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
    socket.emit("register_reaction", {
        type: 'messages',
        id: post_id,
        reaction: reaction,
        user_id: _getCookie("user_id")
      })
    
  <?php }else{ ?>
  $.get(Wo_Ajax_Requests_File(), {f: 'messages', s: 'register_reaction', message_id: post_id, reaction: reaction}, function (data) {
    if(data.status == 200) {
      $('.post-reactions-icons-m-'+post_id).html(data.reactions);
      
    }
    if (data.can_send == 1) {
      Wo_SendMessages();
    }
    //$('#react_'+post_id).attr('data_react','1');
  });
  <?php } ?>
  $('.reactions-box-container-'+post_id).fadeOut(50);
}
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) {
         <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
      if ($('#react_'+post_id).attr('data_react') == 0) {
        socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "added" });
      }
      <?php } ?>
        $('.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) {
        <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
    //if ($('#react_'+post_id).attr('data_react') == 0) {
      socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "added" });
    //}
    <?php } ?>
        $('.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) {

    <?php if ($wo['config']['connectivitySystem'] == 0): ?>
    
    if (_follow_con.find('button').hasClass('btn-active') || _follow_con.find('button').hasClass('btn-requested')) {
      if (node_socket_flow == "1") {
        if (is_confirm_f == 1) {
          socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "request" });
        } else {
          socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "added" });
        }
        
      }
    } else {
      if (node_socket_flow == "1") {
        if (is_confirm_f == 1) {
         socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "removed" });
          } else {
            socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "request_removed" });
          }
      }
    }
  <?php else: ?>
    if (_follow_con.find('button').hasClass('btn-requested') || _follow_con.find('button').hasClass('btn-active')) {
      if (node_socket_flow == "1") {
         socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "request" });
      }
    } else {
      if (node_socket_flow == "1") {
         socket.emit("user_notification", { to_id: id, user_id: _getCookie("user_id"), type: "request_removed" });
      }
    }
  <?php endif; ?>

    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 (node_socket_flow == "1") {
      if (_join_con.find('button').hasClass('btn-active') || _join_con.find('button').hasClass('btn-requested')) {
          socket.emit("group_notification", { to_id: id, user_id: _getCookie("user_id"), type: "added" });
      } else {
          socket.emit("group_notification", { to_id: id, user_id: _getCookie("user_id"), type: "removed" });
      }
    }
    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 (node_socket_flow == "1") {
      if (_join_con.find('button').hasClass('btn-main')) {
          socket.emit("event_notification", { to_id: id, user_id: _getCookie("user_id"), type: "added" });
      } else {
          socket.emit("event_notification", { to_id: id, user_id: _getCookie("user_id"), type: "removed" });
      }
    }
    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 (node_socket_flow == "1") {
      if (_join_con.find('button').hasClass('btn-main')) {
          socket.emit("event_notification", { to_id: id, user_id: _getCookie("user_id"), type: "added" });
      } else {
          socket.emit("event_notification", { to_id: id, user_id: _getCookie("user_id"), type: "removed" });
      }
    }
    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 (node_socket_flow == "1") {
        if (element_like.find('button').hasClass('btn-active')) {
           socket.emit("page_notification", { to_id: id, user_id: _getCookie("user_id"), type: "added"});
        } else {
          socket.emit("page_notification", { to_id: id, user_id: _getCookie("user_id"), type: "removed"});
        }
      }
      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 (post.find("[id^=like-button]").parent().find('.active-like').length > 0) {
      if (node_socket_flow == "1") { socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "added" }); }
    } else {
      if (node_socket_flow == "1") { socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "removed" });}
    }
    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 (post.find("[id^=wonder-button]").parent().find('.active-wonder').length > 0) {
      if (node_socket_flow == "1") { socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "added" }); }
    } else {
      if (node_socket_flow == "1") { socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "removed" });}
    }
    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) {
       if (node_socket_flow == "1") {
          socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id")});
        }
      $(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 = 'credit_card') {
  if (!amount || !fund_id) {
    return false;
  }

  if (type == 'credit_card') {
    $('.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 stripe = Stripe('<?php echo $wo['config']['stripe_id'];?>');
  $.post(Wo_Ajax_Requests_File() + '?f=stripe&s=session', {amount: amount,type:'fund',fund_id:fund_id,payment_type:type}, function(data, textStatus, xhr) {
    if (data.status == 200) {
      return stripe.redirectToCheckout({ sessionId: data.sessionId });
    }
  });
}

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>');

  }
}
function Wo_ReplyChatMessage(chat_id,id) {
  $('.message_reply_id_'+chat_id).val(id);
  $('.message_reply_text_'+chat_id+' span').find('.reply_content').remove();
  if ($("#message_text_reply_"+id).length > 0 && $("#message_text_reply_"+id).html() != '') {
    $('.message_reply_text_'+chat_id+' span').prepend('<p class="reply_content">'+$("#message_text_reply_"+id).html()+'</p>')
  }
  else if($('#message_media_reply_'+id).length > 0 && $('#message_media_reply_'+id).find('img').length > 0){
    $('.message_reply_text_'+chat_id+' span').prepend('<div class="message-user-image pull-left reply_content"><img src="'+$('#message_media_reply_'+id).find('img').attr('src')+'" alt="User image"></div>')
  }
  $('.message_reply_text_'+chat_id).fadeIn(50);
}
function Wo_ClearReplyChatMessage(chat_id) {
  $('.message_reply_id_'+chat_id).val(0);
  $('.message_reply_text_'+chat_id).find('.reply_content').remove();
  $('.message_reply_text_'+chat_id).fadeOut(50);
}
function Wo_ReplyMessage(id) {
  $('.message_reply_id').val(id);
  $('.message_reply_text span').find('.reply_content').remove();
  if ($("#message_text_reply_"+id).length > 0 && $("#message_text_reply_"+id).html() != '') {
    $('.message_reply_text span').prepend('<p class="reply_content">'+$("#message_text_reply_"+id).html()+'</p>')
  }
  else if($('#message_media_reply_'+id).length > 0 && $('#message_media_reply_'+id).find('img').length > 0){
    $('.message_reply_text span').prepend('<div class="message-user-image pull-left reply_content"><img src="'+$('#message_media_reply_'+id).find('img').attr('src')+'" alt="User image"></div>')
  }
  $('.message_reply_text').fadeIn(50);
}
function Wo_ClearReplyMessage() {
  $('.message_reply_id').val(0);
  $('.message_reply_text').find('.reply_content').remove();
  $('.message_reply_text').fadeOut(50);
}
$(window).on('load', function() {
  //reactions
  $('body').delegate('.wo-reaction-post','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if ($('#post-' + id + ' .wo-reaction-post:hover').length != 0) {
          $('.reactions-box-container-'+id).fadeIn(50);
      }
    }, 300);
  });
  $('body').delegate('.like-story-lightbox','click', function() {
    var id = $( this ).attr( 'data-story-id' );
    setTimeout( function () {
      $('.reactions-box-story-container-'+id).fadeIn(50);
    }, 300);
  });
  $('body').delegate('.like-story-lightbox','mouseleave', function() {
    var id = $( this ).attr( 'data-story-id' );
      setTimeout( function () {
          $('.reactions-box-story-container-'+id).fadeOut(50);
    }, 1000);
  });
  $('body').delegate('.messages-reactions','click', function() {
    var id = $( this ).attr( 'data-message-id' );
    setTimeout( function () {
      $('.reactions-box-container-'+id).fadeIn(50);
    }, 300);
  });
  $('body').delegate('.messages-reactions','mouseleave', function() {
    var id = $( this ).attr( 'data-message-id' );
      setTimeout( function () {
        if ($('.reactions-box-container-'+id + ':hover').length == 0) {
          $('.reactions-box-container-'+id).fadeOut(50);
        }
    }, 500);
  });

  $('body').delegate('.wo-reaction-post','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
      setTimeout( function () {
      if ($('.reactions-box-container-'+id + ':hover').length == 0 && $('#post-' + id + ' .wo-reaction-post:hover').length == 0) {
          $('.reactions-box-container-'+id).fadeOut(50);
      }
    }, 500);
  });

  $('body').delegate('.like-btn-post','click', function() {
    if ($( this ).attr( 'data_react' ) == 0) {
      return false;
    }
    var self = this;
    var post_id = $( this ).attr( 'data-id' );
   
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'delete_reaction', post_id: post_id}, function (data) {
      if(data.status == 200) {
        <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
        socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "removed" });
        <?php } ?>
        $('.reactions-box-container-'+post_id).toggle();
        $('.post-reactions-icons-'+post_id).html(data.reactions);
        $('.status-reaction-'+post_id).removeClass("active-like");
        $('.status-reaction-'+post_id).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> ' + data.like_lang).css({"color": "inherit"});
      }
      $(self).attr('data_react','0');
    });
  });
  
   $('body').delegate('.reactions-box','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if ($('.reactions-box-container-'+id + ':hover').length == 0 && $('#post-' + id + ' .wo-reaction-post:hover').length == 0) {
          $('.reactions-box-container-'+id).fadeOut(50);
      }
    }, 500);
  });

  //reactions lightbox
  $('body').delegate('.wo-reaction-lightbox','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if ($('#post-' + id + ' .wo-reaction-lightbox:hover').length != 0) {
        $('.reactions-lightbox-container-'+id).fadeIn(50);
      }
    }, 500);
  });

  $('body').delegate('.wo-reaction-lightbox','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if ($('.reactions-lightbox-container-'+id + ':hover').length == 0 && $('#post-' + id + ' .wo-reaction-lightbox:hover').length == 0) {
          $('.reactions-lightbox-container-'+id).fadeOut(50);
      }
    }, 500);
  });

  $('body').delegate('.like-btn-lightbox','click', function() {
    var post_id = $( this ).attr( 'data-id' );
   
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'delete_reaction', post_id: post_id}, function (data) {
      if(data.status == 200) {
         <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
        socket.emit("post_notification", { post_id: post_id, user_id: _getCookie("user_id"), type: "removed" });
        <?php } ?>
        $('.reactions-lightbox-container-'+post_id).toggle();
        $('.post-reactions-icons-'+post_id).html("");
        $('.status-reaction-'+post_id).removeClass("active-like");
        $('.status-reaction-'+post_id).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>' + data.like_lang).css({"color": "inherit"});
      }
    });
  });

  //reactions comment
  $('body').delegate('.like-btn-comment','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-comment-container-'+id).fadeIn(50);
    }, 500);
  });

  $('body').delegate('.like-btn-comment','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if( $('.reactions-comment-container-'+id+':hover').length == 0 && $('#comment-' + id + ' .wo-reaction-comment:hover').length == 0 ){
        $('.reactions-comment-container-'+id).fadeOut(50);
      }
    }, 500);
  });

  $('body').delegate('.reactions-box','mouseleave', function() {
    if( !$( this ).hasClass( 'reactions-comment-container-' + $( this ).attr( 'data-id' ) ) ){
      return false;
    }
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-comment-container-'+id).fadeOut(50);
    }, 500);
  });
  
  $('body').delegate('.like-btn-comment','click', function() {
    var comment_id = $( this ).attr( 'data-id' );
    
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'delete_comment_reaction', comment_id: comment_id}, function (data) {
      if(data.status == 200) {
        <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
        socket.emit("comment_notification", { comment_id: comment_id, user_id: _getCookie("user_id"), type: "removed" });
        <?php } ?>
        $('.reactions-comment-container-'+comment_id).toggle();
        $('.comment-reactions-icons-'+comment_id).html(data.reactions);
        $('.comment-status-reaction-'+comment_id).removeClass("active-like");
      }
    });
  });
  
  //reactions replay
  $('body').delegate('.like-btn-replay','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-box-comment-replay-container-'+id).fadeIn(50);
    }, 500);
  });
  $('body').delegate('.reactions-box','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-box-comment-replay-container-'+id).fadeIn(50);
    }, 500);
  });

  $('body').delegate('.like-btn-replay','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if( $('.reactions-comment-replay-container-'+id+':hover').length == 0 && $('#comment_reply_' + id + ' .wo-reaction-replay:hover').length == 0 ){
        $('.reactions-box-comment-replay-container-'+id).fadeOut(50);
      }
    }, 500);
  });

  $('body').delegate('.reactions-box','mouseleave', function() {
    if( !$( this ).hasClass( 'reactions-box-comment-replay-container-' + $( this ).attr( 'data-id' ) ) ){
      return false;
    }
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-box-comment-replay-container-'+id).fadeOut(50);
    }, 500);
  });

  $('body').delegate('.like-btn-replay','click', function() {
    var replay_id = $( this ).attr( 'data-id' );
    
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'delete_replay_reaction', replay_id: replay_id}, function (data) {
      if(data.status == 200) {
        if (node_socket_flow == "1") {
          socket.emit("reply_notification", { reply_id: replay_id, user_id: _getCookie("user_id"), type: "removed" });
        }
        $('.reactions-box-comment-replay-container-'+replay_id).toggle();
        $('.replay-reactions-icons-'+replay_id).html(data.reactions);
        $('.replay-status-reaction-'+replay_id).removeClass("active-like");
      }
    });
  });


  //reactions comment lightbox
  $('body').delegate('.like-btn-lightbox-comment','mouseenter', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-lightbox-comment-container-'+id).fadeIn(50);
    }, 500);
  });

  $('body').delegate('.like-btn-lightbox-comment','mouseleave', function() {
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
      if( $('.reactions-lightbox-comment-container-'+id+':hover').length == 0 && $('#comment_' + id + ' .wo-reaction-lightbox-comment:hover').length == 0 ){
        $('.reactions-lightbox-comment-container-'+id).fadeOut(50);
      }
    }, 500);
  });
  
  $('body').delegate('.reactions-box','mouseleave', function() {
    if( !$( this ).hasClass( 'reactions-lightbox-comment-container-' + $( this ).attr( 'data-id' ) ) ){
      return false;
    }
    var id = $( this ).attr( 'data-id' );
    setTimeout( function () {
        $('.reactions-lightbox-comment-container-'+id).fadeOut(50);
    }, 500);
  });

  $('body').delegate('.like-btn-lightbox-comment','click', function() {
    var comment_id = $( this ).attr( 'data-id' );
    
    $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'delete_comment_reaction', comment_id: comment_id}, function (data) {
      if(data.status == 200) {
        <?php if ($wo['config']['node_socket_flow'] == 1) { ?>
    socket.emit("comment_notification", { comment_id: comment_id, user_id: _getCookie("user_id"), type: "removed" });
    <?php } ?>
        $('.reactions-box-comment-replay-container-'+comment_id).toggle();
        $('.lightbox-comment-reactions-icons-'+comment_id).html(data.reactions);
        $('.lightbox-comment-status-reaction-'+comment_id).removeClass("active-like");
      }
    });
  });

});
function ProcessingVideo(id) {
  $.get(Wo_Ajax_Requests_File(), {f: 'posts', s: 'processing_video', post_id: id}, function (data) {
    $('.processing_alert_'+id).remove();
  });
}
function SendSeen(recipient_id) {
  var chat_container = $('.chat-tab').find('.chat_main_'+recipient_id);
  var last_id = chat_container.find('.messages-text:last').attr('data-message-id');
    <?php if ($wo['config']['node_socket_flow'] == "1"){ ?>
      socket.emit("seen_messages", {user_id: _getCookie("user_id"), recipient_id: recipient_id,message_id: last_id}, (data)=>{})
    <?php }else{ ?>
      $.post( Wo_Ajax_Requests_File() + '?f=chat&s=seen&hash=' + $('.main_session').val(), {recipient_id: recipient_id}, function(data, textStatus, xhr) {});
    <?php } ?>
}
</script>