
function NewWindow(mypage,myname,w,h){
	
	var win = null;
	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=no,resizable=yes'
	win = window.open(mypage,myname,settings)
	win.focus();
	
}

function NewWindowII(mypage,myname,w,h){
	
	var win = null;
	
	
	// Assign default if arguments not passed in
	myname = typeof(myname) != 'undefined' ? myname : "someName";
	w = typeof(w) != 'undefined' ? w : 650;
	h = typeof(h) != 'undefined' ? h : 650;
	
	
	// Match file suffixes: _500390pm.html, _375570pmz.html, _650425pmzi.html, etc.
	regex = new RegExp("_([0-9]{3})([0-9]{3})([a-zA-Z]{3,4})\.([a-zA-Z]{3,4})");
	
	// Create array from backrefs (e.g. "_500425pmz.html", "500", "425", "pmz", "html")
	fileSuffix = regex.exec(mypage);
	
	// Set width, height from backrefs.  Defaults determined above: w, h
	x = fileSuffix ? (fileSuffix[1]) : w;
	y = fileSuffix ? (fileSuffix[2]) : h;
	
	LeftPosition = screen.width ? (screen.width-w)/2 : 0;
	TopPosition = screen.height ? (screen.height-h)/3 : 0;
	
	settings = 'height='+y+',width='+x+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes';
	myname = x.toString() + y.toString();
	
	// ======== test==========================================================
	alert("\n\n mypage: "+mypage+"\n\n regex: "+regex+"\n\n fileSuffix (null if not matched): "+fileSuffix+"\n\n x: "+x+"\n\n y: "+y+"\n\n TopPosition: "+TopPosition+"\n\n LeftPosition: "+LeftPosition+"\n\n settings: "+settings+"\n\n myname: "+myname);
	// ======== end - test====================================================
	
	win = window.open(mypage,myname,settings)
	win.focus();
	
}

function NewWindowIII(mypage,myname,w,h){
	
	var win = null;
	LeftPosition = 0;
	TopPosition = 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,resizable=yes'
	win = window.open(mypage,myname,settings)
	win.focus();
	
}
