jQuery(function($) {
	//下拉菜单
	$("#nav li").hover(
		function () { $(this).children("ul").slideDown(200); },
		function () { $(this).children("ul").slideUp(200); }
	);

	//选项卡
	$(".tab li:first-child").addClass("current");
	$(".tabLayout:first-child").fadeIn(500);
	$(".tabBox").find(".tabLayout:not(:first-child)").hide();
	$(".tabLayout").attr("id", function(){return idNumber("No")+ $(".tabLayout").index(this)});
	$(".tab li").click(function(){
		var c = $(".tab li");
		var index = c.index(this);
		var p = idNumber("No");
		show(c,index,p);
	});	
	function show(controlMenu,num,prefix){
		var content= prefix + num;
		$('#'+content).siblings().hide();
		$('#'+content).fadeIn(500);
		controlMenu.eq(num).addClass("current").siblings().removeClass("current");
	};	
	function idNumber(prefix){
		var idNum = prefix;
		return idNum;
	};

	//图片效果
	$("#pic4home li:even").addClass("even");
	$("#pic4home li img").fadeTo(200, 0.7);
	$("#pic4home li img").hover(
		function () { $(this).fadeTo(200, 1); },
		function () { $(this).fadeTo("slow", 0.7); }
	);
	$("#guest li img").fadeTo(200, 0.7);
	$("#guest li img").hover(
		function () { $(this).fadeTo(200, 1); },
		function () { $(this).fadeTo("slow", 0.7); }
	);

	//图片效果for相册
	$(".anAlbum .cover a").fadeTo(200, 0.7);
	$(".anAlbum .cover a").hover(
		function () { $(this).fadeTo(200, 1); },
		function () { $(this).fadeTo("slow", 0.7); }
	);
	$(".anAlbum .cover a").fadeTo(200, 0.7);
	$(".anAlbum .cover a").hover(
		function () { $(this).fadeTo(200, 1); },
		function () { $(this).fadeTo("slow", 0.7); }
	);

	//文章列表隔行换色
	$("#main .list li:odd").addClass("even");
	$("#main .lwList:odd").addClass("even");
	$("#main .cmtList:odd").addClass("even");

	//文章页字体大小
	function clearCurrent() { $("#articleInfo input").removeClass("current"); }
	function getFontSize(fontSize) { $("#content").attr("style", "font-size:" + fontSize + "px;"); }
	$("#fontSmall").click( function () { clearCurrent(); getFontSize(12); $(this).addClass("current"); } );
	$("#fontMedium").click( function () { clearCurrent(); getFontSize(13); $(this).addClass("current"); } );
	$("#fontLarge").click( function () { clearCurrent(); getFontSize(14); $(this).addClass("current"); } );

	//strict新窗口打开
	$("a[rel=external]").attr('target', '_blank');

	//显示/隐藏弹出层
	$("#showNotice").click( function () { $(".pop").fadeOut(500); $("#notice").slideDown(200); $(".pop input.btn").focus(); } );
	$(".pop h2 span").click( function () { $(this).parent().parent().slideUp(200); } );
	$(".pop input.btn").click( function () { $(this).parent().parent().parent().fadeOut(500); } );

	//留言本头像层
	$("#headPic").click( function () { $("#headBox").slideDown(200); } );
	$("#headBox span").click( function () { $("#headBox").slideUp(200); } );
	$("#headBox a").click( function () {
		$("#headPic").attr("src",$(this).children().attr("src"));
		$("#headBox").slideUp(200);
	} );
});
	//弹层
function popLayer(content,title) {
	$(".pop").fadeOut(500);
	var content;
	var title;
	title = ( title == undefined ) ? '提示信息' : title;
	$("body").append('<div class="pop" style="display:block;"><h2><em>' + title + '</em><span title="关闭" onclick="$(this).parent().parent().slideUp(200);">关闭</span></h2><div class="box"><div class="popContent">' + content + '</div><p class="cent"><input type="button" class="btn" value="关闭" onclick="$(this).parent().parent().parent().fadeOut(500);" /></p></div><div class="fe"></div></div>');
	$(".pop input.btn").focus();
}