try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}

var ajax = {


    toPost : function (url , form , toId  )
    {

            param = script.camposForm(form);

            xmlhttp.open('POST', url , true);

            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

            xmlhttp.onreadystatechange = function()
            {
                                       if  (xmlhttp.readyState == 1)
                                       {

                                       }

                                       if (xmlhttp.readyState == 4)
                                       {
                                          if (xmlhttp.status == 200)
                                          {
                                             resposta = xmlhttp.responseText;
                                             alert ( resposta );
                                             form.reset();

                                          }
                                       }
            }

            xmlhttp.send(param);
    }
}



