function centerWindow(winobj,mypage, myname, w, h, options) {
	var screenWidth = screen.width
	var screenHeight = screen.height
	var topOffset = 0;
	var leftOffset = 0;
	var winl = ((screenWidth - w) / 2) + leftOffset;
	var wint = ((screenHeight - h) / 2) + topOffset;
	var winprops = "height="+h+",width="+w+",top="+wint+",left="+winl;
	if(options != null){
		if(options.length > 0){
			winprops += "," + options;
		}
	}
	if(topOffset > 50){
		topOffset = 0
		leftOffset = 0
	}else{
		topOffset +=10
		leftOffset +=10	
	}
	try{
		var win = winobj.open(mypage, myname, winprops);
		win.focus();
	}catch(e){
	}
	return win;
}

