var OK = false;
var remove_func;
var set_focus;
document.onkeydown = key;

function key()	{

if(window.event) {
	 var k = event.keyCode;
	 if(k==13 && $('loading-layer').style.display == 'block')  {
		    $('loading-layer').style.display = 'none';
		    if (OK==true) remove_func();
		    if (set_focus != '') set_focus.focus();
		    return false;
		    }
	 if(k==27) {
		    if ($('loading-layer').style.display == 'block') $('loading-layer').style.display = 'none';
		    else if (GB_CURRENT != null) parent.parent.GB_hide();
		    if (set_focus != '') set_focus.focus();
		   }
}

}

function show_message(text){
	if (text==undefined) text = 'Обработка данных';
	var top = (document.body.scrollTop>0) ? document.body.scrollTop : document.documentElement.scrollTop;
	$('loading-layer').style.width = '200px';
	$('loading-layer').style.textAlign = 'center';
	$('loading-layer').style.display = 'block';
    	$('loading-actions').style.display = 'none';
    	$('loading-actions-confirm').style.display = 'none';
	if (self.screen) $('loading-layer').style.top = (parseInt(top,10)+(screen.height/2)-200)+'px';
	else $('loading-layer').style.top = (parseInt(top,10)+(document.body.clientHeight/2)-90)+'px';
	$('loading-layer').style.left = ((document.body.clientWidth/2)-100)+'px';
	$('loading-img').style.display = '';
	$('loading-text').innerHTML = text+', пожалуйста подождите...';
}

function close_message(status, text, focus){
    OK = false;
	$('loading-layer').style.display = 'block';
	$('loading-layer').style.textAlign = 'left';
	if (navigator.appName == 'Opera') {
	$('loading-layer').style.width = '200px';
	$('loading-layer').style.height = '60px';
	}
	else {
	$('loading-layer').style.width = 'auto';
	$('loading-layer').style.height = 'auto';
	}


   	$('loading-actions').style.display = 'none';
   	$('loading-actions-confirm').style.display = 'none';

	if (status==undefined) {
		$('loading-layer').style.display = 'none';
		return false;
		}
	else if (status=='info') {
		$('loading-img').style.display = 'none';
		if (text==undefined) text = 'Информация';
		$('loading-text').innerHTML = '<br /><img class="image" src="/_admincp/_design/img/icons/warning.png" />&nbsp;'+text+'';
	    $('loading-actions').style.display = '';
	} else if (status=='confirm') {
		OK = true;
		$('loading-img').style.display = 'none';
		if (text==undefined) text = 'Информация';
		$('loading-text').innerHTML = '<br /><img class="image" src="/_admincp/_design/img/icons/warning.png" />&nbsp;'+text+'';
	    $('loading-actions').style.display = 'none';
	    $('loading-actions-confirm').style.display = '';
	}
	else if (status=='error') {
		$('loading-img').style.display = 'none';
		if (text==undefined) text = 'Произошла ошибка';
		$('loading-text').innerHTML = '<br /><img class="image" src="/_admincp/_design/img/icons/error.png" />&nbsp;'+text+'';
	    $('loading-actions').style.display = '';
	}

	var new_height = $('loading-layer').offsetHeight;
	var top = (document.body.scrollTop>0) ? document.body.scrollTop : document.documentElement.scrollTop;
	$('loading-layer').style.top = (parseInt(top,10)+(document.body.clientHeight/2)-(new_height/2)-30)+'px';
	var new_width = $('loading-layer').offsetWidth;
   	$('loading-layer').style.left = ((document.body.clientWidth/2)-(new_width/2))+'px';

	if (focus!=undefined && $(focus)!=null) set_focus = $(focus);
	else set_focus = '';
}


function fetch(sel1, sel2, sel3){
  var req = new JsHttpRequest();
	req.open(null, '/js/_ajax/fetch.php', true);

	var select1 = $('brend'); var value1 = (select1.value!=0) ? select1.value : 0;
	var select2 = $('gender'); var value2 = (select2.value!=0) ? select2.value : 0;
	var select3 = $('mech'); var value3 = (select3.value!=0) ? select3.value : 0;

	if (sel1==1 && sel2==0) { value2 = 0; }
	if (sel1==1 && sel2==1) { value3 = 0; }
	if (sel2==0) select2.length = 1;
	if (sel3==0) select3.length = 1;
      	if (sel3==1) document.filter.submit();
//alert(value1+' '+value2+' '+value3);
		if (sel1==1 && sel2==0) var field = 1;
		else field = 2;
//alert(field);
	var data = { 'brend': value1, 'gender': value2, 'mech' : value3, 'field': field};
        req.send(data);

    req.onreadystatechange = function() {
		if (req.readyState == 4) {

  		    var massiv = new Array();
		    var keys = new Array();
  		    massiv = req.responseJS.massiv;
  		    keys = req.responseJS.keys;
//alert(req.responseJS.massiv+'             '+req.responseJS.keys);
		if (sel1==1 && sel2==0) select3.disabled = "disabled";

		if (sel1==1 && sel2==0 && massiv.length>0) { select2.disabled=''; select = select2;}
		if (sel1==1 && sel2==1 && massiv.length>0) { select3.disabled=''; select = select3;}


		if (massiv.length>0) {
			select.length = 1;/// удаляем все элементы кроме первого
			if (sel1==1 && sel2==1 && massiv.length>1) {
			var option = document.createElement('option');
             		 option.value = "1all";
	         	 option.innerHTML = "Все механизмы";
			 select.appendChild(option);
			}
	            for (i = 0; i<massiv.length; i++) {
   		 //    var cnt = (select.getElementsByTagName("option").length)+1;
	 	      var option = document.createElement('option');
	     	 	 option.id = "value_"+i;//value_id;
             		 option.value = keys[i];
	         	 option.innerHTML = massiv[i];
			 select.appendChild(option);
	       		 }
		   }


	}
    }
}

var ie=document.all
var ns6=document.getElementById&&!document.all

function imgFormClick (el,val) {
	if ((ie||ns6) && $(el)) {
	rad_value = $(el).value;

	if (val > 0) new_value = val;
	else if (val == 'x') new_value = rad_value;
	else new_value = rad_value == 1? '2': '1';

	new_text_value = '';

	var path=$(el+'_img').src;
	var regexp =/_.\./g;
	path = path.replace(regexp,'_'+new_value+'.');
	$(el+'_img').src=path;
	$(el+'_img').alt = new_text_value;
	$(el).value = new_value;
	}
}

function add_product(sid, id, price, action) {
  var req = new JsHttpRequest();
	req.open(null, '/js/_ajax/add_to_basket.php', true);
	var data = { 'sid': sid, 'id': id, 'price' : price };
        req.send(data);

	if (action != 'купить') {

		$('winveit').style.display = 'block';
		$('winveit').style.top = (document.documentElement.scrollTop+(document.body.clientHeight/2)-90)+'px';
		$('winveit').style.left = ((document.body.clientWidth/2)-100)+'px';
		$('winveit-img').style.display = '';
		$('winveit-text').innerHTML = 'Добавление товара в корзину, пожалуйста подождите...';
	        $('winveit-actions').style.display = 'none';
		}

//alert(sid+ '' +  id + ' '+ price);
    	req.onreadystatechange = function() {
		if (req.readyState == 4) {
//		alert(req.responseText);

		var quantity = req.responseJS.quantity;
		var total_price = req.responseJS.total_price;
	//	alert('Кол = '+quantity+' сумма = '+total_price);

		var empty_basket = $('empty_shopping_cart');
  		var full_basket = $('shopping_cart');

	if (total_price>0) {
	empty_basket.style.display = 'none';
	full_basket.style.display = '';
	$('quantity').innerHTML = quantity;
	$('total_price').innerHTML = total_price;
	$('ending').innerHTML = req.responseJS.end;
	}

	if (action == 'купить') window.location.href='/shopping_cart/'
	else {
	      $('winveit-text').innerHTML = 'Товар добавлен<br>Приятных, Вам, покупок';
	      $('winveit-img').style.display = 'none';
	      $('winveit-actions').style.display = '';
	     }

		}

   }


}


function removeElement(parent_name,child_name) {
  var d = $(parent_name);
  var olddiv = $(child_name);
  d.removeChild(olddiv);
}


function remove_product(sid, id){
  var req = new JsHttpRequest();
	req.open(null, '/js/_ajax/del_from_basket.php', true);
	var data = { 'sid': sid, 'id': id };
        req.send(data);

//	alert(req.responseText);

    	req.onreadystatechange = function() {
	if (req.readyState == 4) {

	removeElement('whole_basket','div_'+id);
	var names = new Array();



	var empty_basket = $('empty_shopping_cart');
  	var full_basket = $('shopping_cart');


if (req.responseJS.names!=0) {
names = req.responseJS.names;

	var quantity = req.responseJS.quantity;
	var total_price = req.responseJS.total_price;
	if ($('delivery_type')!=null) var delivery = $('delivery_type').value;
	//alert('Кол = '+quantity+' сумма = '+total_price);

	if (total_price>0) {
	$('t_price').innerHTML = total_price+' руб.';
	$('price_delivery').innerHTML = total_price+' руб.';
	empty_basket.style.display = 'none';
	full_basket.style.display = '';
	$('quantity').innerHTML = quantity;
	$('total_price').innerHTML = total_price;
	$('ending').innerHTML = req.responseJS.end;
	if ($('delivery_type')!=null) choose_delivery_type(delivery);
	}


}
else {
$('whole_basket').style.display = 'none';
$('empty_basket_text').innerHTML = '<div class="catalog_single">Ваша корзина пуста</div>';
empty_basket.style.display = '';
full_basket.style.display = 'none';
}


		}

   }
}


function choose_delivery_type(name){

   $('form_st_1.1').style.display = 'none';
   $('form_st_1.2').style.display = 'none';
   $('form_st_2.1').style.display = 'none';
   $('form_st_2.2').style.display = 'none';
   $('form_st_3.1').style.display = 'none';
   $('form_st_3.2').style.display = 'none';

   var total_price = $('total_price').innerHTML;
   total_price = total_price - 0;
   if (name == '2.2') total_price = Math.ceil((total_price + 500)*1.087);
   if (name == '3.1') total_price = total_price + 1500;
   if (name == '3.2') total_price = total_price + 4000;

   $('price_delivery').innerHTML = total_price+' руб.';
   $('help').style.display = 'none';
   $('order_title').style.display = '';
   $('form_st_'+name).style.display = '';
   $('delivery_type').value = name;
   $('price_value_'+name).value = total_price;
}







function recount(sid, products){
  var req = new JsHttpRequest();
  var values = new Array();
  var products_id = new Array();
  var new_prices = new Array();
  var j = 0, k = 0;
  var empty_basket = $('empty_shopping_cart');
  var full_basket = $('shopping_cart');

 //////////////////// пожалуйста подождите, идет перерасчет ////////////////////

if (products.length>0)
for (i = 0; i<products.length; i++) if ($('quantity_'+products[i])!=null) {
	values[j] = $('quantity_'+products[i]).value;
	products_id[j] = products[i];
	j++;
	}

	req.open(null, '/js/_ajax/recount_basket.php', true);
	var data = { 'sid': sid, 'products_id': products_id, 'values': values };
        req.send(data);

	req.onreadystatechange = function() {
		if (req.readyState == 4) {

// alert(req.responseText);

	var quantity = req.responseJS.quantity;
	var total_price = req.responseJS.total_price;
	var new_prices = req.responseJS.new_prices;
	if ($('delivery_type')!=null) var delivery = $('delivery_type').value;
	//alert('Кол = '+quantity+' сумма = '+total_price);

	if (total_price>0) {
	$('t_price').innerHTML = total_price+' руб.';
	$('price_delivery').innerHTML = total_price+' руб.';
	empty_basket.style.display = 'none';
	full_basket.style.display = '';
	$('quantity').innerHTML = quantity;
	$('total_price').innerHTML = total_price;
	$('ending').innerHTML = req.responseJS.end;
	if (delivery>0) choose_delivery_type(delivery);


	if (products.length>0)
		for (i = 0; i<products.length; i++) if ($('price_'+products[i])!=null && new_prices[k]>0) {
		$('price_'+products[i]).innerHTML = new_prices[k];
		k++;
		}

	}

		}
	}

}


function checkFields(name){
var errors = new Array();
var text_er = '';

if ($('fio_'+name)!=null) if ($('fio_'+name).value=='') errors[0] = 'Не введена Ф.И.О.';
if ($('country_'+name)!=null) if ($('country_'+name).value=='') errors[1] = 'Не введена страна';
if ($('city_'+name)!=null) if ($('city_'+name).value=='') errors[2] = 'Не введен город';
if ($('post_code_'+name)!=null) if ($('post_code_'+name).value=='') errors[3] = 'Не введен индекс города';
if ($('address_'+name)!=null) if ($('address_'+name).value=='') errors[4] = 'Не введен адрес';
if ($('phone_'+name)!=null) if ($('phone_'+name).value=='') errors[5] = 'Не введен телефон';
if (name=='2.1' && $('confrim1')!=null && $('confrim2')!=null) if ($('confrim1').checked==false && $('confrim2').checked==false) errors[6] = 'Не указано подтверждение Вашего заказа по телефону';

if (errors.length>0) for (i = 0; i<errors.length; i++) if (errors[i]) text_er += errors[i]+'\n';

if (text_er!=''){
   alert(text_er);
   return 0;
   }
   else return 1;
}


function CheckQuantity(id, value){
   var quantity = $('quantity_'+id);
   if (quantity.value >= 0 && quantity.value!='') {
		return 1;
		quantity.className = 'inp_price';
		} else {
			quantity.value = value;
//			quantity.className = 'inp_text_err';
			quantity.focus();
			alert('Кол-во часов должно быть больше нуля!');
			}
	};




//####################################################
// <<<<<< Работа с формами
//####################################################
var errs = new Array();
function FormCheckInt (el,id,showerr,elfocus,errmsg) {
	if ((ie||ns6) && el && $('f'+id)) {
	value = el.value;
	if (!(/^(\d{1,3})$/.test(value))) {
		el.className = 'inp_text_err';
		errs[id] = 1;
		if (showerr == 1) {
			$('f'+id).innerHTML = errmsg;
		}
		if (elfocus == 1) {
			el.focus();
		}
	}
	else if ((errs[id] == 1 && errmsg.toLowerCase() == $('f'+id).innerHTML.toLowerCase()) || !errs[id]) {

		$('f'+id).innerHTML = '';
		el.className = 'inp_text_hover';
		errs[id] = 0;
		if (elfocus == 1) {
			el.focus();
		}
	}
	}
}

function FormCheckName (el,id,showerr,elfocus,errmsg) {
	if ((ie||ns6) && el && $('f'+id)) {
	value = el.value;
	if (/[\||\'|\<|\>|\"|\!|\$|\@|\&\~\*\+]/.test(value)) {
		el.className = 'inp_text_err';
		errs[id] = 1;
		if (showerr == 1) {
			$('f'+id).innerHTML = errmsg;
		}
		if (elfocus == 1) {
			el.focus();
		}
	}
	else if ((errs[id] == 1 && errmsg.toLowerCase() == $('f'+id).innerHTML.toLowerCase()) || !errs[id]) {

		$('f'+id).innerHTML = '';
		el.className = 'inp_text_hover';
		errs[id] = 0;
		if (elfocus == 1) {
			el.focus();
		}
	}
	}
}

function FormCheckEmpty (el,id,len,showerr,elfocus,errmsg) {
	if ((ie||ns6) && el && $('f'+id)) {
	value = el.value;
	if (el.value.replace(/ /gi,"").length < len) {
		el.className = 'inp_text_err';
		errs[id] = 1;
		if (showerr == 1) {
			$('f'+id).innerHTML = errmsg;
		}
		if (elfocus == 1) {
			el.focus();
		}
	}
	else if ((errs[id] == 1 && errmsg.toLowerCase() == $('f'+id).innerHTML.toLowerCase()) || !errs[id]) {
		$('f'+id).innerHTML = '';
		el.className = 'inp_text_hover';
		errs[id] = 0;
		if (elfocus == 1) {
			el.focus();
		}
	}
	}
}

function FormCheckEmail (el,id,showerr,elfocus,errmsg) {
	if ((ie||ns6) && el && $('f'+id)) {
	value = el.value;
	if (!(/^[a-zA-Z0-9\_\-]{2,32}[\@][a-zA-Z0-9\-]{2,32}[\.][a-zA-Z0-9]{2,4}$/.test(value))) {
		el.className = 'inp_text_err';
		errs[id] = 1;
		if (showerr == 1) {
			$('f'+id).innerHTML = errmsg;
		}
		if (elfocus == 1) {
			el.focus();
		}
	}
	else if ((errs[id] == 1 && errmsg.toLowerCase() == $('f'+id).innerHTML.toLowerCase()) || !errs[id]) {

		$('f'+id).innerHTML = '';
		el.className = 'inp_text_hover';
		errs[id] = 0;
		if (elfocus == 1) {
			el.focus();
		}
	}
	}
}


function CheckAllow (el, name, table, id, errmsg, cid) {
  var req = new JsHttpRequest();
	value = el.value;
  	req.open(null, '/js/_ajax/check_regname.php', true);
	var data = { 'Name': name, 'Value': value, 'Table': table, 'id': cid };
    	req.send(data);

    	req.onreadystatechange = function() {
		if (req.readyState == 4) {

		//$('debug').innerHTML = req.responseText;

		if (req.responseJS.status>0) {
			$('f'+id).innerHTML=errmsg;
			el.className = 'inp_text_err';
			errs[id] = 1;
			el.focus();
		}
		else if ((errs[id] == 1 && errmsg == $('f'+id).innerHTML) || !errs[id]) {

			$('f'+id).innerHTML = '';
			errs[id] = 0;
			el.className = 'inp_text_hover';
		}

	}
    }
}



function CheckForm ( type, el, id, showerr, elfocus, errmsg )
{
	if (type==undefined||type==null) type = 'empty';
    alert(type[0]);
	if ((ie||ns6)&&el)
	{
		var value=el.value.trim();
		var regexp=null;

		switch (type)
		{
			case 'int':
			 regexp = /^(\d{1,3})$/;
			 break;
		}
	}
}




//####################################################
// Работа с формами >>>>>>>
//####################################################






/////////////////////////
///    DINAMIC SITE    //
/////////////////////////


//function $(e){
//  return $(e);
//}
var func_back = new Array();
var func_next = new Array();
var current_page;
var before_id;
var cat_id;


///// <<<<< ИСТРОИЯ ПОСЕЩЕНИЙ
function _back(){

if ($('goback').style.cursor == 'pointer') {
	current_page--;
    var func = func_back[current_page];
    func();
    if (current_page <= 1) {
    	$('goback').src = 'js/images/btn_left_off.png';
    	$('goback').style.cursor = '';
    	}
 }

}

function _next(){
}
///// ИСТРОИЯ ПОСЕЩЕНИЙ >>>>>


// ЗАГРУЗКА НАЧАЛЬНЫХ ПАРАМЕТРОВ
function load_params(id, url){
	cat_id = id;
	func_back[0] = new Function("getData('"+id+"', '"+url+"');");
	current_page = 0;
}



function getData(id, link){
if ($('goback').style.cursor == '') {
    	$('goback').src = 'js/images/btn_left_on.png';
    	$('goback').style.cursor = 'pointer';
	}
	current_page++;
    func_back[current_page] = new Function("load_body('"+id+"', '"+link+"');");

	if (getCookie('ajax') == 'true') { load_body(id, link); return false; }
	else return true;

}

function load_body(id, path){
  	var req = new JsHttpRequest();
  	var div_body = $('main_body');

	show_message('Загрузка данных');

	req.open(null, '/js/_ajax/load_body.php', true);
	var data = { 'id': id, 'path': path };
    req.send(data);

	req.onreadystatechange = function() {
		if (req.readyState == 4) {

		$('debug').innerHTML = req.responseText;

		var html = req.responseJS.html;
		var category = req.responseJS.category;
		var MetaTitle = req.responseJS.MetaTitle;
		var navigationLine = req.responseJS.navigationLine;
		var menu = req.responseJS.menu;
		div_body.innerHTML = (html) ? html : '';
		if (category == 'true') {
		////// ВЫДЕЛЕНИЕ ТЕКУЩЕЙ ДИРЕКТОРИИ
		if ($('cat_'+id) != null) $('cat_'+id).className = 'hov';
		if (!before_id && $('cat_'+cat_id) != null && id!=cat_id) $('cat_'+cat_id).className = '';
		if ($('cat_'+before_id) != null && id!=before_id) $('cat_'+before_id).className = '';
		} else {
			//alert('модули');
		}
		////// ЗАГОЛОВОК СТРАНИЦЫ
		document.title = MetaTitle;
		////// НАВИГАЦИОННАЯ ЛИНИЯ
		if (navigationLine && $('navigation')!=null) $('navigation').innerHTML = navigationLine;
		///// МЕНЮ САЙТА
		if (menu && $('menu')!=null) $('menu').innerHTML = menu;

		before_id = id;
		close_message();
		}


	}


}

function change_value_ajax(){
	 var value = $('ajax_load').checked;
	 var date = new Date();

	 if (value == true) {
	 	close_message('confirm', 'При использовании данной технологии, история посещений будет недоступна,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; т.е. вы не сможете вернуться на страницу назад или вперед!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Применить технологию?');
	 	addCookie("ajax", "true", 14, "/");
    	if ($('nav_span') != null) $('nav_span').style.display = '';
	 	}
	 else {
	 	deleteCookie("ajax", "/");
        if ($('nav_span') != null) $('nav_span').style.display = 'none';
	 	}
}



////////////////////////////
// <<<<< РАБОТА С COOKIE  //
////////////////////////////
function addCookie(szName,szValue,dtDaysExpires,cPath)
{
   var dtExpires = new Date();
   var dtExpiryDate = "";

   dtExpires.setTime(dtExpires.getTime() + dtDaysExpires * 24 * 60 * 60 * 1000);
   dtExpiryDate = dtExpires.toGMTString();
   document.cookie = szName + "=" + szValue + "; path=" +cPath+ "; expires=" + dtExpiryDate;
}

function getCookie(name) {
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1) return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1) cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

function deleteCookie(name, path, domain) {
        if (getCookie(name)) {
                document.cookie = name + "=" +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}
////////////////////////////
// РАБОТА С COOKIE >>>>>> //
////////////////////////////




function changeImg(id) {
	if (!$('i'+id)) return false;

	var temp_src = $('mfoto').src;
	var temp_link = $('mlink').href;
	var temp_title = $('mlink').title;
	var temp_title2 = $('mlink').title2;
	var temp_alt = $('mfoto').title;

	//var new_path = $('i'+id).src.replace("\/thumbs","");
	//var new_path2 = new_path.replace("m_","");

	var new_path = $('i'+id).src;
	if ($('i'+id).src.indexOf('catalog') != -1) new_path2 = new_path.replace("m_","");
		else new_path2 = new_path.substring(0,new_path.lastIndexOf('/')) + '/' + 'm_' + new_path.slice((new_path.lastIndexOf('/')+1), -4) + new_path.slice(-4);

	$('mfoto').src = new_path2;
	$('mfoto').title = $('i'+id).title;
	$('mlink').href = $('l'+id).href;
	$('mlink').title = $('l'+id).title;
	$('mlink').title2 = $('l'+id).title2;

	pref = (temp_src.indexOf('catalog') != -1)? 'm_': '';
	temp_src = temp_src.replace("m_","");
	var new_thumb = temp_src.substring(0,temp_src.lastIndexOf('/')) + '/' + pref + temp_src.slice((temp_src.lastIndexOf('/')+1), -4) + temp_src.slice(-4);
	//alert(new_thumb);
	$('i'+id).src = new_thumb;
	$('i'+id).title = temp_alt;
	if ($('l'+id)) {
		$('l'+id).href = temp_link;
		$('l'+id).title = temp_title;
		$('l'+id).title2 = temp_title2;
	}
	if ($('d'+id)) $('d'+id).innerHTML = $('i'+id).title.replace("Просмотреть ","");
}
////////////////////////////////////
// <<<<<ДИНАМ. ИЗМЕН. СОДЕРЖИМОГО //
////////////////////////////////////

function change_content(id, path, parent_name){
	var content = $(parent_name);

	if (content!=null) {

		show_message('Загрузка данных');

	  	var req = new JsHttpRequest();
		req.open(null, '/js/_ajax/change_content.php', true);
		var data = { 'id': id, 'path': path, 'module': parent_name };
    	req.send(data);

		req.onreadystatechange = function() {
			//content.innerHTML = req.responseText;

			if (req.readyState == 4) {

			//**** СОДЕРЖИМОЕ ****//
			var html = req.responseJS.html;
			content.innerHTML = (html) ? html : '';

			//**** ЗАГОЛОВОК СТРАНИЦЫ ****//
			//document.title = req.responseJS.MetaTitle;

			//**** НАВИГАЦИОННАЯ ЛИНИЯ ****//
			//var navigationLine = req.responseJS.navigationLine;
			//if (navigationLine && $('navigation')!=null) $('navigation').innerHTML = navigationLine;
			//**** МЕНЮ САЙТА ****//
			//var menu = req.responseJS.menu;
			//if (menu && $('menu')!=null) $('menu').innerHTML = menu;
			close_message();
			}


		}
	} else if (path) location.href = ''+path+'';
}
////////////////////////////////////
// ДИНАМ. ИЗМЕН. СОДЕРЖИМОГО>>>>> //
////////////////////////////////////
