function fixPNG(element)
{
	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent))
	{
		var src;
		
		if (element.tagName=='IMG')
		{
			if (/\.png$/.test(element.src))
			{
				src = element.src;
				element.src = "/bitrix/templates/xteam2/images/spacer.gif";
			}
		}
		else
		{
			src = element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i)
			if (src)
			{
				src = src[1];
				element.runtimeStyle.backgroundImage="none";
			}
		}
		
		if (src) element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
	}

}



var fix_opera = 0;
if($.browser.opera){
	var ver_browser = parseFloat($.browser.version.substring(0,3));
	if(ver_browser<9.6) var fix_opera = 1;
}

function getClientWidth()
{
	if(fix_opera==1)
		return ((document.compatMode=='CSS1Compat' && !window.opera)?document.documentElement.clientWidth:document.body.clientWidth);
	else
		return ((document.compatMode=='CSS1Compat')? document.documentElement.clientWidth : document.body.clientWidth);
}
function getClientHeight()
{
	if(fix_opera==1)
		return ((document.compatMode=='CSS1Compat' && !window.opera)?document.documentElement.clientHeight:document.body.clientHeight);
	else
		return ((document.compatMode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight);
}
function getBodyScrollTop()
{
	return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function getBodyScrollLeft()
{
	return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);
}
function getDocumentHeight()
{
	return ((document.body.scrollHeight > document.body.offsetHeight)?document.body.scrollHeight:document.body.offsetHeight);
}
function getDocumentWidth()
{
	return ((document.body.scrollWidth > document.body.offsetWidth)?document.body.scrollWidth:document.body.offsetWidth);
}
function getClientCenterX()
{
	return parseInt(getClientWidth()/2)+getBodyScrollLeft();
}
function getClientCenterY()
{
	return parseInt(getClientHeight()/2)+getBodyScrollTop();
}




function load_bigimg (file, w, h){
	w++; w--;
	h++; h--;
	dHeight = getDocumentHeight();
	dWidth = getDocumentWidth();
	dX = getClientCenterX() - w/2;
	dY = getClientCenterY() - h/2;
	if (dY<0) dY = 0;
	if (dX<0) dX = 0;
	dX_c = dX + w - 55;
	dY_c = dY + 15;
	document.getElementById("absolute_img_shadow").style.height = dHeight+"px";
	document.getElementById("absolute_img_shadow").style.width = dWidth+"px";
	document.getElementById("absolute_img_inc").style.left = dX+"px";
	document.getElementById("absolute_img_inc").style.top = dY+"px";
	document.getElementById("absolute_img_inc").style.width = w+"px";
	document.getElementById("absolute_img_inc").style.height = h+"px";
	document.getElementById("absolute_img_inc").innerHTML = '<img src="'+file+'" width="'+w+'" height="'+h+'">';
	document.getElementById("absolute_img_close").style.left = dX_c+"px";
	document.getElementById("absolute_img_close").style.top = dY_c+"px";
	
	document.getElementById("absolute_img").style.display = "block";
}

function absolute_img_hide() {
	document.getElementById("absolute_img").style.display = "none";
}
