//Переопределяем стандартное поведение jsAjaxHistory.__hashListener
//чтобы знать когда происходит  document.getElementById(state.node).innerHTML
// - т.е. при нажатии на кнопку "Назад" в теле компанента происходит  обновление конетнта и на него снова нужно навесить js-коллбэки


    if (window.jsAjaxHistory)
    {
    	jsAjaxHistory.__hashListener = function ()
    	{
    	    if (jsAjaxHistory.obTimer)
		{
			window.clearTimeout(jsAjaxHistory.obTimer);
			jsAjaxHistory.obTimer = null;
		}

		if (null != jsAjaxHistory.obFrame)
			var current_hash = jsAjaxHistory.obFrame.contentWindow.document.body.innerText;
		else
			var current_hash = window.location.hash;

		if (!current_hash || current_hash == '#') current_hash = '__bx_no_hash__';

		if (current_hash.indexOf('#') == 0) current_hash = current_hash.substring(1);

		if (current_hash != jsAjaxHistory.expected_hash)
		{
			var state = jsAjaxHistoryContainer.get(current_hash);
			if (state)
			{
                $(document).trigger("history.before_update");
                //alert('main/ajax.js - history.before_update');
				document.getElementById(state.node).innerHTML = state.data; //вставляем данные из "Истории"
                //alert('main/ajax.js - history.after_update');
                $(document).trigger("history.after_update");


				jsAjaxUtil.UpdatePageTitle(state.title);
				if (state.nav_chain)
					jsAjaxUtil.UpdatePageNavChain(state.nav_chain);

				jsAjaxHistory.expected_hash = current_hash;
				if (null != jsAjaxHistory.obFrame)
				{
					var __hash = current_hash == '__bx_no_hash__' ? '' : current_hash;
					if (window.location.hash != __hash && window.location.hash != '#' + __hash)
						window.location.hash = __hash;
				}
			}
		}

		jsAjaxHistory.obTimer = setTimeout(jsAjaxHistory.__hashListener, 500);
    	}
    }

