jQuery(function($){
	uibutton("input.uibutton");
	refreshDate();
	setInterval(function(){refreshDate()}, 10000);
	
	$("div.post-content a:not([target])").each(function(){
		$(this).attr("target", "_blank");
	});
	
	var highlightStat="off";
	var highlighBodyBlacker, highlightCode, highlightTimeout;
	$("div.wp_syntax")
		.bind("mouseenter mouseover mousemove",function(){
			var oT = $(this);
			var pT = oT.position();
			
			clearTimeout(highlightTimeout);
			highlightTimeout = setTimeout(function(){
				if (highlightStat == "on") { return false; }
				
				highlightStat = "on";
				highlightBodyBlacker = $("<div></div>")
					.css({
						position: "absolute",
						left: 0,
						top: 0,
						width: "100%",
						height: $("#wrap").height(),
						background: "#000",
						zIndex: 1,
						opacity: 0
					})
					.appendTo("body")
					.animate({opacity: 0.3})
					.bind("mouseover mouseenter mousemove", function(){
						if (highlightStat == "off") { return false; }
						
						highlightStat = "off";
						highlightBodyBlacker.animate({opacity:0},200,function(){$(this).remove();highlightBodyBlacker="";});
						highlightCode.animate({
							left: pT.left,
							width: oT.width()
						},200,function(){
							$(this).animate({opacity:0},500,function(){$(this).remove()});
							highlightCode="";
						});
					})
					;
				
				highlightCode = $("<div class='wp_syntax'></div>")
					.html(oT.html())
					.css({
						position: "absolute",
						left: pT.left,
						top: pT.top,
						zIndex: 2,
						width: oT.width(),
						height: oT.height(),
						boxShadow: "0 0 20px #333",
						borderColor: "#aaa"
					})
					.animate({
						left: 0,
						width: "+="+pT.left+"px",
						borderColor: "#000"
					})
					.appendTo("#wrap")
					;
			}, 0);
		});
});
