jQuery(document).ready(function(){
	
	//翻页
	jQuery("div.pagination .left:empty").append("&laquo;&nbsp;Prev Page");
	jQuery("div.pagination .right:empty").append("Next Page&nbsp;&raquo;");
	
	jQuery("(div.pagination > span):has(a)").removeAttr("style");
	
	
	//广告
	jQuery(".ad_toggle").click(function(){
		jQuery(".related_inner > div").slideToggle("slow");
		jQuery(this).toggleClass("ad_toggle_active");
	});
	
	jQuery(":text, textarea").focus(function(){//留言框激活
		jQuery(this).parent().addClass("currentFocus");
		jQuery(".currentFocus .desc").css({"color" : "#3188c7"});
		jQuery(".currentFocus .message_input, .currentFocus #author, .currentFocus #email, .currentFocus #url").css({"border-color" : "#3188c7", "color" : "#000", "background-color" : "#fff"});
	});

	jQuery(":text,textarea").blur(function(){//blur
		jQuery(this).parent().removeClass("currentFocus");
		jQuery(".message_input, .desc, #author, #email, #url").removeAttr("style");
	});
	
	//头像阴影
	jQuery("ol.commentlist li.depth-1").hover(function(){
		jQuery(this).find("div>div>div>img").addClass("imghover")}, function(){
		jQuery(this).find("div>div>div>img").removeClass("imghover");
	});
	
	jQuery("ol.commentlist li.depth-1").hover(function(){
		jQuery(this).find("span.reply").removeClass("hide")}, function(){
		jQuery(this).find("span.reply").addClass("hide");
	});
	
	//回复按钮
	jQuery(".reply").click(function(){
		jQuery("#respond h3").addClass("remove_h3");
		jQuery(".remove_h3").css("display", "none");
	});
	
	jQuery("a#cancel-comment-reply-link").click(function(){
		jQuery("#respond h3").removeAttr("Style");
	});
	
	//scrollTo
	jQuery(".lac a").click(function(){
		jQuery.scrollTo("#respond", 800);return false;
	});
	
	jQuery(".btt").hover(function(){
		jQuery(".btt").css({"cursor": "pointer"});
	});
	
	jQuery(".btt").click(function(){
		jQuery.scrollTo("#topbar", 800);
		return false;
	});
	
	//显示邮件
	jQuery(".show_email").hover(function(){
		jQuery(this).css({"cursor": "pointer"});
	});
	
	jQuery(".show_email").click(function(){
		jQuery(this).replaceWith("<span class=\"show_email\">mottaed@gmail.com</span>");
	});
	
	//区分pings
	jQuery("li.pingback .left").append("<img class='avatar' src='http://imotta.cn/wp-content/themes/ultimo/images/pings.gif' height='48' width='48' alt='' />");
	jQuery("li.pingback .right span.reply").remove();
	
	//记住访客信息
	if(jQuery("#respond h3 .notyou").length > 0){
		jQuery("#respond .user_info").css("display", "none");
	}
	
	jQuery("#respond h3 .notyou").click(function(){
		jQuery("#respond .user_info").removeAttr("Style");
		jQuery("#respond h3").replaceWith("<h3>Leave a comment</h3>");
		return false;
	});
	
	//彩蛋
	jQuery(".egg").click(function(){
		jQuery(this).replaceWith("<strong>明信片索取</strong>: 给我发送一封标题为 \"I'm Feeling Lucky\" 的邮件, 运气好的话, 就能收到一张随机明信片.");
	});
	
});

