<!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>搜索感兴趣的人 - Powered By X微博</title>
<link href="<?php echo W_BASE_URL;?>css/base.css" rel="stylesheet" type="text/css" />
<link href="<?php echo W_BASE_URL;?>css/skin_default/skin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<script>
function search(keyword, type) {
		var keyword = $.trim(keyword);
		var m = 'search.user';
		if (keyword == '' || keyword == '请在这里输入朋友的昵称') {
			return;
		}
		type = type || 'user';
		if (type == 'user') {
			m = 'search.user';
		} else {
			m = 'search';
		}
		window.location.href = '?m=' + m + '&k=' + encodeURIComponent(keyword);
}
$(function() {
	$('#keyword').focus(function(){
		if (this.value == '请在这里输入朋友的昵称') {
				this.value = '';
		}
	}).blur(function() {
		if ($.trim(this.value) == '') {
			this.value = '请在这里输入朋友的昵称';
			$('#search_btn').addClass('disabled');
		}
	}).keyup(function(e){
		if(e.keyCode == 13) {
			search($('#keyword').val(), 'user');
		}
		if (this.value == '' || this.value == '请在这里输入朋友的昵称') {
			$('#search_btn').addClass('general-btn-disabled');
		} else {
			$('#search_btn').removeClass('general-btn-disabled');
		}
	})

})
</script>
</head>
<body id="search-user">
	<div id="wrapper">
		<!-- header -->
		<?php include APP::tplFile('header');?>
		<!-- end header -->	
		<div id="container">
			<div class="sidebar">
				<div class="top10">
					<div class="sidebar-head">人气关注榜 Top10</div>
					<ul>
						<?php for ($i=0,$count=count($top_followers); $i< $count; $i++) {?>
						<li>
							<div class="ranking skin-bg"><?php echo $i+1;?></div>
							<span><?php echo number_format($top_followers[$i]['followers_count']);?></span>
							<a href="<?php echo URL('ta', 'id=' . $top_followers[$i]['uid']);?>"><?php echo $top_followers[$i]['screen_name'];?></a>
                        </li>
                        <?php }?>
                    </ul>
                </div>
                
                          
            </div>
            <div class="main">
            	<div class="title-box">
            		<div class="title-tab">
                    	<span class="post-btn" id="sendBtn"><a href="#">我要发微博</a></span>
						<a class="tab-link" href="<?php echo URL('search');?>"><span>找微博</span></a>
                        <span class="tab-current"><span>找用户</span></span>
                    </div>
                    <div class="search">
                    	<input type="text" class="onfocus" id="keyword" value="<?php echo V('g:k','请在这里输入朋友的昵称');?>" />
						<a class="general-btn <?php if (V('g:k','') == '')echo 'disabled';?>" id="search_btn" href="javascript:search($('#keyword').val(), 'user');"><span>搜索</span></a>
                    </div>
                </div>

				<div class="search-default">
					<?php if (!V('g:k')) {?>
					<p>请在上方输入框中填写要搜索的用户昵称关键字</p>
					<?php }?>
                </div>
				<?php if (V('g:k') && empty($data)) {?>
				<div class="search-default">
					<p>很抱歉，没有找到昵称包含"<b><?php echo htmlspecialchars(V('g:k'));?></b>"的人</p>
                </div>
				<?php } elseif (!empty($data)) {?>
                <div class="user-list">
                	<ul id="user_list">
						<?php foreach($data as $row) {?>
                    	<li>
                            <div class="list-content">
                            	<div class="user-pic">
								<a href="<?php echo URL('ta','id=' .$row['id']);?>"><img src="<?php echo $row['profile_image_url'];?>" alt="" /></a>
                                </div>
                                <div class="content-r">
								<?php if ($sina_uid != $row['id']) {?>
									<?php if (!$row['following']) {?>
									<a class="addfollow-btn all-bg"  rel="<?php echo $row['id'];?>" href="#"></a>
									<?php } else {?>
									<span class="followed-icon icon-bg">已关注</span>
									<?php }?>
								<?php }?>
                                </div>
                                <div class="content-m">
								<a class="u-name" href="<?php echo URL('ta','id=' . $row['id']);?>"><?php echo $row['screen_name'];?></a>
									<p class="icon-bg <?php if ($row['gender'] == 'f'):?>female-icon<?php elseif ($row['gender'] == 'm'):?>male-icon<?php endif;?>"><?php echo $row['location'];?> 粉丝数：<?php echo $row['followers_count'];?>人</p>
									<div class="u-info"><?php if ($row['description']) {?>简介：<?php echo $row['description'];?><?php } else {?>&nbsp;<?php }?></div>
                                </div>
                            </div>
						</li>
						<?php }?>
                        
                    </ul>
                    <div class="list-footer">
                    	<div class="page">
						<?php echo $pager;?>
                        </div>
                        <a href="#">返回顶部</a>
                    </div>
                </div>
				<?php }?>
            </div>
        </div>
        <!-- footer -->
		<?php include APP::tplFile('footer');?>
        <!-- end footer -->
    </div>
   
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/common.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/ui.js"></script>
<script type="text/javascript">
$(function(){
	XWB.listenAttention($('#user_list'));
	XWEIBO = {uid: '<?php echo $userinfo["id"];?>', emotions: <?php echo json_encode(V('-:sinaWeiboEmotions'));?>};
	setTimeout(function(){
		XWB.notifyChecker.start();
	}, 3000);
	XWB.publishBox.init($('#sendBtn'));	
    
	XWB.bindSearch($('#search'), $('#searchSubmit'));
});
</script>   
</body>
</html>
