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 ShowPic(id, width, height)
{ 
var path="/pics/"+id+".jpg";

var oShowImg = window.open("",'ShowImg',"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width="+width+",height="+height+",left=30,top=30");

if (IsIE())
	{
	var oldBody = oShowImg.document.body;
	oldWidth = oldBody.offsetWidth;
	oldHeight = oldBody.offsetHeight;
	}
else
	{
	var oldWindow = oShowImg;
	oldWidth = oldWindow.innerWidth;
	oldHeight = oldWindow.innerHeight;
	}

oShowImg.resizeBy(width - oldWidth, height - oldHeight);

oShowImg.document.open();

oShowImg.document.write("<html style=\"width:"+width+"; height:"+height+"\"><head><title>Image</title></head>");
oShowImg.document.write("<body bgcolor=#FFFFFF bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 marginheight=0 marginwidth=0 style=\"margin:0px; padding:0px;\">");
oShowImg.document.write("<div><a href=\"Javascript:window.close()\"><img src="+path+" border=0 width="+width+" height="+height+"></a></div>");
oShowImg.document.write("</body></html>");

oShowImg.document.close();

oShowImg.focus();
}

// Фото без рамки
function ShowPhoto(path, div, title, index)
{ 
if(! title){title="Image"}

width=screen.availWidth;
height=screen.availHeight;

var image = window.open("/showphoto.html?path="+path+"&div="+div,index,"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width="+width+",height="+height+",left=0,top=0");
image.focus();
}

// Всплывающее окно
function NewWindow(arg, width, height, index)
{ 
var image = window.open("newwindow.html?"+arg,index,"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width="+width+",height="+height+",left=50,top=50");
image.focus();
}

// Панорама
function ShowPanorama(filename)
{ 
var image = window.open("showpanorama.phtml?filename="+filename,'panorama',"toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width="+800+",height="+600+",left=30,top=30");
image.focus();
}
