<!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><?php if ($uid == $userinfo['id']) {?>我<?php } else {echo htmlspecialchars($userinfo['screen_name']);}?>的微博<?php echo V('-:tpl/title');?></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_<?php echo SITE_SKIN_TYPE;?>/skin.css" rel="stylesheet" type="text/css" />
</head>
<body <?php if ($uid == $userinfo['id']):?>id="profile"<?php endif;?>>
	<div id="wrapper">
    <!-- header -->
    <?php include APP::tplFile('header');?>
    <!-- end header -->
        <div id="container">
        	<div class="sidebar">
				<!-- top 10 -->
				<?php if ($top == 'true'):?>
				<div class="top10">
                	<div class="sidebar-head">人气关注榜 Top10</div>
                    <ul>
						<?php if ($toplist):?>
						<?php foreach ($toplist as $key => $item):?>
                    	<li>
                        	<div class="ranking skin-bg"><?php echo $key+1;?></div>
                        	<span><?php echo number_format($item['followers_count']);?></span>
                            <a href="<?php echo URL('ta',array('id' => $item['uid']));?>"><?php echo htmlspecialchars($item['screen_name']);?></a>
                        </li>
						<?php endforeach;?>
						<?php endif;?>
                    </ul>
                </div>
				<!-- end top -->
				<!-- fans -->
				<?php else:?>
            	<div class="user-preview">
                	<div class="<?php if ($userinfo['sina_v'] == 1):?>v-verified<?php endif;?> skin-bg"></div>
                    <?php include APP::tplFile('user_rank');?>
                </div>
                <div class="user-sidebar">
                	<div class="sidebar-head"><?php echo htmlspecialchars($userinfo['screen_name']);?>的粉丝（<?php echo empty($userinfo['followers_count']) ? 0 : $userinfo['followers_count'];?>）</div>
                    <ul>
						<?php if ($followers):?>
						<?php foreach ($followers as $item):?>
                    	<li>
                        	<a href="<?php  echo URL('ta',array('id' => $item['id']));?>"><img src="<?php echo APP::F('profile_image_url', $item['profile_image_url']);?>" alt="<?php echo htmlspecialchars($item['screen_name']);?>" /></a>
                            <p><a href="<?php echo URL('ta',array('id' => $item['id']));?>"><?php echo htmlspecialchars($item['screen_name']);?></a></p>
                        </li>
						<?php endforeach;?>
						<?php endif;?>
                    </ul>
					<?php if ($userinfo['followers_count'] > 9):?>
					<a class="more-user" href="<?php if ($userinfo['id'] == $uid):?><?php echo URL('index.fans');?><?php else:?><?php echo URL('ta.fans','id=' . $userinfo['id']);?><?php endif;?>">更多</a>
					<?php endif;?>
                </div>
				<?php endif;?>
				<!-- end fans -->       
            </div>
            <div class="main">
            	<div class="user-head">
                	<img src="<?php echo APP::F('profile_image_url', $userinfo['profile_image_url'], 'profile');?>" alt="" />
                    <div class="user-head-c">
                    	<h3>
							<?php if ($uid == $userinfo['id']):?>
								<a href="#" id="show_pub_box">我要发微博</a>
							<?php endif;?>
							<span <?php if ($userinfo['sina_v'] == 1):?>class="v-icon icon-bg"<?php endif;?>><?php echo htmlspecialchars($userinfo['screen_name']);?></span>
						</h3>
                        <p class="icon-bg <?php if ($userinfo['gender'] == 'f'):?>female-icon<?php elseif ($userinfo['gender'] == 'm'):?>male-icon<?php endif;?>"><?php echo $userinfo['location'];?></p>
                        <p><?php echo htmlspecialchars($userinfo['description']);?></p>
                        <?php if ($uid != $userinfo['id']):?>
							<?php 
								//我是否关注了他
								$followed = $isFriends['friends'] ? 1: 0;
								
								//他是否关注了我
								$followedBack = in_array($userinfo['id'], $fids) ? 2: 0;
							?>
							<div class="opera-area" id="opera_att">
                            <span class="opera-area-r">
								<?php if ($followedBack):?>
                            	<a href="javascript:void(0);" id="xwb_sndmsg">发私信</a>
                        		<?php endif;?>
								<a href="#" id="at_ta">@<?php if ($userinfo['gender'] == 'f'):?>她<?php elseif ($userinfo['gender'] == 'm'):?>他<?php endif;?></a>
                            </span>
							
							<?php if (!$followed):?>
								<a class="general-btn addAtt" href="#"><span class="addAtt">加关注</span></a>
							<?php elseif ($followedBack):?>
								<div class="each-follow all-bg" title="已互相关注"></div>
								<em>|</em>
								<a href="#" class="cancel_att">取消关注</a>
							<?php else:?>
								<span class="followed-icon icon-bg">已关注</span>
								<em>|</em>
								<a href="#" class="cancel_att">取消关注</a>
							<?php endif;?>
							</div>
						<?php endif;?>
                    </div>
                </div>
				<?php if (empty($list)):?>
					<?php if ($uid == $userinfo['id']):?>
						<div class="default-tips">
							<div class="tips-icon all-bg"></div>
							<p>还没有发布微博？赶紧说几句吧！</p>
						</div>
					<?php else:?>
						<div class="default-tips">
							<div class="tips-icon all-bg"></div>
							<p><?php echo htmlspecialchars($userinfo['screen_name']);?>还没有开始微博，请等待。</p>
						</div>
					<?php endif;?>
				<?php else:?>
					<?php include APP::tplFile('feed_list');?>
				<?php endif;?>
            </div>
        </div>
        <!-- footer -->
		<?php include APP::tplFile('footer');?>
        <!-- end footer -->
    </div>
<?php if ($uid == $userinfo['id']):?>
<img src='http://beacon.x.weibo.com/a.gif?xt=pv&p=me&akey=<?php echo WB_AKEY;?>&uid=<?php echo $uid;?>&random=<?php echo mt_rand();?>' style="display:none" />
<?php else:?> 
<img src='http://beacon.x.weibo.com/a.gif?xt=pv&p=ta&akey=<?php echo WB_AKEY;?>&taid=<?php echo $userinfo['id'];?>&uid=<?php echo $uid;?>&random=<?php echo mt_rand();?>' style="display:none" />
<?php endif;?>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<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" src="<?php echo W_BASE_URL;?>js/msgs.js"></script>
<script type="text/javascript">
 $(function(){
 	<?php if ($list):?>	 
	 var $feedList = $('#feed-list');

	 XWB.setList($feedList);
	
	 //XWB.publisher.init($('#publish_box'), $feedList);

	XWB.linkRender();

	XWB.comment.init();
	<?php else:?>
	XWEIBO = {emotions: <?php echo json_encode(V('-:sinaWeiboEmotions'));?>};
	<?php endif;?>

	setTimeout(function(){XWB.notifyChecker.start();}, 3000);

	 XWB.bindSearch($('#search'), $('#searchSubmit'));
<?php if ($uid == $userinfo['id']):?>
	XWB.publishBox.init($('#show_pub_box'));
<?php else: ?>
	XWB.publishBox.init($('#at_ta'), "@<?php echo addslashes($userinfo['screen_name']);?>：");
	
	XWB.listenAttention($('#opera_att'),  3, '<?php echo $userinfo['id'];?>', <?php echo $followed | $followedBack?>);
<?php endif;?>

    $('#xwb_sndmsg').click(function(e){
        e.preventDefault();
        XWB.MSGS.showPopup();
        XWB.MSGS.findEl('sender').val('<?php echo $userinfo['screen_name'];?>');
        XWB.MSGS.findEl('content').focus();
    });
 });
 </script>
</body>
</html>
