var UA_IE4 = 0;		/* IE 4 以上 */
var UA_IE5 = 0;		/* IE 5 以上 */
var UA_NS4 = 0;		/* Netscape 4 */
var UA_NS6 = 0;		/* Netscape 6 以上 (含む Mozilla) */
var UA_OP6 = 0;		/* Opera 6 以上 */

function getUserAgent () {
	var ua = navigator.userAgent;
	while ( 1 ) {
		if ( window.opera ){
			if ( document.getElementById ) {
				UA_OP6 = 1;
				break;
			}
		}
		else if ( document.all ) {
			UA_IE4 = 1;
			break;
		}
		else if ( navigator.appName=="Netscape" && navigator.appVersion.indexOf("4.") == 0 ) {
			UA_NS4 = 1;
			break;
		}
		else if ( document.addEventListener ) {
			UA_NS6 = 1;
			break;
		}
	}
	UA_IE5 = (UA_IE4 && document.getElementById);
}

function openWindow ( url ) {
	getUserAgent();
	objWin = window.open( url, 'userWindow', 'width=740,height=550,toolbar=no,menubar=no,location=no,status=yes,scrollbars=yes' );
	var sScript = "try { objWin.focus(); } catch( e ){ 0 }";
	if( UA_IE5 || UA_NS6 || UA_OP6 ) {
		eval( sScript );
	}
}
function closeWindow () {
	getUserAgent();
	var sScript = "try { window.opener.focus(); } catch( e ){ 0 }";
	if( UA_IE5 || UA_NS6 || UA_OP6 ) {
		eval( sScript );
	}
	window.blur();
	window.close();
}
function closeAndReloadWindow () {
	getUserAgent();
	var sScript = "try { window.opener.location.reload( true );window.opener.focus(); } catch( e ){ 0 }";
	if( UA_IE5 || UA_NS6 || UA_OP6 ) {
		eval( sScript );
	}

	window.blur();
	window.close();
}

