////
function IsIE() {
if (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName.substring(0,9) == 'Microsoft')  return true;
else return false;
}

////
function VN() {
  if ((navigator.appVersion.substring(0,3) >= 3.0 && navigator.appName == 'Netscape') ||      
      (navigator.appVersion.substring(0,3) >= 4.0 && navigator.appName.substring(0,9) == 'Microsoft'))
    return true;
else return false;
}


////
function preloadArray()
{
var l=arguments.length
if (l && document.images)
	{
	var a = new Array()
	for (var i=0; i<l; i++)
		{
		a[i]=new Image()
		a[i].src=arguments[i]
		}
	return a
	}
else return null
}

////
function ShowPhoto(path, width, height)
{ 
var screen_width=screen.availWidth;
var screen_height=screen.availHeight; 
var inner_width=parseInt(width); 
var inner_height=parseInt(height); 
var window_width=inner_width; 
var window_height=inner_height; 
var window_left=10;
var window_top=30; 
var scrollbars=0;

if (height > screen_height) {window_top=0; window_height=screen_height; window_width=parseInt(width)+30; scrollbars=1;}
else if (height > screen_height - window_top) {window_top=0;}


var oShowPhoto = window.open("",'ShowPhoto',"toolbar=0,location=0,directories=0,menuBar=0,scrollbars="+scrollbars+",resizable=0,width="+window_width+",height="+window_height+",left="+window_left+",top="+window_top);

if (IsIE())
	{
	var oldBody = oShowPhoto.document.body;
	oldWidth = oldBody.offsetWidth;
	oldHeight = oldBody.offsetHeight;
	}
else
	{
	var oldWindow = oShowPhoto;
	oldWidth = oldWindow.innerWidth;
	oldHeight = oldWindow.innerHeight;
	}

oShowPhoto.resizeBy(window_width - oldWidth, window_height - oldHeight);


oShowPhoto.document.open();

oShowPhoto.document.write("<html style=\"width:"+inner_width+"; height:"+inner_height+"\"><head><title>Image</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\"></head>");
oShowPhoto.document.write("<body bgcolor=#FFFFFF bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 marginheight=0 marginwidth=0 style=\"margin:0px; padding:0px;\">");
oShowPhoto.document.write("<table style=\"width:"+inner_width+"; height:"+inner_height+"\" border=0 cellpadding=0 cellspacing=0><tr><td align=center valign=middle><a href=\"Javascript:window.close()\" title=\"Закрыть окно\"><img src="+path+" border=0 width="+width+" height="+height+"></a></td></tr></table>");
oShowPhoto.document.write("</body></html>");

oShowPhoto.document.close();

oShowPhoto.focus();
}
