/* -----------------------------------------------------------------------------
  file: ajax.js
  file version: 1.0.1
  date: 2008-01-01
  ------------------------------------------------------------------------------
  author: grum at grum.dnsalias.com
  << May the Little SpaceFrog be with you >>
  ------------------------------------------------------------------------------

   this classes provides base functions to add ajax into html page

  ------------------------------------------------------------------------------
  HISTORY VERSION
  v1.0.1  + [create_httpobject] overrideMimeType unknown by IE 7.0 ;
              
   -------------------------------------------------------------------------- */



  function create_httpobject(requesttype, charset, ajaxurl, async)
  {
    if (window.XMLHttpRequest)
    {
      // IE7 & FF method
      http_request = new XMLHttpRequest();
    }
    else
    {
      //Other IE method.....
      if (window.ActiveXObject)
      {
        try
        {
          http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
          try
          {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
          }
          catch (e)
          {
            window.alert("Your browser is unable to use XMLHTTPRequest");
          } // try-catch
        } // try-catch
      }
    } // if-else

    if(charset=='') { charset='iso-8859-1'; }

    http_request.onreadystatechange = function() {  };
    http_request.open(requesttype.toUpperCase(), ajaxurl, async);
    try
    {
      http_request.overrideMimeType('text/html; charset='+charset);
    }
    catch(e)
    {
    }

    if(requesttype.toUpperCase()=='POST')
    {
      http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    }
    return(http_request);
  }
