//展示层 以div id = topList+i的层展现，将其他topList的层隐藏
function ps_setTop(i)
{
 for(var id = 1;id<=3;id++)
 {
  var ss="topList"+id;
  if(id==i)
  document.getElementById(ss).style.display="block";
  else
  document.getElementById(ss).style.display="none";
 }  
}
//显示个人空间中的flash
function ps_pic(pics,links,texts,pic_width,pic_height,show_text,button_pos,stop_time,flashUri)
{
	var swf_height=show_text==1?pic_height+20:pic_height;
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');
	document.write('<param name="movie" value="'+flashUri+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&button_pos='+button_pos+'&stop_time='+stop_time+'">');
	document.write('<embed src="'+flashUri+'" FlashVars="pics='+pics+'&amp;links='+links+'&amp;texts='+texts+'&amp;pic_width='+pic_width+'&amp;pic_height='+pic_height+'&amp;show_text='+show_text+'&amp;button_pos='+button_pos+'&amp;stop_time='+stop_time+'" quality="high" wmode="transparent" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function ps_copyToClipBoard(text){
var clipBoardContent;
if(text==null||text==""){
clipBoardContent=window.location+'';
}else{
	clipBoardContent=text+'';
} 
if(window.clipboardData){
	window.clipboardData.setData("Text",clipBoardContent);
	alert('内容已复制到剪贴板');
}else{
	alert('复制操作失败!');	
	return;
	}
}

function ps_displayChildren(_obj, _display) {
	 _obj.style.display=_display;
	 if(pp_isFF()) {
		 if (_obj.children) {
	 	 	for(var i = 0; i < _obj.children.length; i++) {
	 	 		_obj.children[i].style.display=_display;
	 	 		ps_displayChildren(_obj.children[i], _display)
	 	 	}
	 	 }
	 }
}

//num=1展示消息内容；num==0隐藏；  标题为id 内容为id+cn
//isRead:是否已读，若未读，则点击后需更新消息[是否已读]标记
function ps_displayMSG(id,num,msgId,isRead){
   var obj = document.getElementById(id+'cn');
   if(num==1)
   {
 	 ps_displayChildren(obj, '');
 	 if(pp_isFF()) {
 	 	if(parent.document.getElementById('ifm1')) {
 	 		parent.document.getElementById('ifm1').onload();
 	 	}
 	 }
	 document.getElementById(id).onclick = function(){ps_displayMSG(id,0,msgId,true);};
	 if (!isRead && (document.getElementById(id).childNodes[0].tagName=="IMG")) {
	 	document.getElementById(id).childNodes[0].src="../space/images/read.gif";
	 }
   }
   else if(num==0)
   {
 	 ps_displayChildren(obj, 'none');
   	 document.getElementById(id).onclick = function(){ps_displayMSG(id,1,msgId,true);};	
   }
   if(arguments.length > 2 && !isRead) {
       var sUrl = "../myppb/UpdateMessageReadServlet?id="+msgId;
	   co_sendXMLHttpRequest(sUrl,"POST",null);      	
   }
}
//在我的空间首页上切换我的好友和最近访客
function ps_mypppbIndexShow(num){
   var obj1 = document.getElementById('show1');
   var obj2 = document.getElementById('show2');
   var objcn1 = document.getElementById('showpic1');
   var objcn2 = document.getElementById('showpic2');
   if(num==1)
   {
	  
	  obj1.setAttribute('class',"on_title");
	  obj1.setAttribute('className',"on_title");
	  obj2.setAttribute('class',"");
	  obj2.setAttribute('className',"");
	  objcn1.style.display='';
	  objcn2.style.display='none';
  }
   else if(num==2)
   {
      obj2.setAttribute('class',"on_title");
	  obj2.setAttribute('className',"on_title");
	  obj1.setAttribute('class',"");
	  obj1.setAttribute('className',"");
	  
	  objcn2.style.display='';
	  objcn1.style.display='none';
   }
}

var menu = 'menu_1';
var menuw = 119;
var menuh = 87;
var divTop = 0;
var divLeft = 0;
var active;
var nbottom=0,speed=7;
function ps_menuControl(show,divid)
{
   if (show == 1) {
		active = document.getElementById(divid);
		divTop = active.offsetTop;
		divLeft = active.offsetLeft;
		ps_showMenu();
	}
	else ps_hideMenu();
}

function ps_displayMenu()
{
	var obj=document.getElementById(menu);
	if(document.all)obj.style.clip="rect(0 100% "+nbottom+"% 0)";
	else obj.style.clip="rect(0,"+menuw+"px,"+Math.round(menuh*nbottom/100)+"px,0)";
	nbottom+=speed;
	if(nbottom<=100) {
		timerID=setTimeout("ps_displayMenu(),70");
		}
	else clearTimeout(timerID);
}

function ps_showMenu()
{
	var obj = document.getElementById(menu);
	obj.style.display="block";
	menuw = obj.offsetWidth;
	menuh = obj.offsetHeight;
	obj.style.top=divTop+12+'px';
	obj.style.left=divLeft+'px';
	nbottom=5;
	ps_displayMenu();
}

function ps_hideMenu()
{
	nbottom=0;
	document.getElementById(menu).style.display="none";
}

function ps_keepMenu()
{
	document.getElementById(menu).style.display="block";
}
function ps_changeType(id){
	//插入写数据库操作
	active.innerHTML = id+'<img src="images/bot.gif" />';
}
function onHtmlTagSearchClick(root,tag) {
  	var searchType = 2; // 日志搜索
    var searchValue = su_trim(tag);
  
    if(searchValue==""||searchValue==defaultSearchValue){
      alert(defaultSearchValue);
      return;
    }
    //
    location.href=root+"/space/search/"+ encodeURIComponent(searchValue) +"/"+ searchType+".html";
  }

/**
* author :roy
* 2008.11.27
* 日志后台操作
* _nAciton: 操作类型 0:delete 1:change isAudite
* _nId: page id
*/
function pageAction(_nDoAction,_nId){
	var sUrl = "../space/PageActionServlet?action="+_nDoAction+"&id="+_nId;
	var xmlObj = co_sendXMLHttpRequest(sUrl,"POST",null);
	if(_nDoAction==1){
		var td = document.getElementById("isAudited"+_nId);
		var isAudited = xmlObj.getResponseHeader("isAudited");
		if(isAudited=="true"){
			td.innerHTML = "<font color='#0000FF'>是</font>";
		}else{
			td.innerHTML = "<font color='#000000'>否</font>";
		}
	}else if(_nDoAction==0){
		var tr = document.getElementById("tr_"+_nId);
  		tr.parentNode.deleteRow(tr.rowIndex);
	}
	
}
