	
	function getUserTotal(){
		$.ajax({
			   type: "GET",
			   url: "/manage/getUserTotal/",
			   data: "r="+Math.random(),
			   dataType: "json",
			   success: function(resp){
				   /*
				   if(resp.totalcount > 0){
						$('#totalcount').html( resp.totalcount );
					}
				   */
				   if(resp.mescount > 0){
					   $('#mescount').html( ' <a href="/manage/receiveBox">'+resp.mescount+'</a> 条新站内信' );
				   }
				   
				   if(resp.newleave > 0){
					   $('#newleave').html( ' <a href="/manage/blogfriendleave">'+resp.newleave+'</a> 条新留言' );
				   }
				   
				   if(resp.newcomment > 0){
					   $('#newcomment').html( ' <a href="/manage/reviewManage">'+resp.newcomment+'</a> 条新评论' );
				   }
				   
				   if(resp.newreply > 0) {
					   $('#newreply').html( ' <a href="/manage/receiveBox">'+resp.newreply+'</a> 条新回复' );
				   }
				   if(resp.newfriend > 0) {
					   $('#newfriend').html( ' <a href="/manage/verifyFriend">'+resp.newfriend+'</a> 条新消息' );
				   }
				   if(resp.sysmsgcnt > 0) {
					   $('#sysmsgcnt').html( ' <a href="/manage/sysmsg">'+resp.sysmsgcnt+'</a> 条新消息' );
				   }
				   if(resp.mescount > 0 || resp.newleave > 0 || resp.newcomment > 0 || resp.newreply > 0 || resp.newfriend > 0 || resp.sysmsgcnt > 0) {
					   $('#totalcount').show();
				   } else {
					   $('#totalcount').hide();
				   }
			   }
			 });
	}
	
	function delInfo(infoId){
		var del = function(){
			if(confirm('操作成功')){
				location.href = 'blogDel?' + $(':checked').serialize();
				//location.href = '/infoList';
			}
		}
	}

	function changeType(id){
		$('#searchType').val(id);
		$('#typeLink0').removeClass("cf_tit");
		$('#typeLink1').removeClass("cf_tit");
		$('#typeLink2').removeClass("cf_tit");
		$('#typeLink'+id).addClass("cf_tit");
	}

        //申请加为好友 发信息
	function addFriend(friendid,title){
		$.ajax({
			   type: "POST",
			   url: "/manage/addFriend",
			   data: "friendid="+friendid+"&title="+$.trim(title),
			   success: function(msg){
			     alert( "短消息已发送，请等待对方审核！" );
			     window.location.reload();
			   }
			 });
	}
        //删除 审核信息
        function delFmess(userid){
            if(confirm("你确实要删除该好友吗？")){
                $.get('/manage/delFmess?userid='+userid,'',function(){
                                window.location.reload();
                })
            }else{
                return false;
            }
        }
        //对申请加为好友的用户 操作 同意或不同意
        function doFriend(userid,isallow){
            $.post('/manage/doFriend', 'userid='+userid+'&isallow='+isallow, function(){
                alert( "操作成功！" );
		window.location.reload();
            })
        }
	
        //删除好友 （双方删除）
	function deleteFriend(friendid){
		$.ajax({
			   type: "POST",
			   url: "/manage/delFriend",
			   data: "friendid="+friendid,
			   success: function(msg){
			     alert( "删除成功！" );
			     window.location.reload();
			   }
			 });
	}
	
//	function deleteattentionFriend(id){
//		$.ajax({
//			   type: "POST",
//			   url: "/manage/delattentionFriend",
//			   data: "id="+id,
//			   success: function(msg){
//			     alert( "删除成功！" );
//			     window.location.reload();
//			   }
//			 });
//	}
	
	function deleteattentionFriend(id){
		if(confirm("你确实要删除该好友吗？")){
			$.get('/manage/delattentionFriend?id='+id,'',function(){
				window.location.reload();
			})
		}
	}
	
	function addAttention(userid){
		$.ajax({
			   type: "POST",
			   url: "/manage/becomeAttention",
			   data: "userid="+userid,
			   success: function(msg){
			     alert( "增加成功！" );
			     window.location.reload();
			   }
			 });
	}
	
	function deleteAttention(userid){
		$.ajax({
			   type: "POST",
			   url: "/manage/cancelAttention",
			   data: "userid="+userid,
			   success: function(msg){
			     alert( "删除成功！" );
			     window.location.reload();
			   }
			 });
	}

	//弹出窗口(上传框)
	function upd_file(url){
		//w为窗口宽度，h为高度
		var w = 250;
		var h = 100;
		var l = (screen.width - w) / 2;
		var t = (screen.height - h) / 2;
		var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l;
		s += ', toolbar=no,scrollbars=no,menubar=no,location=no,resizable=no,scrollbars=no,resizable=no,location=no,status=no';
		window.open(url, null, s);
	}

	//关闭当前modal
	function closeModal(){
		$("#modal").dialog('close')
	}

	//关闭当前if_modal
	function closeIFModal(){
		$("#if_modal").dialog('close')
	}

	//关闭当前modal2
	function closeModal2(){
		$("#modal2").dialog('close')
	}
	
	//显示modal
	function showModal(url, mtitle, width){
		$.get(url, '', function(respone){
			initModal(respone, mtitle, width)
		})
	}

	//显示modal2 //非iframe
	function showModal2(url, mtitle, width){
		$.get(url, '', function(respone){
			initModal2(respone, mtitle, width)
		})
	}
	
	function showIFModal(url, mtitle, wi, he){
		if(!$("#if_modal").length) $(document.body).append("<iframe frameborder='0' id='if_modal' style='display:none;' marginwidth='0' marginheight='0' hspace='0' vspace='0'></iframe>");
		var modal = $("#if_modal"), ht = 0
		modal.css('width', '').css('height', '')
		modal.attr('src',url).load(function(){
			modal.dialog({show: 'highlight', modal: true, width: wi})
//			modal.dialog({show: 'highlight', width: wi})
		}).load(function(){
			ht = modal.contents().height()
			modal.dialog({
				show: 'highlight',
				hide: "highlight",
				height: he ? he : ht,
				resizable: false,
				title:	mtitle,
				bgiframe: true
			})
			modal.css('width', wi).css('height', ht)
		})
	}

	//开始显示
	function initModal(respone, mtitle, width){
		if(!$("#modal").length) $(document.body).append("<div id='modal'></div>");
		var modal = $("#modal")
		modal.html(respone)
		modal.dialog({
			show: 'highlight',
			hide: "highlight",
			width:(width ? width : '300'),
			modal: true,
			resizable: false,
			title:	mtitle
		})
	}

	//开始显示 第二个modal
	function initModal2(respone, mtitle, width){
		if(!$("#modal2").length) $(document.body).append("<div id='modal2'></div>");
		var modal = $("#modal2")
		modal.html(respone)
		modal.dialog({
			show: 'highlight',
			hide: "highlight",
			width:(width ? width : '300'),
			modal: true,
			resizable: false,
			title:	mtitle
		})
	}
	
	function showMeg2(msg){
		var n="<div style='font-family: 微软雅黑;line-height: 35px;padding-bottom: 30px; padding-top: 20px; text-align: center;'>"+msg+"<div><input style='text-align:center' type='button' onclick='closeModal2();' value='   确定   '/></div>";
		initModal2(n, "提示")
	}
	
	/**
	 * 全角转半角
	 */
	function CtoH(obj){
		var str=obj.value;
		var result="";
		for(var i = 0; i < str.length; i++){
			if (str.charCodeAt(i)==12288){
				result+= String.fromCharCode(str.charCodeAt(i)-12256);
				continue;
			}
			if (str.charCodeAt(i)>65280 && str.charCodeAt(i)<65375)
				result+= String.fromCharCode(str.charCodeAt(i)-65248);
			else result+= String.fromCharCode(str.charCodeAt(i));
		}
		obj.value=result;
	} 
