/********************************************************/
/* magDOM-UB-Ajax                                       */
/*                                                      */
/* writen by Magnum                                     */
/* date 2008/10/5                                       */
/********************************************************/

UB.Ajax.Request = function(url,$key,func,res){
 var req;
 var response;
 try{
  req = new ActiveXObject("Msxml2.XMLHTTP");
 }catch(e){
  try{
   req = new ActiveXObject("Microsoft.XMLHTTP");
  }catch(e){
   req = false;
  }
 }
 if(!req && typeof XMLHttpRequest != "undefined"){
  req = new XMLHttpRequest();
 }
 if(req){
  req.onreadystatechange = function(){
   if(req.readyState == 4 && req.status == 200){
    if(res == 'txt'){
     response = req.responseText;
    }else if(res == 'xml'){
     response = req.responseXML;
    }
    func(response);
   }
  }
  req.open('POST',url);
  req.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
  req.send($key);
 }
}