ieEnhence = { //Plug the Holes in IE6 
	init: function() {
		if ($.browser.msie && navigator.userAgent.indexOf("MSIE 6") >= 0) { 
			this.form();
			this.firstLetter();
			this.skipTo();
		}
	},
	form: function() {
		$("input").each(function(){
			$(this).addClass($(this).attr("type"));
		});
		$("input[@type='text'], textarea").focus(function(){$(this).addClass("ie_focus")}).blur(function(){$(this).removeClass("ie_focus")});
	},
	firstLetter: function() {
		$("div.postentry").each(function() {
			$(" > p:first-child",this).addClass("first_line");
		});
	},
	skipTo: function() {
		$("#header ul.skipto").hover(function(){$(this).addClass("skipto_hover")}, function(){$(this).removeClass("skipto_hover")});
	}
};


toc = { //table of contents in very page

	init: function() {
		this.gtoc();
		this.ieScroll();
	},
	gtoc: function() {

		$("#home").append('<div id="toc"><div id="op"><a href="#">目录</a></div><div id="bd"><ol></ol></div></div>');

		$("div.post h2.posttitle").each(function(){

			$("<li><a href='#" + $(this).id() + "'>" + $(this).text() + "</a></li>").appendTo("#bd>ol");

		});
		$("p.pages").clone().appendTo("#bd");
		$("#bd").slideUp("slow");
		$("#toc").addClass("shrink");

		$("#op a").toggle(function(){ $("#bd").slideDown("slow"); $(this).html("关闭本页目录"); $("#toc").removeClass("shrink"); }, function(){ $("#bd").slideUp("slow"); $(this).html("目录"); $("#toc").addClass("shrink")});

	},
	ieScroll: function() {
		if ($.browser.msie && navigator.userAgent.indexOf("MSIE 6") >= 0) { 
			document.documentElement.onscroll = function() { /* I don't know why $("html").scroll() n
	ot work in ie!*/
				$("#toc").top(document.documentElement.scrollTop + 12 + "px");
			};
		}
	}

};


$(document).ready(function(){
	ieEnhence.init();

	toc.init();
});