	function chatRoomOpen(room_id, rom_mode) {
		rom_mode = (rom_mode) ? 1 : 0;
		var option = getOption ();
		var cr = window.open('/chat/' + room_id + '/' + rom_mode + '/' + '?20090917', "chatroom", option);
		cr.focus ();
	}
	
	function tryRoomOpen() {
		var option = getOption ();
		var cr = window.open('/trychat/', "chatroom", option);
		cr.focus ();
	}

	// need size 950 × 700
	function getOption () {
		var needWidth = 1014;
		var needHeight = 613;
		var margin = 200;
		var ua = navigator.userAgent;
		var isOpera = ua.toLowerCase ().indexOf ('opera') != -1;
		var isIE = (document.all && !isOpera);

		var options = {
			toolbar     : 0,
			directories : 0,
			status      : 0,
			menubar     : 0,
			location    : 0,
			resizable		: 1
		};

		if (isIE) {
			if (window.screen.height < needHeight + margin) {
				options.width = needWidth + 17;
				options.scrollbars = 1;
				//options.fullscreen = 1;
			} else {
				options.scrollbars = 0;
				options.width = needWidth;
				options.height = needHeight;
			}
			options.left = 0;
			options.top = 0;
		} else {
			options.width = screen.availWidth > needWidth ? needWidth : screen.availWidth;
			options.height = screen.availHeight > needHeight ? needHeight : screen.availHeight;
			options.left = options.screenX = screen.availLeft;
			options.top = options.screenY = screen.availTop;
		}

		var tmp = [];
		for (var i in options) {
			tmp.push (i + "=" + options[i]);
		}
		option = tmp.join (',');
		return option;
	}
	
	// 親ウインドウをurlへ
	function locationParent (url) {
		var parent = window.opener;
		if(!parent) {
			openParent (url);
		} else if(opener.closed == true) {
			openParent (url);
		} else {
			parent.location.href = url;
			parent.focus ();
		}
	}

	function openParent (url) {
		var parent = window.open (url);
		parent.focus ();
	}

