function makeHttpRequest(url, callback_function, return_xml)
{
    var http_request = false;

    //Пытаемся создать объект всеми доступными способами
    if (window.XMLHttpRequest)
      { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();

        //Для правильного отображения на русском языке
        if (http_request.overrideMimeType)
          {
              //http_request.overrideMimeType('text/xml');
              http_request.overrideMimeType('text/plain;charset=windows-1251');
          }
       }
    else if (window.ActiveXObject)
       { // IE
          try
          {
              http_request = new ActiveXObject("Msxml2.XMLHTTP");
          }
          catch (e)
          {
              try
               {
                  http_request = new ActiveXObject("Microsoft.XMLHTTP");
               }
              catch (e) {}
          }
       }

    //Если все-таки не удалось-не судьба...
    if (!http_request)
    {
        alert('Unfortunatelly you browser does not support this feature: XMLHttpRequest');
        return false;
    }

    //Ждем изменения состояния на 200 ОК и передаем все вызывающей функции
    http_request.onreadystatechange = function()
     {
        if (http_request.readyState == 4)
        {
            //После || - условие для локальных адресов, там XMLHttpRequest возвращает status=0
            if (http_request.status == 200 || location.href.indexOf('http:')<0&&http_request.status==0)
             {
                if (return_xml)
                {
                    eval(callback_function + 'http_request.responseXML)');					
                }
                else
                {
                    //alert(http_request.responseText);
                    eval(callback_function + 'http_request.responseText);');
                    //eval("setInnerHtml('03101','123');");

                }
             }
            else
             {
                alert('There was a problem with the request.(Status: ' + http_request.status + ')');
             }
        }
     }

    //Открытие запроса
    http_request.open('GET', url, true);
    http_request.send(null);
}

//--------------------------------------------------------------------------------------------------------
//-----------Вызов индексатора (/risearch/spider.php проверяет дату /risearch/last_index.cfg)-------------
//--------------------------------------------------------------------------------------------------------
   //Для вызова нужно в _head.tpl прописать <script language="JavaScript" src="/image/common.js"></script>
   //var out_xml='';
   //makeHttpRequest("/risearch/spider.php", "alert(", out_xml);   
   //makeHttpRequest("/risearch/spider.php", "void(", out_xml);  
//--------------------------------------------------------------------------------------------------------   
//----------/Вызов индексатора (/risearch/spider.php проверяет дату /risearch/last_index.cfg)-------------
//--------------------------------------------------------------------------------------------------------

function change_banner(id, count, time){
	var next_id = id%count+1;
	var imgPreloader = new Image();
	
	imgPreloader.onload = (function(){
		var link = document.getElementById('top_banner');
		var img_old = link.getElementsByTagName('IMG');
		if(img_old.length > 0){
			img_old = img_old[0];
			img_old.style.position = 'relative';
			img_old.style.zIndex = 1;
			
			var img = img_old.cloneNode(true);
			img.src = '/image/main_banner-0'+next_id+'.jpg';
			img.style.position = 'absolute';
			img.style.zIndex = 0;
			link.insertBefore(img, img_old);
			
			var myFx = new Fx.Style(img_old, 'opacity', {duration: 2000});
			myFx.start(1, 0);
			myFx.addEvent('onComplete', function(){
													link.removeChild(img_old);
													img.style.position = 'relative';
													img.style.zIndex = 1;
													setTimeout('change_banner('+next_id+', '+count+', '+time+')', time);
												   });
		}
	});
	imgPreloader.src = '/image/main_banner-0'+next_id+'.jpg';
}
