var win = null;

function popWindow(mypage,myname,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/3 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',menubar=no,resizable=no,toolbar=no,location=no,status=no,titlebar=no'
	win = window.open(mypage,myname,settings)
	if(win.window.focus){win.window.focus();}
}

function popDialog(mypage,w,h,s){
	var tWindowProp="dialogWidth:"+w+"px;dialogHeight:"+h+"px;center=yes;resizable: no; help: no; status: no; scroll: "+s+";"; 
	var printWindow=window.showModalDialog(mypage,"",tWindowProp); 
	var tReturnValue = printWindow; 
}

function popWindowsGetValue (field,mypage,w,h) {
 var r = showModalDialog(mypage, field,'dialogWidth:'+w+'px;dialogHeight:'+h+'px;center=yes;resizable: no; help: no; status: no; scroll: no;'); 
 if (typeof r != "undefined")
   field.value = r;
}