checkitem = function(id) {
	if ($('#'+id).css('display')!='none') {
		$('#link'+id).removeClass('activeItem');
		$('#'+id).hide();
	} else {
		$('#'+id).show();
		$('#link'+id).addClass('activeItem');
	}
}
checkallitem = function(checked) {
	if (checked) {
		$('.checkICon').show();
	} else {
		$('.checkICon').hide();
	}	
}
deletefriend = function(pownerusername, pusername, ptype, pfollowme, page) {	
	if (ptype==2) {		
		var msg = 'Bạn có chắc chắn muốn hủy mối quan hệ này không?';
		/*if (pusername=='') {	
			var x=document.getElementsByName('items[]');	
			for (var i=0; i<x.length; i++) {
				if ($('#'+x[i].id).css('display')!='none') {			
					pusername+=$('#'+x[i].id).attr('title')+';';
				}
			}
			var pusername = (pusername != '' ? pusername.substr(0, pusername.length - 1) : '');
		}*/
	} else if (ptype==4) {
		var msg = 'Bạn đồng ý chia tay không?';
	} else if (ptype==7 && pfollowme==0) {	
		var msg = 'Bạn đồng ý ngừng theo đuổi '+pusername+'?';
	} else if (ptype==7 && pfollowme==1) {	
		var msg = 'Bạn đồng ý từ chối '+pusername+' theo đuổi bạn?';
	}	
	if (pusername) {			
		if (confirm(msg)) {		
			$.get (
				HOST_HAT+'ajax/deletefriend?pusername='+pusername+'&ptype='+ptype+'&pfollowme='+pfollowme,
				function (msg){
					if (msg) {
						showUIMessage(msg);
						if (ptype==2) {
							location.reload();
						} else if (ptype==4) {
							boygirlfriend(page, pownerusername);
						} else if (ptype==7 && pfollowme==0) {
							follow(page);
						} else if (ptype==7 && pfollowme==1) {
							followme(page);
						}
					}
				}
			);			
		}
	}
}
boygirlfriend = function(page, pusername) {
	$.get (
		HOST_HAT+'ajax/boygirlfriend?username='+pusername+'&page='+page,
		function (html){
			$('#idFriend').html(html);			
		}
	);
}
follow = function(page) {
	$.get (
		HOST_HAT+'ajax/follow?page='+page,
		function (html){
			$('#idFollow').html(html);			
		}
	);
}
followme = function(page) {
	$.get (
		HOST_HAT+'ajax/followme?page='+page,
		function (html){
			$('#idFollowMe').html(html);			
		}
	);
}
