function popupWindow(url, width, height) {

    if(url == '' || url == null) {
		return;
	}

	if (width == '' || width == null || height == '' || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width / 2) - (width / 2);
    wy = (screen.height / 2) - (height / 2);

    wnd=window.open(url, "_blank", "width="+(width+20)+",height="+(height+30)+",resizable=1,scrollbars=1,toolbar=no,menubar=no,screenX="+wx+",screenY="+wy);
	wnd.document.close();
	wnd.focus();

}



function popup_image(url, w, h) {

	wWidth = w + 50;
	wHeight = h + 100;
	if (wWidth > screen.width) wWidth = screen.width - 100;
	if (wHeight > screen.height) wHeight = screen.height - 200;

	wnd=window.open("", "imgWin", 'width=' + wWidth + ',height=' + wHeight + ',resizable=1,scrollbars=1,toolbar=no,menubar=no');
	wnd.document.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /><title>Просмотр оригинального изображения</title><link rel="stylesheet" type="text/css" href="/style.css" /></head><body>');
	wnd.document.write('<div align="center"><br /><a href="javascript:window.close();">');
	wnd.document.write('<img id="orImage" src="' + url + '" width="' + w + '" height="' + h + '" border="0" alt="" />');
	wnd.document.write('<br /><br />Закрыть окно</a>');
	wnd.document.write('</div>');
	wnd.document.write('</body></html>');
	wnd.document.close();
	wnd.focus();

}



/****************************************************************************
 *                         Для "мигающего" меню
 */
var pics = new Array();
var objCount = 0;

function preload(name, first, second, third, fourth, flag) {

  // предварительна\я загрузка изображений и размещение их в массиве

    pics[objCount] = new Array(5);
    pics[objCount][0] = new Image();
    pics[objCount][0].src = first;
    pics[objCount][1] = new Image();
    pics[objCount][1].src = second;
    pics[objCount][2] = name;
    pics[objCount][3] = new Image();
    pics[objCount][3].src = third;
    pics[objCount][4] = new Image();
    pics[objCount][4].src = fourth;
    pics[objCount][5] = flag;
    objCount++;
}

function On(name){
     for (i = 0; i < objCount; i++) {
      if (document.images[pics[i][2]] != null)
        if (name != pics[i][2]) {
			// вернуть в исходное систо\яние все другие изображени\я
			if (pics[i][5]) document.images[pics[i][2]].src = pics[i][3].src;
			else document.images[pics[i][2]].src = pics[i][0].src;
        }
		else {
			// показывать вторую картинку, поскольку курсор пересекает данное изображение
			if (pics[i][5]) document.images[pics[i][2]].src = pics[i][4].src;
			else document.images[pics[i][2]].src = pics[i][1].src;
        }
    }
}

function Off(){
	for (i = 0; i < objCount; i++) {
		// вернуть в исходное систо\яние все изображени\я
		if (document.images[pics[i][2]] != null) {
			if (pics[i][5]) document.images[pics[i][2]].src = pics[i][3].src;
			else document.images[pics[i][2]].src = pics[i][0].src;
		}
	}
}

function Selected(name){
	for (i = 0; i < objCount; i++) {
		// включить флаг использования кнопки
		if (document.images[pics[i][2]] != null)
			if (name == pics[i][2]) {
				pics[i][5] = true;
				document.images[pics[i][2]].src = pics[i][4].src;
			}
			else {
				pics[i][5] = false;
				document.images[pics[i][2]].src = pics[i][0].src;
			}
	}
}

/*
 *                         Для "мигающего" меню
 ****************************************************************************/



