//version:1.0.6
var vote_init_ids='';

/*______Config Start______*/
/*
if(document.location.pathname.toLowerCase().indexOf('tpl_idxedit.aspx')<0)
{
	document.domain='ifeng.com';
}
*/
var vote_init_url='http://rank.ifeng.com/levelinfo.do';
var vote_post_url='http://rank.ifeng.com/postlevel.do';
var vote_succ_hints='顶过了';
var vote_none_hints='顶一下';
var	vote_item_login_words='你还没有登录呢!&nbsp;&nbsp;&nbsp;&nbsp;[ <a href="http://sso.ifeng.com/ssos/login.jsp?backurl='+location.href+'">登录</a> ]&nbsp;&nbsp;&nbsp;&nbsp;[ <a href="http://sso.ifeng.com/ssos/register.jsp?backurl='+location.href+'">注册</a> ]';
/*______Config End______*/

function item(id,hits,isHited){
	this.id=id;
	this.hits=hits;
	this.isHited=isHited;
}
function Item(){}
Item.prototype={
	_cache:[],
	add:function(item){
		this._cache[this._cache.length]=item;
	},
	show:function(){
		for(var i=0;i!=this._cache.length;i++){
			var _id=this._cache[i].id;
			var _sa=document.getElementById('s-'+_id+'-a');
			var _so=document.getElementById('s-'+_id+'-b');
			if(!_sa){continue;}
			_sa.innerHTML=this._cache[i].hits;
			if(!_so){continue;}
			if(this._cache[i].isHited){
				_so.innerHTML=vote_succ_hints;
			}else{	
				_so.innerHTML='<a href="#" onClick="item_vote('+_id+');return false;">'+vote_none_hints+'</a>';
			}
		}
	}
}
function user_item_vote(id){
	var _sa=document.getElementById('s-'+id+'-a');
	var _sb=document.getElementById('s-'+id+'-b');
	if(_sa)
	{
		_sa.innerHTML=parseInt(_sa.innerHTML)+1;
	}
	if(_sb)
	{
		_sb.innerHTML=vote_succ_hints;
	}
}
function user_item_login()
{
	var d=document;
	var w=420,h=63;
	var _dde=d.documentElement;
	//var _left=(_dde.clientWidth/2)+_dde.scrollLeft-(w/2);
	var _left=150;
	var _top=(_dde.clientHeight/2)+_dde.scrollTop-(h/1);
	var _bk=d.getElementById('s9102');
	_bk.style.width=(_dde.scrollWidth)+'px';
	_bk.style.height=(_dde.scrollHeight)+'px';
	_bk.style.MozOpacity='0.60';
	_bk.style.filter='Alpha(Opacity=60)';
	_bk.style.display='';
	var _bg=d.getElementById('s9106');
	_bg.style.width=w+'px';	
	_bg.style.height=h+'px';
	_bg.style.left=_left+'px';
	_bg.style.top=_top+'px';
	_bg.style.MozOpacity='0.85';
	_bg.style.filter='Alpha(Opacity=85)';
	_bg.style.display='';
	var _bx=d.getElementById('s9108');
	_bx.style.MozOpacity='0.90';
	_bx.style.filter='Alpha(Opacity=75)';
}
function user_item_login_cal_pos()
{
	var _bg=document.getElementById('s9106');
	var _dde=document.documentElement;
	var w=420,h=63;
	if(!_bg.style.display)
	{
		var _left=(_dde.clientWidth/2)+_dde.scrollLeft-(w/2);
		var _top=(_dde.clientHeight/2)+_dde.scrollTop-(h/1);
		_bg.style.left=_left+'px';
		_bg.style.top=_top+'px';
	}
}
function user_item_login_close()
{
	var d=document;
	var _bk=d.getElementById('s9102');
	var _bg=d.getElementById('s9106');
	_bk.style.display='none';
	_bg.style.display='none';
	document.getElementById('x905').src='';
}
function item_vote(id){
	if(document.domain!='ifeng.com')
	{
		document.domain='ifeng.com';
	}
	var o=document.getElementById('x905');
	o.src=vote_post_url+'?id='+id+'&rnd='+new Date().getTime();
}
function item_init(){
	document.getElementById('x905').src='';
	document.write('<scr'+'ipt src="'+vote_init_url+'?ids='+vote_init_ids+'&rnd='+new Date().getTime()+'"></script>');
}
document.write('<div style="display:none;position:absolute;top:0px;left:0px;z-index:99;background-color:#000" id="s9102"></div>');
document.write('<div id="s9106" style="display:none;position:absolute;top:0px;left:0px;z-index:100;"><table width="420" border="0" cellspacing="0" cellpadding="0"><tr><td align="right"><img src="http://img.ifeng.com/tres/pub_res/rate/no_login_top.gif" width="29" height="32"></td><td>&nbsp;</td></tr><tr><td width="32"><img src="http://img.ifeng.com/tres/pub_res/rate/no_login_bottom.gif" width="32" height="31"></td><td><div id="s9108" style="width:386px;height:27px;padding:1px 1px 1px 0;border:#005173 1px solid;border-left:0px;background:#fff;"><ul style="float:left;width:386px;height:27px;background:#f1eec1;list-style:none;padding:0px;margin:0px;"><li style="float:left;width:343px;padding:0px 10px 0 10px;height:19px;text-align:left;color:#005173;font-size:12px;line-height:26px;font-family:verdana;">'+vote_item_login_words+'</li><li style="float:left;width:19px;padding:4px 0 0 0;height:19px;text-align:left;"><img src="http://img.ifeng.com/tres/pub_res/rate/no_login_close.gif" style="cursor:pointer;" onClick="user_item_login_close();"></li></ul></div></td></tr></table></div>');
document.write('<iframe frameborder="0" height="0" width="0"  id="x905" src=""></iframe>');