
function post_like_dislike(url, class2, nid_uid , status, nid3){
	//alert(url + 'return.php?nid='+ nid_uid +'&status=' + status)
	$.ajax({
	  url: url + 'return.php?nid='+ nid_uid +'&status=' + status,
	  success: function(data) {

		$(class2).html(data);
		
		if(status == 'like'){
			document.getElementById('dislike_'+nid3).style.display = 'block';	
			document.getElementById('like_'+nid3).style.display = 'none';	
			document.getElementById('like_unlike_'+nid3).style.display = 'block';	
			
		}
		
		if(status == 'dislike'){
			document.getElementById('dislike_'+nid3).style.display = 'none';
			document.getElementById('like_'+nid3).style.display = 'block';	
			if(data == '')
				document.getElementById('like_unlike_'+nid3).style.display = 'none';				
		}
	  }
	}); 
}	


function deleted_post(url, pnid, nid, status){
	//alert(url+'--'+ pnid +'--'+ nid +'--'+ status)
	//  /--631--631&uid=7789&puid=6109--delete_post
	hide_dis = status;
	$.ajax({
	  url: url + 'delete.php?deletePostId='+ nid +'&status=' + hide_dis,
	  //alert(url)
	  success: function(data) {
		document.getElementById('pdel_'+ pnid).style.display = 'none';	
	  }
	});
}

/*delete posted comment*/
function deleted_comment(url, pnid, nid, status){
//	alert(url + 'delete.php?deleteid='+ nid +'&status=' + status)
	hide_dis = status;
	$.ajax({
	  url: url + 'delete.php?deleteid='+ nid +'&status=' + hide_dis,
	  success: function(data) {
		//alert(data)
		//cid_112&uid=7789&puid=7789
		//var cid = nid.split('&');
		//alert(cid[0])
		//document.getElementById(data).style.display = 'none';	
		$(data).hide();

	  }
	});
}


/*add new comment*/
function submit_comment(url,nid, uid, host, time, uname, cssname2){

	var content = document.getElementById('comment_'+nid).value;
	if(jQuery.trim(content) == ''){								//validate comment box is not empty
		alert('Please enter comment.');
		document.getElementById('comment_'+nid).focus();	
		return false;
	}
	
	$.ajax({													//post_comment.php is call for post new comment
	  url: url + 'post_comment.php?content='+ escape(content) +'&nid=' + nid +'&uid=' + uid +'&host=' + host +'&time=' + time +'&uname='+ uname,
	  success: function(data) {
		data2 = data + $(cssname2).html();	
		//data2 = $(cssname2).html() + data;	
		$(cssname2).html(data2);
		document.getElementById('comment_'+nid).value = '';
		document.getElementById('comment_box_'+nid).style.display='none';
	  }
	});
}


/*this function is used to add or post new post*/
function replace_posts(){
	
	var url = document.getElementById('basepath').value;		//base path
	var uid = document.getElementById('uid').value;
	$.ajax({
	  url: url + 'get_comment.php?uid='+ uid,					//get_comment.php is used to add new post into data base after that return that post
	  success: function(data) {		

		data2 = data + $('#replace').html();					//	
		$('#replace').html(data2);								//replace inner html throught jquery

		//$('#replace').html(data);
	  }
	});
}
