function GetValue(radioName, inputName, def)
{
	var radios = document.getElementsByName(radioName);
	
	var i = 0;
	var val = "";
	for(i=0; i < radios.length; i++)
	{
		if(radios[i].checked)
		{
			val = radios[i].value;
			break;
		}
	}
	
	if(val == "")
		val = def;
		
	var input = document.getElementById(inputName);	
	if(input)
		input.value = val;
}

function GetPart()
{
	var roomName = document.getElementById("room_name").value;
	if((roomName == "") || (roomName == "名前を入力して下さい"))
	{
		document.getElementById("chat_err").innerHTML = "チャットルーム名は必要です。";
		return 1;
	}
	else if(roomName.length < 3)
	{
		document.getElementById("chat_err").innerHTML = "チャットルーム名を3文字以上で入力して下さい";
		return 1;
	}
	else
	{
		document.getElementById("chat_err").innerHTML = "";
	}
	
	var nameCol = document.getElementById("nameColIn").value;
	if((nameCol == "") | (!nameCol))
	{
		nameCol = "#000000";
		document.getElementById("nameColIn").value = "000000";
	}
	else
	{
		nameCol = "#" + nameCol;
	}

	var textCol = document.getElementById("textColIn").value;
	if((textCol == "") | (!textCol))
	{
		textCol = "#000000";
		document.getElementById("textColIn").value = "000000";
	}
	else
	{
		textCol = "#" + textCol;
	}
	
	var width = document.getElementById("width").value;
	var height = document.getElementById("height").value;
	
	width = Number(width);
	height = Number(height);
	if(width == NaN)
	{
		width = 150;
		document.getElementById("width").value = "150";
	}
	
	if(height == NaN)
	{
		height = 350;
		document.getElementById("height").value = "350";
	}
	
	if(width < 80)
	{
		width = 80;
		document.getElementById("width").value = "80";
	}
	if(height < 150)
	{
		height = 150;
		document.getElementById("width").value = "150";
	}
	
	var tag = '<script type="text/javascript">var _ninChatWidth=' + width + ';\n var _ninChatHeight=' + height + ';\n var _ninChatTextCol="' + textCol + '";\n var _ninChatNameCol ="' + nameCol + '";\n var _ninChatColour="#000000";\n var _ninChatRoomName="' + roomName + '"; </script>';
	tag += '<script type="text/javascript" src="http://chat.bloglue.jp/chat.js" charset="utf-8"></script>';
	tag += noscript;
	
	document.getElementById("outTag").value = tag;
	
	_ninChatWidth = width;
	_ninChatHeight = height;
	_ninChatRoomName = roomName;
	_ninChatTextCol = textCol;
	_ninChatNameCol = nameCol;
	document.getElementById("sample").innerHTML = '<div id="_ninChatView" style="margin: 0px; padding: 0px; width: ' + width + 'px; height: ' + height + 'px;">	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" id="_ninChatMain" align="middle" height="' + height + '" width="' + width + '">	<param name="allowScriptAccess" value="always">	<param name="allowFullScreen" value="false">	<param name="movie" value="http://chat.bloglue.jp/Chat.swf?blah=0.3917992102797835"><param name="quality" value="high"><param name="bgcolor" value="#000000">		<embed src="http://chat.bloglue.jp/Chat.swf?blah=0.055436801533516045" quality="high" bgcolor="#000000" name="_ninChatMain" allowscriptaccess="always" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" align="middle" height="' + height + '" width="' + width + '">	</object></div>';
}
