// JavaScript Document
$("#homeModeNormal").click(function(){
	SetCookie("homeMode", "1", 365*24*60*60);
	return true;
});
$("#homeModeSimple").click(function(){
	SetCookie("homeMode", "2", 365*24*60*60);
	return true;
});

$("ul.simpleHead li a").click(function(){
	var bodyId=$(this).attr("rel");
	$(this).parents("ul.simpleHead").find("li").removeClass("on");
	$(this).parent().addClass("on");
	$(this).parents("ul.simpleHead").siblings(".simpleBody").slideUp("fast");
	$(this).parents("ul.simpleHead").siblings("#"+bodyId).slideDown("normal");
	return false;
});
$("ul.noAjax li a").unbind("click");
$("ul li.noAjax a").unbind("click");
function artVote(artID,N){
	var cents = N;
	if (cents>0) {cents=1;} else if (cents<0) {cents=-1;} else { return; }
	$.get("/include/ajax.asp?act=artVote&articleID="+ artID +"&cents="+ cents +"",function(data){
		if (data.indexOf("successful")>=0) {
			var cents2 = (parseInt($("#voteNet" + artID.toString()).html()) + cents).toString();
			$("#voteNet" + artID.toString()).html(cents2);
		}
	});
	if (window._authorID && _authorID>0 && N>0) {
		$.get("/include/ajax.asp?act=deCents&typeKey=voteBlog&articleID="+ artID +"&authorID="+ _authorID +"",function(data){
			//不操作
		});
	}
	return false;
}
function blogVote(artID,N){ //N = 1 / -1
	var cents = N;
	if (cents>0) {cents=1;} else if (cents<0) {cents=-1;} else { return; }
	$.get("/include/ajax.asp?act=blogVote&articleID="+ artID +"&cents="+ cents +"",function(data){
		if (data.indexOf("successful")>=0) {
			var cents2 = (parseInt($("#voteNet" + artID.toString()).html()) + cents).toString();
			$("#voteNet" + artID.toString()).html(cents2);
		}
	});
	return false;
}
function homeGoPage(listKind,ipage,perNum){
	if (!$("#simpleBody"+listKind).html() || ipage>1 || $("#simpleBody"+listKind).html().indexOf("上一页")>0) {
		//以下情况进行Ajax加载：首次加载；第二页以上；当前不在第一页
		$("#simpleBody"+listKind).html("<br /><br /><br /><br /><center><strong>载入中...</strong></center><br /><br /><br /><br /><br />");
		var ajaxUrlAdd='';
		if (window._stockCode && _stockCode!='') {ajaxUrlAdd="&stockCode="+ _stockCode +"";}
		if (window._authorID && _authorID>0) {ajaxUrlAdd= ajaxUrlAdd + "&userID="+ _authorID +"";}
		if (window._tag && _tag!="") {ajaxUrlAdd= ajaxUrlAdd + "&tag="+ encodeURIComponent(_tag) +"";}
		$.get("/include/ajax.asp?act=artList&listKind="+ listKind +"&ipage="+ ipage +"&perNum="+ perNum + ajaxUrlAdd +"",function(data){
			if (data) {//alert(data);
				$("#simpleBody"+listKind).html(data);
				externallinks();
			}
		});
	}
}

