var screenW = screen.availWidth;
var screenH = screen.availHeight;
// Функция открытия нового окна
function WindowOpen (vUrl, vWidth, vHeight, vScroll, vResize) {
	var left = (screenW - vWidth) / 2;
	var top = (screenH - vHeight) / 2;
	if (!vScroll) vScroll = "no";
	if (!vResize) vResize = "no";
	wId = window.open (vUrl, "NewWin"+GetRand(), "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+vScroll+",resizable="+vResize+",left="+left+",top="+top+",width="+vWidth+",height="+vHeight);
	wId.focus ();
}

// Функция отображения изображения
function WOImage (url, vWidth, vHeight, title) {
	var left = ((screenW/2) - (vWidth/2));
	var top = ((screenH/2) - (vHeight/2));
	var windowmode="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left="+left+",top="+top+",width="+vWidth+",height="+vHeight;
	var winname = "NewWin"+GetRand();
	win = window.open('',winname,windowmode);	
	win.document.writeln('<html>');
	win.document.writeln('<head>');
	win.document.writeln('<title>' + title + '</title>');
	win.document.writeln('<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">');
	win.document.writeln('<A href="javascript:window.close()"><img src='+ url + ' border=0></a>');
	win.document.writeln('</body>');
	win.document.writeln('</html>');
	win.focus(); 
	return false;
}

// Функция случайного числа
function GetRand () {
	result = "";
	result = Math.random()+"1";
	result = result.split(".");
	return result[1];
}
