////
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 ElementById(name) {
if (document.getElementById) return document.getElementById(name); // IE7 + Firefox
else return document.all[name]; // для IE4-IE6
}


////
function CreateBookmarkLink(url, title) {

if (!url) url = location.href;
if (!title) title = document.title;

if (window.sidebar && window.sidebar.addPanel) //Gecko
	{
	window.sidebar.addPanel (title, url, "");
	}
else 
	{
	var ua=navigator.userAgent.toLowerCase();
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';
	
	if (lang == 'ru') // глоб. переменная
		alert("Для того, чтобы добавить эту страницу в ваши закладки,\nиспользуйте " + buttonStr + "+D");
	else 
		alert("To add this webpage to your bookmarks\nuse " + buttonStr + "+D");
	}

return true;
}

////
function make_homepage(title) {

if (! window.sidebar) return false; // If it is not Netscape 6

if (lang == 'ru') // глоб. переменная
	alert("Для того, чтобы сделать эту страницу сайта стартовой страницей вашего браузера,\nперетащите эту ссылку (\"" + title + "\") на кнопку \"Домашняя страница\" (\"Домик\")\nна панели инструментов");
else 
	alert("Drag this link (\"" + title + "\")\nonto your Home button\nto make this your Home Page");

return true;
}

////
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; \"></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=\"Close window\"><img src="+path+" border=0 width="+width+" height="+height+"></a></td></tr></table>");
oShowPhoto.document.write("</body></html>");

oShowPhoto.document.close();

oShowPhoto.focus();
}

