//----------------------------------------
function popupWindow (URL, w, h)
{
	var day = new Date();
	var id = day.getTime();
    
	var str = "page" + id + '=window.open("' + URL + '","' + id + '","' +
	'toolbar=0,scrollbars=auto,location=0,statusbar=0,menubar=0,resizable=0,left=20,top=20,' + 
	'width=' + w + ',' +
	'height=' + h + '");';
	
	eval (str);
}

function resize_window (pic_name, def_w, def_h, add_w, add_h)
{
	el_pic = document.all(pic_name);
	
	if (el_pic)
	{
		w = el_pic.width;
		h = el_pic.height;
		
		scr_h = screen.availHeight;
		scr_w = screen.availWidth;
	
//		alert ("width: " + scr_w + " height: " + scr_h);
//		alert ("width: " + w + " height: " + h);
		
		if (w + add_w > def_w)
			new_w = w + add_w + 0;
		else
			new_w = def_w;
			
		if (h + add_h > def_h)
			new_h = h + add_h + 0;
		else
			new_h = def_h;

		new_h = Math.min(new_h,scr_h);
		new_w = Math.min(new_w,scr_w);

//		alert ("width: " + new_w + " height: " + new_h);

		window.resizeTo (new_w, new_h);
	}
}
