
// Четвертый (необязательный) аргумент может принимать значения
// а) TRUE/FALSE = разрешено изменение размеров
// б) Строка, являющаяся параметрами открываемого окна сиктаксически правильная для функции window.open()
//		без каких либо ограничителей на концах (т.е. без запятых)
//    (!!!) Такие параметры как WIDTH, HEIGHT, SCREENX, SCREENY - указывать нельзя (они создаются функцией
//

function openWindow(href, width, height) {

  if (href == "" || href == null) return;

	if (width == "" || width == null || height == "" || height == null) {
		width = 400;
		height = 400;
	}

  wx = parseInt((screen.width - width) / 2);
  wy = parseInt((screen.height - height) / 2);

	op = "status=0,width="+(width+40)+",height="+(height+40)+",screenX="+wx+",screenY="+wy;

  options = ",status=0,scrollbars=1,toolbar=0,menubar=0";
  if (openWindow.arguments.length == 4)
  {
  	param = openWindow.arguments[3];
    type = typeof(param);
  	switch (type) {
     	case 'boolean': op += ( (param == true) ? ',resizable=1' : ',resizable=0' ) + options; break;
      case 'string':	op += ','+param; break;
      default: op += ',resizable=0'+options; break;
    }
  } else { op += ',resizable=0'+options; }

  wnd = window.open(href, "_blank", op);
}



function image_popup_window(href, width, height)
{
    if(href == "" || href == null) {
		return;
	}

	if (width == "" || width == null || height == "" || height == null) {
		width = 800;
		height = 600;
	}

	wx = (screen.width-width)/2;
    wy = (screen.height-height)/2;

    wx = 0;
    wy = 0;

    wnd=window.open(href, "_blank", "width="+(width+20)+",height="+(height+30)+",status=no,resizable=0,scrollbars=0,toolbar=no,menubar=no, screenX="+wx+",screenY="+wy);
}