function go(t,p){
	     window.location.href='search.php?username='+p+'&t='+t+'';
}
function goindex(t,p){
	     window.location.href='index.php?p='+p+'&t='+t+'';
}
function golast(t,p){
	     window.location.href='last.php?p='+p+'&t='+t+'';
}
function gopre(t,p){
	     window.location.href='pre.php?p='+p+'&t='+t+'';
}
function attention(userid,sid){
       $.ajax({url:'attention_ajax.php?t='+Math.random(),
			   type: 'POST',
			   data:"username="+userid+"&serverid="+sid+"&t="+Math.random(),
			   dataType: 'html',
			   timeout: 1000,
			   success:function(data){
				    alert(data);
		  	  }
		});
}

function delattention(id){
   if(confirm('是否删除该角色的关注？')) {
	   $.ajax({url:'attention_ajax.php?action=delete&t='+Math.random(),
			   type: 'POST',
			   data:"id="+id+"&t="+Math.random(),
			   dataType: 'html',
			   timeout: 1000,
			   success:function(data){
				   $('#myattention').html(data);
		  	  }
		});
   }
}
//count length
function countCharacters(str){
     var totalCount = 0;
     for (var i=0; i<str.length; i++) {
         var c = str.charCodeAt(i);
         if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) {
             totalCount++;
         }else {
            totalCount+=2;
        }
    }
    // alert(totalCount);
    return totalCount;
}

function searchcheck(){
    var str = $("#searchname").attr("value");

	if(str == ""){
	   alert("搜索关键字不能为空！");
	   return false;
	}else if(countCharacters(str) < 2){
	   alert("请至少输入2个字符！");
	   return false;
	}

}

function PageUp(){
	   if(document.getElementById("Content").scrollHeight>document.getElementById("Content").clientHeight && document.getElementById("Content").scrollTop>0){document.getElementById("Content").scrollTop=document.getElementById("Content").scrollTop-130;}

}


function PageDown(){
	   if(document.getElementById("Content").scrollHeight>document.getElementById("Content").clientHeight){document.getElementById("Content").scrollTop=document.getElementById("Content").scrollTop+130;}

}
function top(){document.getElementById("Content").scrollTop=0}
function Down(){document.getElementById("Content").scrollTop=document.getElementById("Content").scrollHeight}


function openhtml(id){

	  $("#kshow_"+id+"").show();
	  $("#zhan_"+id+"").html("<a href=\"javascript:hiden('"+id+"');\">-收回</a>");

}

function hiden(id){

      $("#kshow_"+id+"").hide();
	  $("#zhan_"+id+"").html("<a href=\"javascript:openhtml('"+id+"');\">+展开</a>");

}

function showtab(tid){

	if(document.getElementById("paimcon_"+tid).style.display == "none"){
	    $("#paimcon_"+tid+"").show();
		$("#img_"+tid+"").html("<a href=\"javascript:showtab('"+tid+"')\"><img src=\"images/default/images/-.jpg\" /></a>");
	}else{
	    $("#paimcon_"+tid+"").hide();
		$("#img_"+tid+"").html("<a href=\"javascript:showtab('"+tid+"')\"><img src=\"images/default/images/+.jpg\" /></a>");
    }

}