var win = null;
var page_width = 800;
var page_height = 600;


function OpenWindow_build_settings(w, h) {
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition;
	return settings;
}

function OpenWindow(mypage, w, h) {
	if (win) { win.close();	}
	settings = OpenWindow_build_settings(w, h);
	win = window.open(mypage, 'popup_window', settings)
	win.focus();
}

function OpenWindowFull(mypage) {
	OpenWindow(mypage, screen.width, screen.height)
}
	
if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	page_width = window.innerWidth;
	page_height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	page_width = document.documentElement.clientWidth;
	page_height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	page_width = document.body.clientWidth;
	page_height = document.body.clientHeight;
}