
// Отображение полноразмерного изображения в отдельном окне
function ShowImageWindow(picname, width, height, title)
{
	if(self && self.screen && self.screen.width)
	{
		pos="";
		scrollbars="auto";
		if(width>self.screen.width)
		{
			winwidth=self.screen.width-20;
			pos+=",left=0";
			scrollbars="yes";
		}
		else
		{
			winwidth=width+(height>self.screen.height ? 17 : 0);
			pos+=",left="+((self.screen.width-width+17)/2);
		}
		if(height>self.screen.height)
		{
			winheight=self.screen.height-60;
			pos+=",top=0";
			scrollbars="yes";
		}
		else
		{
			winheight=height+(width>self.screen.width ? 17 : 0);
			pos+=",top="+((self.screen.height-height)/2);
		}
			
	}
	var params='width='+winwidth+',height='+winheight+',menubar=no,status=no,location=no,scrollbars='+scrollbars+',directories=no,resizable=yes,toolbar=no'+pos;
	picwin=window.open("","_blank",params);
	picwin.document.write("<html><title>"+title+"</title>");
	picwin.document.write("<body marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>");
	picwin.document.write("<a href='javascript:void(0);' onclick='window.close();'><img src='"+picname+"' width="+width+" height="+height+" border=0 title='Закрыть окно' alt='Закрыть окно'></a>");
	picwin.document.write("</body></html>");
}

function ShowHTMLWindow(URL, height, width, name)
{
	if(self && self.screen && self.screen.width)
	{
		pos="";
		if(width>self.screen.width)
		{
			winwidth=self.screen.width-20;
			pos+=",left=0";
		}
		else
		{
			winwidth=width+17;
			pos+=",left="+((self.screen.width-width+17)/2);
		}
		if(height>self.screen.height)
		{
			winheight=self.screen.height-60;
			pos+=",top=0";
		}
		else
		{
			winheight=height;
			pos+=",top="+((self.screen.height-height)/2);
		}
			
	}
	var params='width='+winwidth+',height='+winheight+',menubar=no,status=no,location=no,scrollbars=auto,directories=no,resizable=yes,toolbar=no'+pos;
	window.open(URL, name, params);
}

function OpenClose(id)
{
	var img, div;
	img = document.getElementById('img'+id);
	div = document.getElementById('div'+id);
	if(div.style) div = div.style;
	if(img.className=='close')
	{
		img.className='open';
		div.display='block';
	}
	else
	{
		img.className='close';
		div.display='none';
	}
}


