<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/iframe.css">
<link rel="stylesheet" type="text/css" href="skin/default/jooyea/css/user_ico_small.css">
<!--[if lt IE 7]>
<style type="text/css">
.uico_photo_small span { behavior: url(skin/default/jooyea/css/ie_png_fix.htc);}
</style>
<![endif]-->
<SCRIPT type='text/javascript' src="servtools/ajax_client/ajax.js"></SCRIPT>
<script type="text/javascript">
parent.guide("mypals");
function check_form(){
	if(document.getElementById("search_name").value==''){
		parent.Dialog.alert("{echo:lp{mp_import_name};/}");
		return false;
	}
}
function show_sort_list(obj,p_id,old_id){
	var sortwin=document.createElement("div");
	var mypals = 'mypals_iframe';
	var parentnode = document.getElementById('mypals_iframe');
	var t=obj.offsetTop;
  var l=obj.offsetLeft;
  var height=obj.offsetHeight;
  var width=obj.offsetWidth;   
  while(obj=obj.offsetParent){
      t+=obj.offsetTop;   
      l+=obj.offsetLeft;   
  }
	sortwin.id = "sort_select_"+p_id;
	sortwin.className = "sort_select";
	sortwin.style.top = (t-45) + 'px';
	sortwin.style.left = l + 'px';
	{sta:foreach($mp_sort_list as $val)[loop]}
		{sta:$sort_str.="<li><a href='javascript:void(0);' onclick=changeSort(\"+p_id+\",".$val['id'].",this,\"+old_id+\");>".$val['name']."</a></li>";/}
	{end:foreach/}
	sortwin.innerHTML = "<div class='sort_sel_box'><ul>{echo:$sort_str;/}</ul></div>";
	parentnode.appendChild(sortwin);
	sortwin.focus();
	if(navigator.appName.indexOf("Explorer") > -1){
		sortwin.onblur=function(){window.setTimeout(function(){parentnode.removeChild(sortwin);},200);}
	}else{
		sortwin.onmousedown=function(){window.setTimeout(function(){parentnode.removeChild(sortwin);},200);}
	}
}

function changeSort(p_id,sort_id,obj,old_id){
	if(navigator.appName.indexOf("Explorer") > -1){
		var sortName = obj.innerText;
	}else{
		var sortName = obj.textContent;
	}
	xmlhttp=InitAjax();
	xmlhttp.open("POST","do.php?act=pals_change&id="+p_id,true);
	xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	xmlhttp.onreadystatechange=function (){
		if(xmlhttp.readyState==4&&xmlhttp.status==200){
			document.getElementById('sort_name_'+p_id).innerHTML = "<span>"+sortName+"</span>";
		}
	}
	xmlhttp.send("name="+sortName+"&sort_id="+sort_id+"&old_sort_id="+old_id);
}

//0130
function changeStyle(obj,p_id){
	obj.className = 'hover';
}
function recoverStyle(obj,p_id){
	obj.className = '';
}

</script>
</head>
<body>
  <div class="main_right_title">
     <span class="main_title_dot3"></span>
     <span class="main_title_txt">{echo:lp{mp_mypals};/}</span>
  </div>
<div id="tabsB">
  <ul>
    <li><a href="?app=mypals" title="{echo:lp{mp_list};/}" class="nowbutl"><span class="nowbutr">{echo:lp{mp_list};/}</span></a></li>
    <li><a href="?app=mypals_request" title="{echo:lp{mp_req};/}"><span>{echo:lp{mp_req};/}</span></a></li>
    <li><a href="?app=mypals_invite" title="{echo:lp{mp_invite};/}"><span>{echo:lp{mp_invite};/}</span></a></li>
    <li><a href="?app=mypals_sort" title="{echo:lp{mp_m_sort};/}"><span>{echo:lp{mp_m_sort};/}</span></a></li>
  </ul>
	<div class="div_but" onclick="location.href='?app=mypals_search'">{echo:lp{mp_add};/}</div>
</div>

<!-- mypals start 0128 -->
	<div id="mypals_iframe" class="iframe_contentbox">
	<div class="friend_list guide_info {echo:$none_data;/}">
		{echo:$show_none_str;/}
	</div>
	{sta:if($mp_list_rs)[exc]}

		<div class="friend_list">
			<div class="clear"></div>
			<ul id="tab0_content0" class="user_list">
				{sta:foreach($mp_list_rs as $rs)[loop]}
				{sta:$psort_name=$rs['pals_sort_name']?$rs['pals_sort_name']:lp{mp_select_sort};/}
					<li onmouseover='changeStyle(this,{echo:$rs["id"];/})' onmouseout='recoverStyle(this,{echo:$rs["id"];/})'>
						<div class="photo">
							<a href="home.php?h={echo:$rs['pals_id'];/}" target="_blank">
								<img title="{echo:lp{mp_en_home};/}" src={echo:$rs['pals_ico'];/} height='48px' width='48px' onerror="parent.pic_error(this)" />
							</a>
						</div>
						<dl>
							<dt>{echo:$rs['pals_name'];/}</dt>
							<dd class="sort"><a href='javascript:void(0)' onclick='show_sort_list(this,{echo:$rs["pals_id"];/},{echo:$rs["pals_sort_id"];/})' id='sort_name_{echo:$rs["pals_id"];/}'><span>{echo:$psort_name;/}</span></a></dd>
						</dl>
						<div class="tool" id="ctrl_{echo:$rs['id'];/}">
							<a title="{echo:lp{mp_del};/}" class="del_bt" href="do.php?act=del_mypals&mypals_id={echo:$rs['pals_id'];/}&sort_id={echo:$rs['pals_sort_id'];/}" onclick='return confirm("{echo:lp{mp_a_del};/}")'></a>
							<a class="send_bt" href='modules.php?app=msg_creator&2id={echo:$rs["pals_id"];/}' target="frame_content" title='{echo:str_replace("{he}",get_TP_pals_sex($rs["pals_sex"]),lp{mp_scrip});/}'></a>
						</div>
					</li>
				{end:foreach/}
			</ul>
		</div>
		{end:if/}


<!--右侧好友列表栏目!-->
	<div class="grouping_list">
		<div class="grouping_top">
			<form action='' method='post' onsubmit='return check_form();'>
				<div class="search"><input id="search_name" autocomplete='off' class="text" type="text" name="search_name" /><input class="button" type="submit" value="{echo:lp{mp_search};/}" /></div>
			</form>
		</div>
		<div id="grouping_list" class="grouping_ct">
			<div class="grouping_box">
				<div id="all_pals" class="name"><a href="modules.php?app=mypals&type=all">{echo:lp{mp_whole};/}</a></div>
				<div class="num">{echo:$pals_total['pals_num'];/}</div>
			</div>
			<div class="grouping_box">
				<div id="show_sort_0" class="name"><a href="modules.php?app=mypals&sort_id=0">{echo:lp{mp_no_sort};/}</a></div>
				<div class="num">{echo:$not_sort_num[0];/}</div>
			</div>
		{sta:foreach($mp_sort_list as $val)[loop]}
			<div class="grouping_box">
				<div id='show_sort_{echo:$val["id"];/}' class="name"><a href="modules.php?app=mypals&sort_id={echo:$val['id'];/}">{echo:$val['name'];/}</div></a>
				<div class="num">{echo:$val['count'];/}</div>
			</div>
		{end:foreach/}
		</div>
		<div class="grouping_bt"></div>
	</div>
	</div>

<!-- mypals end -->
<div class="clear"></div>
{echo:page_show($isNull,$page_num,$page_total);/}

<script type='text/javascript'>
	{sta:if($sort_id!='')[exc]}
		document.getElementById("show_sort_{echo:$sort_id;/}").className='name ico';
	{end:if/}
	{sta:if(get_argg('type')=='all')[exc]}
		document.getElementById("all_pals").className='name ico';
	{end:if/}
</script>

<script type='text/javascript' src="im/ajax.php?act=updatapals"></script>
</body>
</html>