$(document).observe('dom:loaded', function() {$$('a.showImage').each(function(el) { new FancyZoom(el); });  }); //fancyZoom подключаем
  
  
window.onload = pageLoad;


function pageLoad(){
	showCounter();
	//middlePartColumnsIdenticalHeight();
}


function showCounter(){
	document.getElementById('footerCounter').innerHTML = '<a href="http://www.liveinternet.ru/click" '+
	'target=_blank><img src="http://counter.yadro.ru/hit?t18.2;r'+
	escape(document.referrer)+((typeof(screen)=='undefined')?'':
	';s'+screen.width+'*'+screen.height+'*'+(screen.colorDepth?
	screen.colorDepth:screen.pixelDepth))+';'+Math.random()+
	'" alt="liveinternet.ru: iieacaii ?enei oeoia ca 24 ?ana, iinaoeoaeae ca 24 ?ana e ca naaiai\y" '+
	'border=0 width=88 height=31></a>';
}


//растягивает по высоте левую колонку в средней части страницы, если она меньше правой
function middlePartColumnsIdenticalHeight(){
	var leftColInnerBlock = document.getElementById("leftColInnerBlId");
	var leftColHeight = document.getElementById("middlePartLeftCol").offsetHeight;  
	var rightColHeight = document.getElementById("middlePartRightCol").offsetHeight;
	if (leftColHeight < rightColHeight){ leftColInnerBlock.style.height = rightColHeight-80 + "px";	}
}


function yellBlockItemHighlightOn(currentItem){
	//определяем - это шестой ие браузер (или древнее) или нормальный
	function detectIE6(){
		var browser = navigator.appName;
		if (browser == "Microsoft Internet Explorer"){
			var b_version = navigator.appVersion;
			var re = /\MSIE\s+(\d\.\d\b)/;
			var res = b_version.match(re);
			
			if (res[1] <= 6){
				return true;
			}
		}
		return false;
	}
	  
	//не для ие6
	if(!(detectIE6())){
		var curLi = currentItem.parentNode.parentNode.parentNode;
		var cornArr = currentItem.parentNode.parentNode.childNodes;
		
		curLi.style.backgroundColor = 'black';
		for (var i = 0; i < cornArr.length; i++){
			cornArr[i].style.display = 'block';
		}
	}
}


function yellBlockItemHighlightOff(currentItem){
	var curLi = currentItem.parentNode.parentNode.parentNode;
	var cornArr = currentItem.parentNode.parentNode.childNodes;
	
	curLi.style.backgroundColor = '';
	
	for (var i = 0; i < cornArr.length; i++){
		if (cornArr[i].className != 'innerBlock')
			cornArr[i].style.display = 'none';
	}
}


var keep = false;
function ToggleLoginPanel()
{
	var LoginPanel = document.getElementById ('LoginPanel');
	if (LoginPanel)
	{
		var display = LoginPanel.style.display;
		if (display == 'none' || !display)
		{
			LoginPanel.style.display = 'block';
			var LoginInput = document.getElementById ('Username');
			if (LoginInput) LoginInput.focus();
			
			keep = true;
			document.onclick = CloseLoginPanel;
			document.onkeydown = EscapeLoginPanel;
	
			var UsernameField = document.getElementById ('Username');
			var PasswordField = document.getElementById ('Password');
			var SessionSubmit = document.getElementById ('SessionSubmit');
			if (UsernameField) UsernameField.onclick = Keep;
			if (PasswordField) PasswordField.onclick = Keep;
			if (SessionSubmit) SessionSubmit.onclick = Keep;
		}
		else
		{
			LoginPanel.style.display = 'none';
		}
		return false;
	}
	else return true;	
}

function Keep(){
	keep = true;
}

function CloseLoginPanel (event){
	if (keep)
	{
		keep = false;
		return;
	}
	var LoginPanel = document.getElementById ('LoginPanel');
	if (!LoginPanel) return;
	LoginPanel.style.display = 'none';

	document.onclick = null;
	document.onkeydown = null;
}

function EscapeLoginPanel (event){
	if (window.event) event = window.event;
	var code = event.keyCode ? event.keyCode : event.which ? event.which : null;
	if (code == 27)
	{
		var LoginPanel = document.getElementById ('LoginPanel');
		if (!LoginPanel) return;
		LoginPanel.style.display = 'none';

		document.onclick = null;
		document.onkeydown = null;
	}
}




nn4 = (document.layers) ? true : false;

ie4 = (document.all) ? true : false;

dom = (document.createTextNode)? true : false;


function popupWindow(fileUrl, winW, winH, winN, scrollB) {


	var winWidth = (winW)? winW : 740;
	
	var winHeight = (winH)? winH : 520;

	var winName = (winN)? winN : 'popupWin';
	
	winWidth = parseInt(winWidth) + 18;
	winHeight = parseInt(winHeight) + 27;
		
	var scrollBars = (scrollB)? scrollB : 'auto';

	if (nn4 || ie4 || dom) {

		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes'; }

		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes'; }

		posX = Math.round((screen.width - winWidth) / 2);

		posY = Math.round((screen.height - winHeight) / 2);

		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;

	} else {

		posCode = "";

	}
	
	var popupWin = window.open("/"+fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);

	if (popupWin) popupWin.focus();

}


	function line_highlight(obj, on, off){
		if(obj.tagName == 'TD')
			var h_obj = obj.parentNode;
		else
			var h_obj = obj;
		if(!on)
			on = 'highlight';
		h_obj.className = h_obj.className == on ? off : on;
	}
	
	
	/*function viewParagraph(ptable, link){
		var obj = document.getElementById(ptable);
		obj.className = obj.className == 'pNone' ? 'pVisible' : 'pNone';
		link.className = link.className == 'cur' ? '' : 'cur';

	}*/

/*minimized paragraphs*/	
function toggleParagraph(obj_id){
	var header = document.getElementById('h'+obj_id);
	var content = document.getElementById('p'+obj_id);
	
	
	if(header.className == 'minH'){
		Effect.BlindDown('p'+obj_id, { duration: 0.3 });
		header.className = 'minHCur';
		content.className = 'paragraph minHCur';
	}
	else{
		Effect.BlindUp('p'+obj_id, { duration: 0.3 });
		header.className = 'minH';
		content.className = 'paragraph minH';
	}
}


function closeParagraph(obj_id){
	Effect.BlindUp('p'+obj_id, { duration: 0.3 });
}
/*end*/



function viewOffice(obj_id){
	var divArray = document.getElementById('officeInfo').getElementsByTagName( 'div' );
	for( var i = 0 ; divArray.length > i; i++ ){
		if(divArray[i].id.search('office') >= 0){
			divArray[i].className = 'none';
		}
	}
	document.getElementById('office' + obj_id).className = 'visible';
	
	var liArray = document.getElementById('officeNameList').getElementsByTagName( 'li' );
	for( var i = 0 ; liArray.length > i; i++ ){
		if(liArray[i].id.search('officelink') >= 0){
			liArray[i].className = '';
		}
	}
	document.getElementById('officelink' + obj_id).className = 'cur';
	
	var pointArray = document.getElementById('map').getElementsByTagName( 'div' );
	for( var i = 0 ; pointArray.length > i; i++ ){
		if(pointArray[i].id.search('officepoint') >= 0){
			pointArray[i].className = 'office';
		}
	}
	document.getElementById('officepoint' + obj_id).className = 'officeCur';
}

function ViewCity(city){
	if(document.getElementById('officeNameList') && city){
		var liArray = document.getElementById('officeNameList').getElementsByTagName( 'li' );
		for(var i = 0; i < liArray.length; i++){
	
			if(liArray[i].getAttribute('name') == city)
				var IdObj = liArray[i].getAttribute('value');
		}
	
		document.getElementById('office' + IdObj).className = 'visible';
		document.getElementById('officelink' + IdObj).className = 'cur';
		document.getElementById('officepoint' + IdObj).className = 'officeCur';
	}

}

function highlightPoint(obj_id){
	var link = document.getElementById('officelink' + obj_id);
	var point = document.getElementById('officepoint' + obj_id);
	
	if(link.className != 'cur'){
		link.className = link.className == '' ? 'over' : '';
	}
	
	if(point.className != 'officeCur'){
		point.className = point.className == 'office' ? 'officeOver' : 'office';
	}
}