// JavaScript Document
//文章投票
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($(".art_ding_num").html()) + cents).toString();
			$(".art_ding_num").html(cents2);
		}
	});
	
	if (N>0) {
		$.get("/include/ajax.asp?act=deCents&typeKey=voteBlog&articleID="+ _articleID +"&authorID="+ _authorID +"",function(data){
			//不操作
		});
	}
	return false;
}
//评论翻页
function replyPage(N){
	
}
//加分
$.get("/include/ajax.asp?act=deCents&typeKey=readBlog&articleID="+ _articleID +"&authorID="+ _authorID +"",function(data){
	//不操作
});

//加载文章相关信息
  	var userName = GetCookie("usernameJS");
	if (userName) {
		$(".head_member").html('您好，'+ userName +' <a href="/members/msgBox.asp" target="_blank">短信<span class="msgNewNum"></span></a> | <a href="/members/control.asp" target="_blank">会员中心</a> | <a href="/user/'+ userName +'/" target="_blank">个人主页</a>');
		$("#replyUsername").val(userName);
		$("#replyUserpass").val("******");
	} else {
		$(".head_member").html('<a href="/members/" target="_blank">登录</a>|<a href="/members/register.asp" target="_blank">注册</a>');
		$("#replyUsername").val("游客");
		$("#replyUserpass").val("");
	}
	//短信数量
	if (GetCookie("usernameJS")) {$.get("/include/ajax.asp?act=msgNewNum&username="+ GetCookie("usernameJS") +"&"+ Math.random() +"",function(data){
		if (data) {//alert(data);
			$(".msgNewNum").html(data);
		}
		});
	}
		
  //目录点击展开#category, 同ajaxAll.js里的 
	$(".list1 a:has(span), .list1 a:has(span)").click(function(){
		var j_catNext = $(this);
		if(j_catNext.siblings("div.list2").css("display")=='block'){
				j_catNext.siblings("div.list2").hide();
				j_catNext.children(".catNext").html("[+]");
			} else {
				j_catNext.siblings("div.list2").show();
				j_catNext.children(".catNext").html("[-]");	
			}
		return false;
	});
	$(".list1 a, .list2 a").click(function(){
		var j_catNext = $(this);
		if(j_catNext.attr("class")!="on"){$(".list1 a, .list2 a").attr("class",""); j_catNext.attr("class","on");}
	});
	//默认打开的子目录[-]
	$(".list1 a:contains('[-]')").each(function(){
		var j_catNext = $(this);
		j_catNext.siblings("div.list2").show();
		j_catNext.children(".catNext").html("[-]");
	});
  //End: 目录点击展开#category
  
  //blogLogo图片大小
	$("#blogLogo").each(function(i){
		if(this.complete || this.readyState =="complete") { DrawImage(this,120,112); }
		else {
			this.onreadystatechange = function(){ 
				if(this.readyState =="complete") { DrawImage(this,120,112); }
			} 
		}
	});
	$("#blogLogo2").each(function(i){
		if(this.complete || this.readyState =="complete") { DrawImage(this,150,150); }
		else {
			this.onreadystatechange = function(){ 
				if(this.readyState =="complete") { DrawImage(this,150,150); }
			} 
		}
	});
	
	//$(".blog_cont_ad").html("");
	//$(".blog_inc1").html("");
	//$(".blog_inc2").html("");
	

	//订阅按钮
	$("#blogRssMoreAct").toggle(function(){
			$(this).html("收起");
			$(".rssMore").prepend('<div id="rssMoreCont"><a href="http://www.xianguo.com/subscribe.php?url=http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external"><img class="rsslist" alt="订阅到鲜果" src="/images/rss/xianguo.jpg" /></a><br /><a href="http://www.bloglines.com/sub/http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external"><img class="rsslist" alt="订阅到bloglines" src="/images/rss/bloglines.gif" /></a><br /><a href="http://www.netvibes.com/subscribe.php?url=http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external"><img class="rsslist" alt="订阅到netvibes" src="/images/rss/netvibes.gif" /></a><br /><a href="http://www.rojo.com/add-subscription?resource=http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external"><img class="rsslist" alt="订阅到Rojo" src="/images/rss/rojo.gif" /></a><br /><a href="http://rss.hexun.com/sub/http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external" title="订阅到和讯"><img class="rsslist" src="/images/rss/hexun.gif" /></a><br /><a href="http://www.live.com/?add=http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external" title="订阅到Live.com"><img class="rsslist" src="/images/rss/live.gif" /></a><br /><a href="http://www.emailrss.cn/?rss=http://www.365bull.com/rss/user.asp?ID='+ _authorID +'" rel="external" title="使用RSS邮天下邮件订阅"><img class="rsslist" src="/images/rss/emailrss.gif" /></a><br /></div>');
			return false;
		},
		function(){
			$(this).html("更多");
			$("#rssMoreCont").remove();
			return false;
		}
	);
	
	//最新股友等卡片切换(.pt00)
	var plistN = $(".pt00_on").children("a").attr("rev");
	$.get("/include/ajax.asp?act=blogUserList&listN="+plistN+"",function(data){
		if (data) {//alert(data);
			$(".leftPerson .personList").append(data);
			$(".leftPerson .personList0"+plistN+"").show();
		}
	});
	$(".leftPerson .pt00").click(function(){
		$(this).siblings(".pt00").css({margin:'2px 0 0 0', padding:'3px 6px', background:'#FFEBD0', 'border-bottom':'#EFC993 solid 1px', position:'relative', top:'1px', 'font-weight':'normal'});
		$(this).css({margin:'0', padding:'4px 8px', background:'#FFFFFF', 'border-bottom':'none', position:'relative', top:'2px', 'font-weight':'bold'});
		$(".leftPerson .personList00").hide();
		var plistN = $(this).children("a").attr("rev");
		var $pThisList = $(".leftPerson .personList0"+ plistN +"");
		if ($pThisList.html()) { $pThisList.show();}
		else { 
			$.get("/include/ajax.asp?act=blogUserList&listN="+ plistN +"",function(data){
				if (data) {//alert(data);
					$(".leftPerson .personList").append(data);
					$pThisList.show();
				}
			});
		}
		return false;
	});
	
	//支持数和评论数等更新
	$.ajax({url:"/include/ajax.asp?act=artShow&type=blogPost&articleID="+ _articleID +"", type:"GET", dataType:"xml", timeout:8000, 
		success:function(xml){//alert(xml);
		if (xml) {
			var voteNum = $(xml).find("item:first").find("voteNum").text();
			var replyNum = $(xml).find("item:first").find("replyNum").text();
			var hitNum = $(xml).find("item:first").find("hitNum").text();
			var userImg = $(xml).find("item:first").find("userImg").text();
			$(".art_ding_num").html(voteNum.toString());
			$(".art_reply_num").html(replyNum.toString());
			$(".art_hit_num").html(hitNum.toString());
			if (userImg) { $(".art_auImg").attr("src","/UploadFile/userPic/"+userImg);}
		}//End if
		}//End function
	});
	
	$.get("/include/ajax.asp?act=art_reply_list&type=blogPost&articleID="+ _articleID +"&preUrl="+ _ug +"",function(data){
		if (data) {	$(".replys").html(data);	}
	});
	
	//tags
	$(".blogTagsMore>a").toggle(function(){
		$(".blogTagsMoreDiv").show("normal");
	},function(){
		$(".blogTagsMoreDiv").hide("normal");
	});

//End
$(function(){
});


