// JavaScript Document
function createAjaxObj(){
	var httprequest = false;
	if(window.XMLHttpRequest){
	  //if Mozilla,Safari etc
	  httprequest = new XMLHttpRequest();
	  if(httprequest.overrideMimeType){
	   httprequest.overrideMimeType('text/xml');
	  }
	}else if(window.ActiveXObject){
	  //IE
	  try{
	   httprequest = new ActiveXObject("Msxml2.XMLHTTP");
	  }catch(e){
	   try{
		httprequest = new ActiveXObject("Microsoft.XMLHTTP");
	   }catch(e){}
	  }
	}
	return httprequest;
}

function getcounter_view(){
	var obj =createAjaxObj();
	
	obj.open('get','/adminHTML/ajax.asp?act=counter_view&pid=' + myid,false);
	obj.onreadystatechange = function(){
		if(obj.readyState == 4)//如果请求完成
		{
		  if(obj.status==200)//并且为正确状态
		  {
		   	document.getElementById('counter_view').innerHTML = obj.responseText;//返回服务器处理结果,1成功，0失败
		  }
		}

	}
  //当方法为POST时需要如下设置HTTP头
  //obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  obj.send(null);//发送请求

}

function getcounter(){
	var obj = createAjaxObj();
	
	obj.open('get','/adminHTML/ajax.asp?act=counter&pid=' + myid,true);
	
	obj.onreadystatechange = function(){
		if(obj.readyState == 4)//如果请求完成
		{
		  if(obj.status==200)//并且为正确状态
		  {
		   	document.getElementById('counter').innerHTML = obj.responseText;//返回服务器处理结果,1成功，0失败
		  }
		}

	}
  //当方法为POST时需要如下设置HTTP头
  //obj.setRequestHeader("Content-type","application/x-www-form-urlencoded");
  obj.send(null);//发送请求

}

window.onload = function(){
	getcounter();
	getcounter_view();
}

