<!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>
<title>踩客——原来文章还能踩的！</title>
<?php include(DEDEMEMBER."/templets/head_inc.htm"); ?>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
	$("div[class*='good'],div[class*='bad']").bind("click", function(){
		var type = $(this).attr('class'),aid = $(this).attr('id');
		var saveId = getCookie('diggid');
		if(saveId != null)
		{
			var saveIds = saveId.split(',');
			var hasId = false;
			j = 1;saveId = '';
			for(i=saveIds.length-1;i>=0;i--)
			{
				if(saveIds[i]==aid && hasId) continue;
				else
				{
					if(saveIds[i]==aid && !hasId) hasId = true;
					saveId += (saveId=='' ? saveIds[i] : ','+saveIds[i]);
					j++;
					if(j==20 && hasId) break;
					if(j==19 && !hasId) break;
				}
			}
			
			if(hasId) { alert("您已经顶过该帖，请不要重复顶帖 ！"); return false; }
			else saveId += ','+aid;
			setCookie('diggid',saveId,1);
		}
		else
		{
			setCookie('diggid',aid,1);
		}		
		$.ajax({type: 'POST',url: "../plus/feedback.php",
			data: "formurl=caicai&action="+type+"&aid="+aid,
			dataType: 'text',
			success: function(result){$("#"+type+aid).html(result);}
		});
		
	});
});

//读写cookie函数
function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start = document.cookie.indexOf(c_name + "=")
		if (c_start != -1)
		{
			c_start = c_start + c_name.length + 1;
			c_end   = document.cookie.indexOf(";",c_start);
			if (c_end == -1)
			{
				c_end = document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		}
	}
	return null
}

function setCookie(c_name,value,expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString()); //使设置的有效时间正确。增加toGMTString()
}

function postBadGood(type,id){}
</script>
</head>
<body>
<?php include(DEDEMEMBER."/templets/head.htm"); ?>
<div class="wrapper lineT">
  <div class="mainBox">
       <div class="bgGrass lineB mB10 location" style='margin-bottom:0px'>
					<div class="fLeft"><strong>随便踩踩</strong></div>
					<div class="fRight titSecondary white" style="margin-top:10px;">
            	<em class="icobg"><a href='caicai.php'>全部</a></em>
              <?php if($sort!='lastpost'){ ?>
              <em class="icobg">
              	<a href='caicai.php?tid={dede:global.tid/}'>时间</a>
              </em>
              <?php
              }
              if($sort!='goodpost'){
              ?>
              <em class="icobg">
              	<a href='caicai.php?tid={dede:global.tid/}&sort=goodpost'>好评</a>
              </em>
              <?php
              }
              if($sort!='badpost'){
              ?>
              <em class="icobg">
              <a href='caicai.php?tid={dede:global.tid/}&sort=badpost'>差评</a>
              </em>
              <?php
              }
              if($sort!='scores'){
              ?>
              <em class="icobg">
              	<a href='caicai.php?tid={dede:global.tid/}&sort=scores'>积分</a>
              </em>
              <?php } ?>
					</div>
			</div><!-- //End TitleGuide -->
			<div class="caicaiLeft">
          <div class="allList">
            <ul>
              {dede:datalist}
              <li>
                <div class="img"><a href='{dede:field.arcurl /}' target='_blank'><img src='{dede:field.litpic /}' alt='{dede:field.title /}' /></a></div>
                <div class="nametxt">
                  <p class="p1"><strong><a href='{dede:field.arcurl /}' target='_blank'>{dede:field.title /}</a></strong></p>
                  <p class="p2"><img src='images/tag.jpg'/>最后评论：{dede:field.lastpost /}</p>
                  <p class="p2">　{dede:field.description function="cn_substr(@me, 160)" /}...</p>
                  <p class="p2">
                  	<img src='images/view.jpg'/>浏览：<em class="yellow mR10">{dede:field.click/}</em>
                  	<img src='images/comment.jpg'/>好评度：<em class="yellow mR10">{dede:field.scores/}</em>
                  	<img src='images/save.jpg'/><a href="../plus/feedback.php?aid={dede:field.id/}">评论</a>
                  </p>
                </div>
                <div class="caicai">
                  <div class='good' title='好评' id="{dede:field.id/}"> <span id='good{dede:field.id/}'>{dede:field.goodpost/}</span> </div>
                  <div class='bad' title='差评' id="{dede:field.id/}"> <span id='bad{dede:field.id/}'>{dede:field.badpost/}</span> </div>
                </div>
                <div class="clear"></div>
              </li>
              {/dede:datalist}
            </ul>
          </div>
          <div class="pages fRight mTB10">
          	{dede:pagelist listsize=4 listitem='info,index,end,pre,next,pageno'/}
            <div class="clear"></div>
          </div>
          <div class="clear"></div>
       </div><!-- //End caicaiLeft -->
     	<div class='caicaiRight'>
     		<dl class='caicaiArcBox arc'>
     			<dt class='good'>最受好评文章</dt>
     			<dd>
     			{dede:list bind='GetSortArc' order='goodpost' orderway='desc'}
     			<div class='boxtxt'><a href='{dede:field name='arcurl'/}'>{dede:field name='title'/}</a></div>
     			{/dede:list}
     			</dd>
     		<dl>
     		<dl class='caicaiArcBox arc'>
     			<dt class='bad'>最受争议文章</dt>
     			<dd>
     			{dede:list bind='GetSortArc' order='badpost' orderway='desc'}
     			<div class='boxtxt'><a href='{dede:field name='arcurl'/}'>{dede:field name='title'/}</a></div>
     			{/dede:list}
     			</dd>
     		<dl>
     		<dl class='caicaiArcBox arc'>
     			<dt class='hot'>最热门评文章</dt>
     			<dd>
     			{dede:list bind='GetSortArc' order='click' orderway='desc'}
     			<div class='boxtxt'><a href='{dede:field name='arcurl'/}'>{dede:field name='title'/}</a></div>
     			{/dede:list}
     			</dd>
     		<dl>
     		<dl class='caicaiArcBox'>
     			<dt class='memberlist'>活跃会员列表</dt>
     			<dd>
     				{dede:memberlist row='15'}
     				<div class='boximg'>
     					<a href='{dede:field name='spaceurl'/}' target='_blank'>
     						<img src='{dede:field.face/}' alt="{dede:field.spacename/}" />
     					</a>
     				</div>
     				{/dede:memberlist}
     			</dd>
     		<dl>
     	</div><!-- //End caicaiRight -->
     	<div class="clear"></div>
   </div>
</div>
<?php include(DEDEMEMBER."/templets/foot.htm"); ?>
</body>
</html>
