﻿/*
1   var text1=new ajax().connect("test.html","get","id=1")
2   var text2=new ajax().connect("test.html","post","")
*/
function ajax(){
	var xmlhttp=null;
	var xmlvalue=null;
	
	if(window.ActiveXObject){
		var arr=["Msxml2.XMLHTTP.6.0","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP","Microsoft.XMLHTTP"];
		for(var i=0;i<arr.length;i++){
			try{
				xmlhttp=new ActiveXObject(arr[i]);
				break;
			}catch(e){
				xmlhttp=null;
			}
		}
	}else if(window.XMLHttpRequest){
		try{
			xmlhttp=new XMLHttpRequest();
		}catch(e){
			xmlhttp=null;
		}
	}else{
		xmlhttp=null;
	}

	if(xmlhttp==null) return null;  
	
	this.connect=function(url,method,postContent){
		method=method.toUpperCase();
		try{
		    if (method == "GET") {
			   if(postContent!=""){
				xmlhttp.open(method,url+"?"+postContent,false);
				}else{
				    xmlhttp.open(method,url,false);
				}
				xmlhttp.setRequestHeader("Content-Type","text/html;charset=GB2312");
			}else{
				xmlhttp.open(method,url,false);
				xmlhttp.setRequestHeader("Content-type","text/xml");
				xmlhttp.setRequestHeader("Method","POST "+url+" HTTP/1.1");
				//xmltttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			}
			xmlhttp.send(method=="POST"?postContent:null);
			xmlvalue=unescape(xmlhttp.responseText);			
			xmlhttp=null;
			return xmlvalue;
		}catch(e){
			return null;
		}
	}
}


        //增加资讯正文右侧中医文化（8个新闻列表）ip统计量
       function statisticIp(linkid,linkurl)
       {
         $.get("/uiajax/TCM_Ajax.aspx?action=statisticIP&LinkId="+linkid+"&LinkUrl="+linkurl)

       }
