function win_focus () {
	if (typeof(w_name.document)=="object") {
		if (!w_name.closed) {
			w_name.focus(); 
			return false;
		}
	}
}

function win_open (file, name, win_width, win_height, strig_param, win_type, evnt, offsetx, offsety) {
   if (typeof(evnt) == 'object') {
      xx = evnt.screenX - win_width / 2;
      if (typeof(offsetx) == 'number') xx = xx + offsetx;
      yy = evnt.screenY - win_height + 25;
      if (typeof(offsety) == 'number') yy = yy + offsety;
   }
   else {
      xx = (screen.width - win_width -10) / 2;
      yy = (screen.height - win_height - 32) / 2;
   }
   if ( xx+ win_width  > screen.width) xx = screen.width-win_width-10;
   if ( xx < 0 ) xx = 3; 
   if ( yy + win_height +55 > screen.height) yy = screen.height-win_height-55;
   if ( yy < 0 ) yy = 3;     
   w_name =  window.open(file, name, strig_param+',width='+win_width+',height='+win_height+',left='+xx+',top='+yy);
   if (win_type)  window.onfocus=win_focus;
   return w_name;
}

var img='';
var ttl='';
var i=0;

function time_out()
{
  h=img.height;
  w=img.width;
  s=img.src;
  wnn=""+i;
	wnd=window.open("",wnn,"width="+ w+",height="+h+",left=100,top=100,status=0,toolbal=0,menubar=0,location=0,resizable=0,scrollbar=0");
	wnd.document.open();
	wnd.document.write("<html><head><title>"+ttl+"</title></head><body marginheight=0 marginwidth=0 leftmargin=0 topmargin=0><img  src='"+s+"' border=0></body></html>"); 
	wnd.document.close();
  clearTimeout();
}

function open_wnd(href,srcimg)
{	i++;
	img= new Image();
	img.src=srcimg;
	ttl=href; 
	setTimeout("time_out()",100);
}

function win_open2 (file, name, win_width, win_height, strig_param, win_type, evnt, offsetx, offsety) {
   if (typeof(evnt) == 'object') {
      xx = evnt.screenX - win_width / 2;
      if (typeof(offsetx) == 'number') xx = xx + offsetx;
      yy = evnt.screenY - win_height + 25;
      if (typeof(offsety) == 'number') yy = yy + offsety;
   }
   else {
      xx = (screen.width - win_width -10) / 2;
      yy = (screen.height - win_height - 32) / 2;
   }
   if ( xx+ win_width  > screen.width) xx = screen.width-win_width-10;
   if ( xx < 0 ) xx = 3; 
   if ( yy + win_height +55 > screen.height) yy = screen.height-win_height-55;
   if ( yy < 0 ) yy = 3;     
   w_name =  window.open(file, name, strig_param+',width='+win_width+',height='+win_height+',left='+xx+',top='+yy);
   return w_name;
}


