﻿
addComment = {
	moveForm : function(commId, parentId, respondId, postId) {
		var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID');

		if ( ! comm || ! respond || ! cancel || ! parent )
			return;

		t.respondId = respondId;
		postId = postId || false;

		if ( ! t.I('wp-temp-form-div') ) {
			div = document.createElement('div');
			div.id = 'wp-temp-form-div';
			div.style.display = 'none';
			respond.parentNode.insertBefore(div, respond);
		}

		var nextSibling = comm.nextSibling
		while(nextSibling){
			nextSibling = nextSibling.nextSibling
		}
		comm.insertBefore(respond, nextSibling);
		
		if ( post && postId )
			post.value = postId;
		parent.value = parentId;
		cancel.style.display = '';
		
		cancel.onclick = function() {
			var t = addComment, temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId);

			if ( ! temp || ! respond )
				return;

			t.I('comment_parent').value = '0';
			temp.parentNode.insertBefore(respond, temp);
			temp.parentNode.removeChild(temp);
			this.style.display = 'none';
			this.onclick = null;
			return false;
		}
		
		try { t.I('comment').focus(); }
		catch(e) {}

		return false;
	},

	I : function(e) {
		return document.getElementById(e);
	}
}





	
	function doApi(json_str){
	var taotao=document.getElementById('taotao');
	var taotaoTip = json_str.posts[0].cn;
	var times = json_str.posts[0].time.split(',')
	var timef =['','秒钟','分钟','小时','天']
	var time_str = times[1]+timef[times[0]]
	taotao.innerHTML = '<a target="_blank" class="taotao_link" href="http://www.taotao.com/v1/space/6602800"><span title="华丽的悬浮在'+time_str+'前在滔滔上说到">'+taotaoTip+'</span></a>';
	
	
	
	if(document.title.indexOf('-')>0 ) document.title = document.title.split('-')[0]+'- '+taotaoTip;
	
	}
	
	function creatTaoTao(){
	var taotao = document.createElement('script');
	taotao.type="text/javascript" ;
	taotao.charset="utf-8";
	taotao.src = "http://www.taotao.com/cgi-bin/msgj?qq=6602800&num=1&t=0&"+Math.random();
	document.getElementsByTagName('body')[0].appendChild(taotao);
	}
	function addLoadListener(fn)
	{
	  if (typeof window.addEventListener != 'undefined')
	  {
		window.addEventListener('load', fn, false);
	  }
	  else if (typeof document.addEventListener != 'undefined')
	  {
		document.addEventListener('load', fn, false);
	  }
	  else if (typeof window.attachEvent != 'undefined')
	  {
		window.attachEvent('onload', fn);
	  }
	  else
	  {
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
		{
		  window.onload = fn;
		}
		else
		{
		  window.onload = function()
		  {
			oldfn();
			fn();
		  };
		}
	  }
	}
	addLoadListener(creatTaoTao);
	
	
var itemArray;
var itemCount;
var inter;
var itemHash=[];
var inter;




