/*
 * Like & Share product v2.5 (JS)
 * Email : admin@weblanca.com
 * (c) Copyright 2013.07.14
*/
$(function(){if(!ls_always_show_buttons){$(".like_share_by_ali").parents("tr").mousemove(function(){$(this).find(".like_buttons").css('visibility','visible')});$(".like_share_by_ali").parents("tr").mouseout(function(){$(this).find(".like_buttons").css('visibility','hidden')})}$(".show_more_likes").click(function(){$(this).parent().find(".ls_more_likes").show()});$(".like_share_LIKE").click(function(){var this_btn_id=$(this).attr("id");var this_btn_parent_id=this_btn_id.replace("btn_","");var this_data=this_btn_id.replace("btn_like_share_post_","").split("_");var this_postid=this_data[0];var this_post_userid=this_data[1];if(ls_send_request){ls_send_request=0;$(".like_buttons").css({"opacity":0.5});$.ajax({type:"POST",url:"ajax.php?do=like_share_by_ali",dataType:"json",data:SESSIONURL+"securitytoken="+SECURITYTOKEN+"&type=like&postid="+this_postid+"&userid="+this_post_userid,success:function(like_data){if(like_data.like_error){alert("Post already liked!")}else{$("#"+this_btn_parent_id+" .ls_likes").show().html(like_data.json_likes+'<div class="ls_more_likes"></div>');$("#"+this_btn_parent_id+" .ls_likes .ls_more_likes").html(like_data.json_more_likes);$("#btn_dis_like_share_post_"+this_postid+"_"+this_post_userid).show();$("#btn_like_share_post_"+this_postid+"_"+this_post_userid).hide()}ls_send_request=1;$(".like_buttons").css({"opacity":1})}})}});$(".like_share_DISLIKE").click(function(){var this_btn_id=$(this).attr("id");var this_btn_parent_id=this_btn_id.replace("btn_dis_","");var this_data=this_btn_id.replace("btn_dis_like_share_post_","").split("_");var this_postid=this_data[0];var this_post_userid=this_data[1];if(ls_send_request){ls_send_request=0;$(".like_buttons").css({"opacity":0.5});$.ajax({type:"POST",url:"ajax.php?do=like_share_by_ali",dataType:"json",data:SESSIONURL+"securitytoken="+SECURITYTOKEN+"&type=dislike&postid="+this_postid+"&userid="+this_post_userid,success:function(dislike_data){if(dislike_data.like_error){alert("Post not liked yet!")}else{$("#btn_like_share_post_"+this_postid+"_"+this_post_userid).show();$("#btn_dis_like_share_post_"+this_postid+"_"+this_post_userid).hide();if(dislike_data.json_likes.length){$("#"+this_btn_parent_id+" .ls_likes").show().html(dislike_data.json_likes+'<div class="ls_more_likes"></div>');$("#"+this_btn_parent_id+" .ls_likes .ls_more_likes").html(dislike_data.json_more_likes)}else{$("#"+this_btn_parent_id+" .ls_likes").hide()}}ls_send_request=1;$(".like_buttons").css({"opacity":1})}})}});$(".share_this_by_ali").mousemove(function(){var this_height=$(this).height()-3;var this_height=(this_height)?this_height:0;$(this).find(".share_by_ali").show().css({'top':this_height})});$(".share_this_by_ali").mouseout(function(){$(this).find(".share_by_ali").hide()})});