/**
 * @author 罗田
 * 
 */
var xmlHttp;
function MyAjax(){        
        if (window.XMLHttpRequest){
            xmlHttp=new XMLHttpRequest();
        }
        else if (window.ActiveXObject){
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
} 

/**
*参数1:method,数据传递方?
*参数2:URL,路径
*参数3:asyn,是否异步传输
*参数4:fun,回调函数
*/
 MyAjax.prototype.sendData = function(method,URL,asyn,fun) {
    if(asyn){
		
        xmlHttp.onreadystatechange=function(){
			
			if(xmlHttp.readyState==4 && xmlHttp.status==200){
				fun(xmlHttp);
			}
		}		
    }	
	if(method=="POST"){
		xmlHttp.open("POST",URL,asyn);
		xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xmlHttp.send(null);
	}
	
	else{
		xmlHttp.open("GET",URL,asyn);
       	xmlHttp.send(null);
	}
}

MyAjax.os=function(){
   if(navigator.userAgent.indexOf("MSIE")>0) { 
        return "MSIE"; 
   } 
   else if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
        return "Firefox"; 
   }
   else{
   		return "";
   } 

}

