

nWin = null;
function OpenWindow(link, w, h){
	if(nWin && !nWin.closed) nWin.close();
	var url = link;

	//--------------
	
 	if (self.screen) { // for NN4 and IE4
		width = screen.width
		height = screen.height
	}else if (self.java){ // for NN3 with enabled Java
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize();
		width = scrsize.width;
		height = scrsize.height;
	}
	//--------------
	
	var top = (height - h) / 2;
	var left = (width - w) / 2;
	
  nWin = window.open(url, "OpenWindow", "width="+ w+", height="+h+", location=no,status=no,resizable=no,toolbar=no,scrollbars=yes,menubar=no,top="+top+",left="+left+"");
  nWin.focus();	
}

pWin = null;
function PrintWindow(link, w, h){
	if(pWin && !pWin.closed) pWin.close();
	var url = link;

	//--------------
	
 	if (self.screen) { // for NN4 and IE4
		width = screen.width
		height = screen.height
	}else if (self.java){ // for NN3 with enabled Java
		var jkit = java.awt.Toolkit.getDefaultToolkit();
		var scrsize = jkit.getScreenSize();
		width = scrsize.width;
		height = scrsize.height;
	}
	//--------------
	
	var top = (height - h) / 2;
	var left = (width - w) / 2;
	
  pWin = window.open(url, "PrintWindow", "width="+ w+", height="+h+", location=no,status=no,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,top="+top+",left="+left+"");
  pWin.focus();	
}

oWin = null;
function open_image(pic, w, h){
  if ((w == '') || (h == "")){
    w = 300; h = 150;
  }
  if (pic == "") pic = "<b>Нет картинки</b>";
  else pic = '<img src="'+path + pic +'" onclick="self.close();" title="close">';
  oWin = window.open("", "PictureWindow", "width=" + w + ",height=" + h + ",resizable=no,status=no,toolbar=no,menubar=no");
  with(oWin.document){
    open();// Для порядку - сначала откроем документ на запись
    write('<html><body style="margin:0px;padding:0px">');
    write(pic + '</body></html>');
    close(); // Вы не закрываете документ -- поэтому в следующий раз
             // новое содержимое дописывается в конец
  }
  oWin.focus();
}

function loadHTML(sURL){
  var request=null;
  if(!request)try{
    request=new ActiveXObject('Msxml2.XMLHTTP');
  }catch (e){}
  
  if(!request) try {
    request=new ActiveXObject('Microsoft.XMLHTTP');
  } catch (e){}
  
  if(!request) try {
    request=new XMLHttpRequest();
  } catch (e){}

  if(!request) return ""; 

  request.open('GET', sURL, false);
  request.send(null);
  return request.responseText;
}
