window.onload = pageLoad;

function pageLoad()
{
	showCounter();
}

function showCounter()
{
	var footerCounter = document.getElementById('footerCounter')
	if(footerCounter) footerCounter.innerHTML = '<a href="http://www.liveinternet.ru/click" '+'target=_blank><img src="http://counter.yadro.ru/hit?t14.1;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 minimizeParagraph(obj_id, obj_link)
{
	if(obj_link.className == 'off')
	{
		obj_link.className = 'on';
		Effect.BlindDown(obj_id, {duration:0.4});
	}
	else
	{
		obj_link.className = 'off';
		Effect.BlindUp(obj_id, {duration:0.4});
	}
}

function previewImage(obj)
{
	obj.className = obj.className == 'previewImageOn' ? 'previewImageOff' : 'previewImageOn';
}

function changeIll(n)
{
	var obj = document.getElementById('homeIll');
	obj.className = n;
}


var ua = navigator.userAgent.toLowerCase();
var if_IE = (ua.indexOf("msie") != -1 && ua.indexOf("opera") == -1);
var keep = false;

	document.onkeydown=function( event ){
		ev = if_IE ? window.event : event;
		if (ev.keyCode == 27)
		{
			closePrice();
		}
	}
	
function openPrice()
{
	var screenFade = document.getElementById('screenFade');
	var priceListBlock = document.getElementById('priceListBlock');
	var closePriceList = document.getElementById('closePriceList');
	var priceListTable = document.getElementById('priceListTable');
	
	if(screenFade.className == 'off')
	{
		screenFade.style.display = 'block';
		priceListBlock.style.display = 'block';
		
		var screenWidth = screenFade.offsetWidth > 1300  ? 1300 : screenFade.offsetWidth;
		priceListBlock.style.left = screenWidth/2 - priceListBlock.offsetWidth/2;
		
		keep = true;
		document.onclick = closePrice;
		screenFade.className == 'on';
		
		if(priceListTable) priceListTable.onclick = Keep
	}
	
	else
	{
		screenFade.style.display = 'none';
		priceListBlock.style.display = 'none';
		screenFade.className == 'off';
	}
	return false;
}

function Keep()
{
	keep = true;
}

function closePrice (event)
{
	if (keep)
	{
		keep = false;
		return;
	}
	
	var screenFade = document.getElementById('screenFade');
	if(screenFade)
	{
		screenFade.style.display = 'none';
		priceListBlock.style.display = 'none';
		screenFade.className == 'off';
	}

	document.onclick = null;
}
