// JavaScript Document




function getxml(){
	var h;
	
	if(window.XMLHttpRequest) { 
		h = new XMLHttpRequest();
		if (h.overrideMimeType) {
			h.overrideMimeType("text/xml");
		}
	}
	else if (window.ActiveXObject) { 
		try {
			h = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				h = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!h) { 
		window.alert("can't create XMLHttpRequest object.");
		return null;
	}
	return h;
	}



function article_add_collection(a_r_d){
	var h=getxml();
	url="get_add_to_user_article_collection.asp?article_id="+a_r_d;
	h.open("get",url,true);
	h.send(null);
	document.getElementById("shoucang_1").style.display="block";
	setTimeout("shoucang_1_hide()",3000);
}

function shoucang_1_hide(){
	document.getElementById("shoucang_1").style.display="none";
	}
	

//帖子投票
function article_score(article_id){
	var hvote=getxml();
	url="vote_select.asp?sj="+Math.random()+"&article_id="+article_id;
	hvote.open("get",url,true);
	hvote.send(null);
	hvote.onreadystatechange=function(){
		if (hvote.readyState==4){
			if(hvote.status==200){
				document.getElementById("view_article_score").innerHTML=hvote.responseText;
				hvote=null;
			}
		}
	}
   //article_score_ping_fen(article_id);
}
//帖子投票


//帖子评分列表
function article_score_ping_fen(article_id){
	var hvote=getxml();
	url="score_list_show.asp?sj="+Math.random()+"&article_id="+article_id;
	hvote.open("get",url,true);
	hvote.send(null);
	hvote.onreadystatechange=function(){
		if (hvote.readyState==4){
			if(hvote.status==200){
				document.getElementById("pingfen_list_td_"+article_id).innerHTML=hvote.responseText;
				hvote=null;
			}
		}
	}
}
//帖子评分列表



//帖子投票点击
function article_score_click(vaidv,vartida){
	var vradioall=document.getElementsByName("vradio");
	for(vivig=0;vivig<vradioall.length;vivig++){
		    vradioall[vivig].disabled=true;
		}
	var hvote=getxml();
	url="vote_select_get.asp?sj="+Math.random()+"&article_id="+vartida+"&vid="+vaidv;
	hvote.open("get",url,true);
	hvote.send(null);
	hvote.onreadystatechange=function(){
		if (hvote.readyState==4){
			if(hvote.status==200){
				if(hvote.responseText==1){
					article_score(vartida);
					hvote=null;
					}
			}
		}
	}
}
//帖子投票点击






//关注帖子
function gzwrite(gzarticle_id){
	if(gzarticle_id!=203&gzarticle_id!=18&gzarticle_id!=75&gzarticle_id!=72&gzarticle_id!=77){
		
	  var hgz=getxml();
	  url="../../../images/gz.asp?sj="+Math.random()+"&board_id="+gzarticle_id;
	  hgz.open("get",url,true);
	  hgz.send(null);
	  hgz.onreadystatechange=function(){
		if (hgz.readyState==4){
			if(hgz.status==200){
				document.getElementById("gztiezidiv").innerHTML=hgz.responseText;
				hgz=null;
			}
		}
	  }
	
	
	}
}
//关注帖子

//广告贴
jQuery.noConflict();
jQuery(function(){
  jQuery("#adtiezidel").click(function(){
	if(window.confirm("确定删除该广告贴?")){
		var artid=jQuery("#adtiezidel").attr("class");
		jQuery.get("adarticle.php",{article_id:artid,rnd:Math.random()},function(result){
						if(result==1){
						   alert("该广告贴删除成功");						   
					    }else{
						   alert("没有权限");
						}
						window.close();
	                }
		);		
	}								 
  })
  
  
})
//广告贴


///贴内置顶
function replyintop(a,b,c){
	  if(window.confirm("确定执行该操作?")){
		  jQuery.get("replytop.php",{article_id:a,root_id:b,typeid:c,rnd:Math.random()},function(d){if(d==1){alert("操作成功");}else{alert("操作失败");}});
	  }
}
///贴内置顶