$(document).observe('dom:loaded', function() {
    $$('a.showImage').each(function(el) { new FancyZoom(el); });
  });

window.onload = pageLoad;
 	
function pageLoad()
{
	showCounter();
}

function showCounter()
{
	document.getElementById('footerCounter').innerHTML = '<a href="http://www.liveinternet.ru/click" '+'target=_blank><img src="http://counter.yadro.ru/hit?t18.6;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 viewParagraph(ptable, link){
		var obj = document.getElementById(ptable);
		obj.className = obj.className == 'none' ? 'visible' : 'none';
		link.className = link.className == 'cur' ? '' : 'cur';
	}
	
	function closePreview(){
		preview_bg.className = 'none';
	}
	
	function openPreview(img, w, h){
		preview_bg.className = 'visible';
		preview_bg.style.height = document.getElementById('siteBlock').offsetHeight;
		image_preview.src = img;
		image_preview.width = w;
		image_preview.height = h;
		
		preview_block.style.left = (document.body.offsetWidth/2) - (preview_block.offsetWidth/2);
		toppos =  (document.body.offsetHeight/2) + document.body.scrollTop - (preview_block.offsetHeight/2);
		
		if(toppos < 0)
			preview_block.style.top = 0;
		else
			preview_block.style.top = toppos;
		document.onkeydown = escapePreview;
	}
	
	function fixPng(){
		if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent) && navigator.userAgent.search("Opera") < 0){
			preview_bg.id = 'imagePreviewBgFix';
			preview_bg = document.getElementById('imagePreviewBgFix');
		}
	}
	
	function escapePreview (event)
		{
			if (window.event) event = window.event;
			var code = event.keyCode ? event.keyCode : event.which ? event.which : null;
			if (code == 27)
			{
				preview_bg.className = 'none';
		
				document.onclick = null;
				document.onkeydown = null;
			}
		}
		
function minResIdent(){
	var bodyWidth = GetWindowSize();
	Event.observe(document.onresize ? document : window, "resize", function(){
		bodyWidth = GetWindowSize();
		bodyClassMaker(bodyWidth);
	}); 
	bodyClassMaker(bodyWidth);
}

//определяет ширину body
GetWindowSize = function(w) {
	w = w ? w : window;
	var width = w.document.body.clientWidth;
	return width;
}



//выставляет класс body
function bodyClassMaker(bodyWidth){
	var minWidth = 990;
	var maxWidth = 1300;
	
	//мин положение
	if(bodyWidth <= minWidth){
		document.getElementsByTagName('body')[0].id = 'min';
	}
	//макс положение
	else if(bodyWidth >= maxWidth){
		document.getElementsByTagName('body')[0].id = 'max';
	}
	//среднее положение
	else{
		document.getElementsByTagName('body')[0].id = '';
	}
}





