
/*********************************************************************
	функция первоначальных установок
*********************************************************************/

function init() {

    // установка одинаковой высоты блоков
	l_h = document.getElementById('left').clientHeight;
	c_h = document.getElementById('center').clientHeight;
	r_h = document.getElementById('right').clientHeight;
	cnt_h = document.getElementById('content').clientHeight;
	m_h = Math.max(l_h, c_h);
	m_h = Math.max(m_h, r_h);

	document.getElementById('left').style.height = m_h;
	document.getElementById('center').style.height = m_h;
	document.getElementById('right').style.height = m_h;
	document.getElementById('content').style.height = m_h+50;


}


/*********************************************************************
	функция необходимого субменю - установка через сессию
*********************************************************************/
function submenu(id) {
	
	ajax("http://"+location.host+"/tech/update_db.php?act=setsubmenu&id="+id, null);
}



/*********************************************************************
	функция отображения формы для логина на сайт
*********************************************************************/
function goLogin() {

	document.loginform.reset();

	var fon = document.getElementById('private_fon');
	fon.style.display = "block";
	fon.style.height = document.body.scrollTop + fon.clientHeight;
	document.getElementById('private').style.display = "block";

}


/*********************************************************************
	функция переключения языка
*********************************************************************/
function changeLang(lang) {

	var url = document.location.href.split("/");
	if(url[url.length-2].match("efsp"))  url[url.length] = url[url.length-1];

	url[url.length-2] = lang ;
	url = url.join("/");

	document.location.href = url;
}



/*********************************************************************
	функция AJAX запроса
*********************************************************************/
function ajax(url,post) {

  var request=null;

  // пытаемся создать объект для MSXML 2 и старше
  if(!request) try {
    request=new ActiveXObject('Msxml2.XMLHTTP');
  } catch (e){}

  // не вышло... попробуем для MSXML 1
  if(!request) try {
    request=new ActiveXObject('Microsoft.XMLHTTP');
  } catch (e){}

  // не вышло... попробуем для Mozilla
  if(!request) try {
    request=new XMLHttpRequest();
  } catch (e){}

  if(!request)
    // ничего не получилось...
    return "";

  //определяем метод
  if(post) { method = 'POST'; }
  else { method = 'GET'; }

  // делаем запрос
  request.open(method, url, false);

  if(post) {
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	request.setRequestHeader("Content-length", post.length); 
	request.setRequestHeader("Connection", "close"); 
  }

  request.send(post);

  // возвращаем текст
  return request.responseText;
}