/* */
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 MakerLogo(obj, thumb, thumb2, param)
{
	if(param=='over') document.getElementById(obj).src=thumb2;
	if(param=='out') document.getElementById(obj).src=thumb;
}

function HideKVD(u,b)
{
	var uu=document.getElementById('ugol-u');
	var bu=document.getElementById('ugol-b');
	
	if(u!=-70)
	{
		if(u<=-10) u=u-10;
		else u=u-1;

		uu.style.marginLeft=u+"px";
	}

	if(b!=-211)
	{
		if(b<=-11 && b>-111) b=b-10;
		else
		{
			if(b<=-111) b=b-100;
			else b=b-1;
		}
		
		bu.style.marginBottom=b+"px";
	}

	setTimeout('HideKVD('+u+','+b+')',0);
}

function ShowKVD(u,b)
{
	var uu=document.getElementById('ugol-u');
	var bu=document.getElementById('ugol-b');
	
	if(u!=0)
	{
		if(u<-10) u=u+10;
		else u=u+1;

		uu.style.marginLeft=u+"px";
	}

	if(b!=0)
	{
		if(b<-10 && b>-111) b=b+10;
		else
		{
			if(b<-111) b=b+100;
			else b=b+1;
		}
		
		bu.style.marginBottom=b+"px";
	}

	setTimeout('ShowKVD('+u+','+b+')',0);
}

function ActionKVD()
{
	var uu=document.getElementById('ugol-u');
	
	if(uu.style.marginLeft=="" || uu.style.marginLeft=="0px")
	{
		HideKVD(0,0);
	}
	else
	{
		ShowKVD(-70,-211);
	}
}

function Init()
{
	if(window.addEventListener) 
	{
		//window.addEventListener('resize', ReplacePhoto, false);
		window.addEventListener('resize', PositionShadow, false);
	} 
	else if (window.attachEvent) 
	{
		//window.attachEvent('onresize', ReplacePhoto);
		window.attachEvent('onresize', PositionShadow);
	}
}

function FS(frm)
{
	var o=document.getElementById('maker_id');
	
	if(o.options[o.options.selectedIndex].value!='') frm.submit();
	else
	{
		document.getElementById('ppid').value=3;
		frm.submit();
	}
}

function FS2(frm)
{
	//var o=document.getElementById('filter');
	
	//if(o.options[o.options.selectedIndex].value!='') 
	frm.submit();
}

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, 'img'+nn);
}

function CloseBigPhoto(param)
{
	var nn=document.getElementById('current-photo').value;
	
	DisplayPhoto(-1, -0.2, 'img'+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;
}