var xmlHttp
function ajax_object($url,$handler,$method,$params){
if(!$method){ $method='GET' }
if (window.XMLHttpRequest){
   xmlHttp=new XMLHttpRequest();
   xmlHttp.onreadystatechange=$handler;
	 xmlHttp.open($method,$url,true);
	 if($method=='POST'){
      xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      xmlHttp.setRequestHeader("Content-length",$params.length);
      xmlHttp.setRequestHeader("Connection", "close");
			xmlHttp.send($params);
   }else{
      xmlHttp.send(null);
   }
	 return true;
} else if (window.ActiveXObject){
   xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
   if(xmlHttp){
	    xmlHttp.onreadystatechange=$handler;
	    xmlHttp.open($method,$url,true);
	    if($method=='POST'){
         xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
         xmlHttp.setRequestHeader("Content-length",$params.length);
         xmlHttp.setRequestHeader("Connection", "close");
				 xmlHttp.send($params);
      }else{
         xmlHttp.send();
	    }
			return true;
   }
}
return false;
}

function ajax_post_form($url,$handler,$fields){
   var $params='method=ajax';
	 for($i=0;$i<$fields.length;$i++){
			$params+='&'+$fields[$i]+'='+encodeURI(document.getElementById($fields[$i]).value);
	 }
   $res=ajax_object(ROOTURL+$url,$handler,'POST',$params);
	 return $res;
}