// Sample
// net.ContentLoader('<?=CON_SITE_URL?>/send2friend/srv_send2friend.php','showResponse',null,'POST','movieName=' + movieName + '&userName=' + userName + '&friendName=' + friendName + '&friendEmail=' + friendEmail + '&movieLink=' + movieLink,'BlockSendToFriend','');

var net = new Object();

net.READY_STATE_UNINITIALIZED   = 0;
net.READY_STATE_LOADING     = 1;
net.READY_STATE_LOADED       = 2;
net.READY_STATE_INTERACTIVE   = 3;
net.READY_STATE_COMPLETE     = 4;

net.req = null;
net.method = '';
net.idblock = '';

net.ContentLoader = function(url,onload,onerror,method,params,idblock,contentType)
{
  this.onload = onload;
  /*this.onerror = (onerror) ? onerror:
  this.defaultError;*/
  this.idblock = idblock;

  this.method = method;

  this.loadDoc(url,params,contentType);
}

net.loadDoc=function(url,params,idblock,contentType)
{
  if(this.method == "POST")
  {
    if(!contentType)
    {
      contentType = "application/x-www-form-urlencoded";
    }
  }

  if(window.XMLHttpRequest)
  {
    this.req = new XMLHttpRequest();
  }
  else if (typeof window.ActiveXObject != "undefined")
  {
    this.req = new ActiveXObject
    ("Microsoft.XMLHTTP");
  }


  if(this.req)
  {
    try
    {
      this.req.onreadystatechange = net.ContentLoader.onReadyState;

      this.req.open(this.method,url,true);

      if(contentType)
      {
        this.req.setRequestHeader("Content-Type", contentType);
      }

      this.req.send(params);
    }
    catch (err)
    {
      this.onerror.call(this);
    }
  }
}

net.ContentLoader.onReadyState=function()
{
  var ready = net.req.readyState;
  var data = null;

  if(ready == net.READY_STATE_COMPLETE)
  {
    data = net.req.responseText;
    updateBody(net.idblock, data);
  }
}

function updateBody(id, data)
{
  document.getElementById(id).innerHTML = "";
  document.getElementById(id).innerHTML = data;
}