function setOpacity(element, value) {
	element.style.opacity = (value / 100);
	element.style.MozOpacity = (value / 100);
	element.style.KhtmlOpacity = (value / 100);
	element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity='+value+')';
}

function getScrollY() {
	scrollY = 0;    
	if (typeof window.pageYOffset == "number") {
		scrollY = window.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop) {
		scrollY = document.documentElement.scrollTop;
	}  else if (document.body && document.body.scrollTop) {
		scrollY = document.body.scrollTop; 
	} else if (window.scrollY) {
		scrollY = window.scrollY;
	}
	return scrollY;
}

function getWindowHeight() {
	var windowHeight=0;

	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&document.documentElement.clientHeight) {
			windowHeight=document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function max(a,b) {
	if (a>b) return a; else return b;
}

function setHeight() {
	elem = document.getElementById('photoShowId');
	elem2 = document.getElementById('photoShowBlock');

	height = parseInt(elem.scrollHeight)+200;
	height = max(height, parseInt(document.getElementsByTagName('body').item(0).scrollHeight));
	height = max(height, parseInt(getWindowHeight()));
	elem2.style.height = height+'px';
}

function showPhoto(value, value2) {
	elem = document.getElementById('photoShowId');
	elem2 = document.getElementById('photoShowBlock');

	if (elem.style.display=='' || elem.style.display == 'none') {
		elem.style.display = 'block';
		elem2.style.display = 'block';
//		elem2.style.zIndex = 1000;
//		elem.style.zIndex = 1001;
		setHeight();

		scrollY = getScrollY();
		elem.style.top = (scrollY+50)+'px';

		elem.innerHTML = '<div class="item"><div align="right" class="close">Закрыть</div><table align="center"><tr><td ><img src="'+value+'"/></td></tr></table><p>'+value2+'</p></div>';
		value = 75;
		elem2.style.opacity = (value / 100);
		elem2.style.MozOpacity = (value / 100);
		elem2.style.KhtmlOpacity = (value / 100);
		elem2.style.filter = "alpha(opacity=" + value + ")";
	} else {
		elem.style.display = 'none';
		elem2.style.display = 'none';
//		elem2.style.zIndex = 0;
//		elem.style.zIndex = 0;
	}
}
