function ShowVideo()
{
	DisplayShadow(1, 0.8, 'shadow');
	document.getElementById("video").innerHTML=document.getElementById("source").innerHTML;
}

function CloseVideo()
{
	DisplayShadow(-1, 0.2, 'shadow');
	document.getElementById("video").innerHTML='';
}

function pngdisplay(image, width, height) 
{
	if(navigator.appName=='Microsoft Internet Explorer') 
	{ 
		document.write('<img src="images/empty.gif" style="width: ' + width + '; height: ' + height + '; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + image + ', sizingMethod=scale)">');
	} 
	else 
	{
		document.write('<img src="' + image + '" style="width: ' + width + '; height: ' + height + ';">');
	}
}

function ShowDiv(obj)
{
	var o=document.getElementById(obj);
	
	if(o.style.display=='none') o.style.display='block';
	else o.style.display='none';
}

function Init()
{
	if(window.addEventListener) 
	{
		window.addEventListener('resize', PositionShadow, false);
	} 
	else if (window.attachEvent) 
	{
		window.attachEvent('onresize', PositionShadow);
	}
}

function setShadowOpacity(param, start, full, obj)
{
	if(param==1)
	{
		if(start <= full)
		{
			setElementOpacity(obj, start);
			start=start+0.2;
			setTimeout('setShadowOpacity(1, '+start+', '+full+', "'+obj+'")', 0.5);
		}
	}
	
	if(param==-1)
	{
		if(start > full)
		{
			setElementOpacity(obj, start);
			start=start-0.2;
			setTimeout('setShadowOpacity(-1, '+start+', '+full+', "'+obj+'")', 0.5);
		}
		else document.getElementById(obj).style.display='none';
	}
}

function DisplayShadow(param, full, obj)
{
	if(param==1)
	{
		PositionShadow();
		document.getElementById(obj).style.display='block';
		setShadowOpacity(1, 0.2, full, obj);
	}
	else
	{
		setShadowOpacity(-1, 0.8, full, obj);
	}
}

function PositionShadow()
{
	if(document.getElementById('shadow'))
	{
		var arrayPageSize=getPageSize();

		document.getElementById('shadow').style.height=arrayPageSize[1];
		document.getElementById('shadow').style.width=arrayPageSize[0];
	}
}

function DisplayPhoto(param, full, obj)
{
	var o=document.getElementById(obj);
	
	if(param==1)
	{
		o.style.display='block';
		setShadowOpacity(1, 0.2, full, obj);
	}
	else
	{
		setShadowOpacity(-1, 0.8, full, obj);
	}
}

function ShowBigPhoto(param, pid)
{
	document.location.href='#top';
	document.getElementById('current-photo').value=pid;
	
	var nn=document.getElementById('current-photo').value;
	
	if(param=='y') DisplayShadow(1, 0.8, 'shadow');
	DisplayPhoto(1, 1.0, nn);
}

function CloseBigPhoto(param)
{
	var nn=document.getElementById('current-photo').value;
	
	DisplayPhoto(-1, -0.2, nn);
	if(param=='y') DisplayShadow(-1, 0.2, 'shadow');
}

function getOpacityProperty()
{
	if(typeof document.body.style.opacity == 'string') return 'opacity';
	else if(typeof document.body.style.MozOpacity == 'string') return 'MozOpacity';
	else if(typeof document.body.style.KhtmlOpacity == 'string') return 'KhtmlOpacity';
	else if(document.body.filters && navigator.appVersion.match(/MSIE ([\d.]+);/)[1]>=5.5) return 'filter';

	return false;
}

function setElementOpacity(sElemId, nOpacity)
{
	var opacityProp=getOpacityProperty();
	var elem=document.getElementById(sElemId);

	if(!elem || !opacityProp) return;
  
	if(opacityProp=="filter")
	{
		nOpacity *= 100;
	
		var oAlpha=elem.filters['DXImageTransform.Microsoft.alpha'] || elem.filters.alpha;
		if(oAlpha) oAlpha.opacity=nOpacity;
		else elem.style.filter += "progid:DXImageTransform.Microsoft.Alpha(opacity="+nOpacity+")";
	}
	else elem.style[opacityProp]=nOpacity;
}

function getPageSize()
{
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) 
	{	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight)
	{ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} 
	else 
	{ 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) 
	{	
		if(document.documentElement.clientWidth)
		{
			windowWidth = document.documentElement.clientWidth; 
		} 
		else 
		{
			windowWidth = self.innerWidth;
		}
		
		windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) 
	{ 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} 
	else if (document.body) 
	{ 
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight)
	{
		pageHeight = windowHeight;
	} 
	else 
	{ 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth)
	{	
		pageWidth = xScroll;		
	} 
	else 
	{
		pageWidth = windowWidth;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 

	return arrayPageSize;
}