var xmlHttp;
function Ajax_Begin(){
	if (window.ActiveXObject){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	else if (window.XMLHttpRequest){
		xmlHttp=new XMLHttpRequest();		
	}	
}

function Digg(Type,TID){
	Ajax_Begin();
	var url="/Code/Digg.asp?Action=Digg&Type="+Type+"&ID="+TID;
	xmlHttp.open("POST",url,true);
	xmlHttp.onreadystatechange=Ajax_Ready;
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	xmlHttp.send(null);
}

function Ajax_Ready(){
	Digg_Btn.innerHTML="提交...";
	if(xmlHttp.readystate==4){	
		if(xmlHttp.status==200){
			if(xmlHttp.responseText==0){
				Digg_Num.innerHTML=(Math.round(Digg_Num.innerHTML)+1);
				Digg_Btn.innerHTML="已顶";
			}
			else if(xmlHttp.responseText==1){
				Digg_Btn.innerHTML="顶过了";
			}
		}
	}
}