var wysiwyg_inside = 'http://' + window.location.hostname + '/inside.html';

function wysiwyg_init(Mode)
	{
	var area = document.getElementsByTagName('textarea');

	var elements = new Array();
	for(x=0, y=0; x<area.length; x++)
		{
		if(area[x].className == 'wysiwyg')
			{
			make_wysiwyg(area[x],Mode);
			}
		}
	}

function parseAttributes(attribute_string)
	{
	var attributeName = "";
	var attributeValue = "";
	var withInName;
	var withInValue;
	var attributes = new Array();
	var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');

	if(attribute_string == null || attribute_string.length < 2)
		{
		return null;
		}
	withInName = withInValue = false;

	for(var i=0; i<attribute_string.length; i++)
		{
		var chr = attribute_string.charAt(i);
		if((chr == '"' || chr == "'") && !withInValue)
			{
			withInValue = true;
			}
		else if((chr == '"' || chr == "'") && withInValue)
			{
			withInValue = false;
			var pos = attributeName.lastIndexOf(' ');
			if(pos != -1)
				{
				attributeName = attributeName.substring(pos+1);
				}
			attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
			attributeName = "";
			attributeValue = "";
			}
		else if(!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
			{
			withInName = true;
			}
		if(chr == '=' && withInName)
			{
			withInName = false;
			}
		if(withInName)
			{
			attributeName += chr;
			}
		if(withInValue)
			{
			attributeValue += chr;
			}
		}
	return attributes;
	}

function relace_flash(Text)
	{
	var startPos = 0;
	var embedList = new Array();

	Text = Text.replace(new RegExp('<[ ]*embed','gi'),'<embed');
	Text = Text.replace(new RegExp('<[ ]*/embed[ ]*>','gi'),'</embed>');
	Text = Text.replace(new RegExp('<[ ]*object','gi'),'<object');
	Text = Text.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');

	while((startPos = Text.indexOf('<embed', startPos+1)) != -1)
		{
		var endPos = Text.indexOf('>', startPos);
		var attribs = parseAttributes(Text.substring(startPos + 6, endPos));
		embedList[embedList.length] = attribs;
		}

	var index = 0;
	while ((startPos = Text.indexOf('<object', startPos)) != -1)
		{
		if(index >= embedList.length)
			{
			break;
			}
		var attribs = embedList[index];
		endPos = Text.indexOf('</object>', startPos);
		endPos += 9;
		var TextAfter = Text.substring(endPos);
		Text = Text.substring(0, startPos);
		Text += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
		Text += ' src="' + host + '/datas/images/spacer.gif" title="' + attribs["src"] + '"';
		Text += ' alt="' + attribs["src"] + '" class="wysiwyg-flash">' + Text.substring(endPos);
		Text += TextAfter;
		index++;

		startPos++;
		}

	var index = 0;
	while((startPos = Text.indexOf('<embed', startPos)) != -1)
		{
		if(index >= embedList.length)
			{
			break;
			}
		var attribs = embedList[index];
		endPos = Text.indexOf('>', startPos);
		endPos += 9;
		var TextAfter = Text.substring(endPos);
		Text = Text.substring(0, startPos);
		Text += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
		Text += ' src="' + host + '/datas/images/spacer.gif" title="' + attribs["src"] + '"';
		Text += ' alt="' + attribs["src"] + '" class="wysiwyg-flash">' + Text.substring(endPos);
		Text += TextAfter;
		index++;

		startPos++;
		}
	return Text;
	}

function put_flash_back(Text)
	{
	var startPos = -1;

	while((startPos = Text.indexOf('<img', startPos+1)) != -1)
		{
		var endPos = Text.indexOf('>', startPos);
		var attribs = parseAttributes(Text.substring(startPos + 4, endPos));

		if(attribs['class'] != "wysiwyg-flash")
			{
			continue;
			}
		else
			{
			endPos += 2;
			var embedHTML = '';

			embedHTML += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
			embedHTML += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
			embedHTML += ' width="' + attribs["width"] + '" height="' + attribs["height"] + '">';
			embedHTML += '<param name="movie" value="' + attribs["title"] + '">';
			embedHTML += '<param name="quality" value="high">';
			embedHTML += '<param name="wmode" value="transparent">';
			embedHTML += '<embed src="' + attribs["title"] + '" wmode="transparent" quality="high" type="application/x-shockwave-flash" width="' + attribs["width"] + '" height="' + attribs["height"] + '"></embed></object>';
			chunkBefore = Text.substring(0, startPos);
			chunkAfter = Text.substring(endPos);
			Text = chunkBefore + embedHTML + chunkAfter;
			}
		}
	return Text;
	}

function make_wysiwyg(Item,Mode)
	{
	var Content = Item.value;
	if(Mode == "Two")
		{
		Content = Content.replace(/\n/gi, '<br>');
		}
	Content = relace_flash(Content);

	Item.parentNode.innerHTML = '\r\
			<div>\r\
				<textarea style="display: none;" id="message" name=\"message\" class="wysiwyg">' + Content + '</textarea>\r\
				<div class="wysiwyg-menu"><table cellspacing="0" cellpadding="0"><tr>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'bold\', \'\')"><img src="' + host + '/datas/wysiwyg/bold.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'italic\', \'\')"><img src="' + host + '/datas/wysiwyg/italic.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'underline\', \'\')"><img src="' + host + '/datas/wysiwyg/underline.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'strikethrough\', \'\')"><img src="' + host + '/datas/wysiwyg/strikethrough.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'justifyleft\', \'\')"><img src="' + host + '/datas/wysiwyg/justifyleft.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'justifycenter\', \'\')"><img src="' + host + '/datas/wysiwyg/justifycenter.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'justifyright\', \'\')"><img src="' + host + '/datas/wysiwyg/justifyright.gif"></td><td>&nbsp;</td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'insertorderedlist\', \'\')"><img src="' + host + '/datas/wysiwyg/numlist.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'insertunorderedlist\', \'\')"><img src="' + host + '/datas/wysiwyg/bullist.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'indent\', \'\')"><img src="' + host + '/datas/wysiwyg/indent.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'outdent\', \'\')"><img src="' + host + '/datas/wysiwyg/outdent.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_size()"><img src="' + host + '/datas/wysiwyg/size.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_forecolor()"><img src="' + host + '/datas/wysiwyg/forecolor.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_hilitecolor()"><img src="' + host + '/datas/wysiwyg/hilitecolor.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'createlink\', \'\')"><img src="' + host + '/datas/wysiwyg/link.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'insertimage\', \'\')"><img src="' + host + '/datas/wysiwyg/image.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_video()"><img src="' + host + '/datas/wysiwyg/video.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_icon()"><img src="' + host + '/datas/wysiwyg/smile.gif"></td>\r\
<td onmouseout="up(this)" onmouseover="hover(this)" onmousedown="down(this)" onmouseup="up(this)" onclick="wysiwyg_set(\'removeformat\', \'\')"><img src="' + host + '/datas/wysiwyg/removeformat.gif"></td><td>&nbsp;&nbsp;&nbsp;&nbsp;</td>\r\
<td class="change_view" onmouseover="over_view(this)" onmouseout="out_view(this)" onclick="plain_text()"><nobr>&laquo;&nbsp;&nbsp;Plain text</nobr></td>\r\
</tr></table>\r\
				</div><div id="size" style="display: none;">\r\
<p onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'fontsize\', \'1\')"><font size="1">Small</font></p>\r\
<p onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'fontsize\', \'2\')"><font size="2">Normal</font></p>\r\
<p onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'fontsize\', \'4\')"><font size="4">Large</font></p>\r\
<p onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'fontsize\', \'6\')"><font size="6">Huge</font></p>\r\
</div><div id="forecolor" style="display: none;"><table cellspacing="0" cellpadding="0"><tr><td bgcolor="#ffffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffffff\')">&nbsp;</td><td bgcolor="#cccccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cccccc\')">&nbsp;</td><td bgcolor="#c0c0c0" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#c0c0c0\')">&nbsp;</td><td bgcolor="#999999" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#999999\')">&nbsp;</td><td bgcolor="#666666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#666666\')">&nbsp;</td><td bgcolor="#333333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#333333\')">&nbsp;</td><td bgcolor="#000000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#000000\')">&nbsp;</td></tr><tr><td bgcolor="#ffcccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffcccc\')">&nbsp;</td><td bgcolor="#ff6666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff6666\')">&nbsp;</td><td bgcolor="#ff0000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff0000\')">&nbsp;</td><td bgcolor="#cc0000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cc0000\')">&nbsp;</td><td bgcolor="#990000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#990000\')">&nbsp;</td><td bgcolor="#660000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#660000\')">&nbsp;</td><td bgcolor="#330000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#330000\')">&nbsp;</td></tr><tr><td bgcolor="#ffcc99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffcc99\')">&nbsp;</td><td bgcolor="#ff9966" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff9966\')">&nbsp;</td><td bgcolor="#ff9900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff9900\')">&nbsp;</td><td bgcolor="#ff6600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff6600\')">&nbsp;</td><td bgcolor="#cc6600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cc6600\')">&nbsp;</td><td bgcolor="#993300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#993300\')">&nbsp;</td><td bgcolor="#663300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#663300\')">&nbsp;</td></tr><tr><td bgcolor="#ffff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffff99\')">&nbsp;</td><td bgcolor="#ffff66" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffff66\')">&nbsp;</td><td bgcolor="#ffcc66" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffcc66\')">&nbsp;</td><td bgcolor="#ffcc33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffcc33\')">&nbsp;</td><td bgcolor="#cc9933" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cc9933\')">&nbsp;</td><td bgcolor="#996633" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#996633\')">&nbsp;</td><td bgcolor="#663333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#663333\')">&nbsp;</td></tr><tr><td bgcolor="#ffffcc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffffcc\')">&nbsp;</td><td bgcolor="#ffff33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffff33\')">&nbsp;</td><td bgcolor="#ffff00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffff00\')">&nbsp;</td><td bgcolor="#ffcc00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffcc00\')">&nbsp;</td><td bgcolor="#999900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#999900\')">&nbsp;</td><td bgcolor="#666600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#666600\')">&nbsp;</td><td bgcolor="#333300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#333300\')">&nbsp;</td></tr><tr><td bgcolor="#99ff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#99ff99\')">&nbsp;</td><td bgcolor="#66ff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#66ff99\')">&nbsp;</td><td bgcolor="#33ff33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#33ff33\')">&nbsp;</td><td bgcolor="#33cc00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#33cc00\')">&nbsp;</td><td bgcolor="#009900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#009900\')">&nbsp;</td><td bgcolor="#006600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#006600\')">&nbsp;</td><td bgcolor="#003300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#003300\')">&nbsp;</td></tr><tr><td bgcolor="#99ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#99ffff\')">&nbsp;</td><td bgcolor="#33ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#33ffff\')">&nbsp;</td><td bgcolor="#66cccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#66cccc\')">&nbsp;</td><td bgcolor="#00cccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#00cccc\')">&nbsp;</td><td bgcolor="#339999" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#339999\')">&nbsp;</td><td bgcolor="#336666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#336666\')">&nbsp;</td><td bgcolor="#003333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#003333\')">&nbsp;</td></tr><tr><td bgcolor="#ccffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ccffff\')">&nbsp;</td><td bgcolor="#66ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#66ffff\')">&nbsp;</td><td bgcolor="#33ccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#33ccff\')">&nbsp;</td><td bgcolor="#3366ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#3366ff\')">&nbsp;</td><td bgcolor="#3333ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#3333ff\')">&nbsp;</td><td bgcolor="#000099" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#000099\')">&nbsp;</td><td bgcolor="#000066" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#000066\')">&nbsp;</td></tr><tr><td bgcolor="#ccccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ccccff\')">&nbsp;</td><td bgcolor="#9999ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#9999ff\')">&nbsp;</td><td bgcolor="#6666cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#6666cc\')">&nbsp;</td><td bgcolor="#6633ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#6633ff\')">&nbsp;</td><td bgcolor="#6600cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#6600cc\')">&nbsp;</td><td bgcolor="#333399" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#333399\')">&nbsp;</td><td bgcolor="#330099" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#330099\')">&nbsp;</td></tr><tr><td bgcolor="#ffccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ffccff\')">&nbsp;</td><td bgcolor="#ff99ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#ff99ff\')">&nbsp;</td><td bgcolor="#cc66cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cc66cc\')">&nbsp;</td><td bgcolor="#cc33cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#cc33cc\')">&nbsp;</td><td bgcolor="#993399" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#993399\')">&nbsp;</td><td bgcolor="#663366" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#663366\')">&nbsp;</td><td bgcolor="#330033" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'forecolor\', \'#330033\')">&nbsp;</td></tr></table></div><div id="hilitecolor" style="display: none;"><table cellspacing="0" cellpadding="0"><tr><td bgcolor="#ffffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffffff\')">&nbsp;</td><td bgcolor="#cccccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cccccc\')">&nbsp;</td><td bgcolor="#c0c0c0" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#c0c0c0\')">&nbsp;</td><td bgcolor="#999999" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#999999\')">&nbsp;</td><td bgcolor="#666666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#666666\')">&nbsp;</td><td bgcolor="#333333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#333333\')">&nbsp;</td><td bgcolor="#000000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#000000\')">&nbsp;</td></tr><tr><td bgcolor="#ffcccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffcccc\')">&nbsp;</td><td bgcolor="#ff6666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff6666\')">&nbsp;</td><td bgcolor="#ff0000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff0000\')">&nbsp;</td><td bgcolor="#cc0000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cc0000\')">&nbsp;</td><td bgcolor="#990000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#990000\')">&nbsp;</td><td bgcolor="#660000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#660000\')">&nbsp;</td><td bgcolor="#330000" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#330000\')">&nbsp;</td></tr><tr><td bgcolor="#ffcc99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffcc99\')">&nbsp;</td><td bgcolor="#ff9966" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff9966\')">&nbsp;</td><td bgcolor="#ff9900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff9900\')">&nbsp;</td><td bgcolor="#ff6600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff6600\')">&nbsp;</td><td bgcolor="#cc6600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cc6600\')">&nbsp;</td><td bgcolor="#993300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#993300\')">&nbsp;</td><td bgcolor="#663300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#663300\')">&nbsp;</td></tr><tr><td bgcolor="#ffff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffff99\')">&nbsp;</td><td bgcolor="#ffff66" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffff66\')">&nbsp;</td><td bgcolor="#ffcc66" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffcc66\')">&nbsp;</td><td bgcolor="#ffcc33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffcc33\')">&nbsp;</td><td bgcolor="#cc9933" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cc9933\')">&nbsp;</td><td bgcolor="#996633" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#996633\')">&nbsp;</td><td bgcolor="#663333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#663333\')">&nbsp;</td></tr><tr><td bgcolor="#ffffcc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffffcc\')">&nbsp;</td><td bgcolor="#ffff33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffff33\')">&nbsp;</td><td bgcolor="#ffff00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffff00\')">&nbsp;</td><td bgcolor="#ffcc00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffcc00\')">&nbsp;</td><td bgcolor="#999900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#999900\')">&nbsp;</td><td bgcolor="#666600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#666600\')">&nbsp;</td><td bgcolor="#333300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#333300\')">&nbsp;</td></tr><tr><td bgcolor="#99ff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#99ff99\')">&nbsp;</td><td bgcolor="#66ff99" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#66ff99\')">&nbsp;</td><td bgcolor="#33ff33" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#33ff33\')">&nbsp;</td><td bgcolor="#33cc00" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#33cc00\')">&nbsp;</td><td bgcolor="#009900" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#009900\')">&nbsp;</td><td bgcolor="#006600" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#006600\')">&nbsp;</td><td bgcolor="#003300" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#003300\')">&nbsp;</td></tr><tr><td bgcolor="#99ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#99ffff\')">&nbsp;</td><td bgcolor="#33ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#33ffff\')">&nbsp;</td><td bgcolor="#66cccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#66cccc\')">&nbsp;</td><td bgcolor="#00cccc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#00cccc\')">&nbsp;</td><td bgcolor="#339999" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#339999\')">&nbsp;</td><td bgcolor="#336666" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#336666\')">&nbsp;</td><td bgcolor="#003333" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#003333\')">&nbsp;</td></tr><tr><td bgcolor="#ccffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ccffff\')">&nbsp;</td><td bgcolor="#66ffff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#66ffff\')">&nbsp;</td><td bgcolor="#33ccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#33ccff\')">&nbsp;</td><td bgcolor="#3366ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#3366ff\')">&nbsp;</td><td bgcolor="#3333ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#3333ff\')">&nbsp;</td><td bgcolor="#000099" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#000099\')">&nbsp;</td><td bgcolor="#000066" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#000066\')">&nbsp;</td></tr><tr><td bgcolor="#ccccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ccccff\')">&nbsp;</td><td bgcolor="#9999ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#9999ff\')">&nbsp;</td><td bgcolor="#6666cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#6666cc\')">&nbsp;</td><td bgcolor="#6633ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#6633ff\')">&nbsp;</td><td bgcolor="#6600cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#6600cc\')">&nbsp;</td><td bgcolor="#333399" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#333399\')">&nbsp;</td><td bgcolor="#330099" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#330099\')">&nbsp;</td></tr><tr><td bgcolor="#ffccff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ffccff\')">&nbsp;</td><td bgcolor="#ff99ff" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#ff99ff\')">&nbsp;</td><td bgcolor="#cc66cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cc66cc\')">&nbsp;</td><td bgcolor="#cc33cc" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#cc33cc\')">&nbsp;</td><td bgcolor="#993399" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#993399\')">&nbsp;</td><td bgcolor="#663366" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#663366\')">&nbsp;</td><td bgcolor="#330033" onmouseover="over(this)" onmouseout="out(this)" onclick="wysiwyg_set(\'hilitecolor\', \'#330033\')">&nbsp;</td></tr></table></div><div id="icons" style="display: none;"><table cellspacing="0" cellpadding="0"><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'alien.gif\')"><img src="' + host + '/datas/icons/alien.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'ashamed.gif\')"><img src="' + host + '/datas/icons/ashamed.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'aww.gif\')"><img src="' + host + '/datas/icons/aww.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'beer.gif\')"><img src="' + host + '/datas/icons/beer.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'biggrin.gif\')"><img src="' + host + '/datas/icons/biggrin.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'bleh.gif\')"><img src="' + host + '/datas/icons/bleh.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'blushes.gif\')"><img src="' + host + '/datas/icons/blushes.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'bug.gif\')"><img src="' + host + '/datas/icons/bug.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'cd.gif\')"><img src="' + host + '/datas/icons/cd.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'colordevil.gif\')"><img src="' + host + '/datas/icons/colordevil.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'comic.gif\')"><img src="' + host + '/datas/icons/comic.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'confused.gif\')"><img src="' + host + '/datas/icons/confused.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'cookie.gif\')"><img src="' + host + '/datas/icons/cookie.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'cool.gif\')"><img src="' + host + '/datas/icons/cool.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'crazy.gif\')"><img src="' + host + '/datas/icons/crazy.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'crying.gif\')"><img src="' + host + '/datas/icons/crying.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'dead.gif\')"><img src="' + host + '/datas/icons/dead.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'dollarus.gif\')"><img src="' + host + '/datas/icons/dollarus.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'eangel.gif\')"><img src="' + host + '/datas/icons/eangel.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'email.gif\')"><img src="' + host + '/datas/icons/email.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'fight.gif\')"><img src="' + host + '/datas/icons/fight.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'flagus.gif\')"><img src="' + host + '/datas/icons/flagus.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'flame.gif\')"><img src="' + host + '/datas/icons/flame.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'flower1.gif\')"><img src="' + host + '/datas/icons/flower1.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'flower2.gif\')"><img src="' + host + '/datas/icons/flower2.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'frown.gif\')"><img src="' + host + '/datas/icons/frown.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'greetings.gif\')"><img src="' + host + '/datas/icons/greetings.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'gun.gif\')"><img src="' + host + '/datas/icons/gun.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'heart.gif\')"><img src="' + host + '/datas/icons/heart.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'ooleft.gif\')"><img src="' + host + '/datas/icons/ooleft.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'ooright.gif\')"><img src="' + host + '/datas/icons/ooright.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'sheepish.gif\')"><img src="' + host + '/datas/icons/sheepish.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'shiftleft.gif\')"><img src="' + host + '/datas/icons/shiftleft.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'shiftright.gif\')"><img src="' + host + '/datas/icons/shiftright.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'shutup.gif\')"><img src="' + host + '/datas/icons/shutup.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'target.gif\')"><img src="' + host + '/datas/icons/target.gif"></td></tr><tr><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'thumbsdown.gif\')"><img src="' + host + '/datas/icons/thumbsdown.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'thumbsup.gif\')"><img src="' + host + '/datas/icons/thumbsup.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'tongue.gif\')"><img src="' + host + '/datas/icons/tongue.gif"></td><td onmouseover="over_blue(this)" onmouseout="out_blue(this)" onclick="wysiwyg_set(\'inserticon\', \'xdgrin.gif\')"><img src="' + host + '/datas/icons/xdgrin.gif"></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr></tr></table></div><div id="video" style="display: none;"><p>Flash Video Code:</p><p><textarea id="video-code"></textarea></p><p><input type="button" value="Add Video" onclick="wysiwyg_insert_video()"> <input type="button" value="Cancel" onclick="hideIframes()"></p></div><iframe id="edit" class="editor" src="' + wysiwyg_inside + '" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" border="0" frameborder="0"></iframe></div></div>';

	if(window.getSelection)
		{
		setTimeout(function()
			{
			document.getElementById('edit').contentWindow.document.body.innerHTML = Content;
			document.getElementById('edit').contentWindow.document.designMode = "on";
			},  500);
		}
	else if(document.selection)
		{
		document.getElementById('edit').contentWindow.document.designMode = "on";		
		setTimeout(function()
			{
			document.getElementById('edit').contentWindow.document.body.innerHTML = Content;
			},  500);
		}

	setTimeout(function()
		{
		if(document.addEventListener)
			{
			document.getElementById('edit').contentWindow.document.addEventListener("mousedown", hideIframes, true);
			}
		else if(document.attachEvent)
			{
			document.getElementById('edit').contentWindow.document.attachEvent("on" + "mousedown", hideIframes);
			}
		},  1000);
	}

function hideIframes()
	{
	document.getElementById('forecolor').style.display = 'none';
	document.getElementById('icons').style.display = 'none';
	document.getElementById('hilitecolor').style.display = 'none';
	document.getElementById('size').style.display = 'none';
	document.getElementById('video').style.display = 'none';
	document.getElementById('video-code').value = "";
	}

function wysiwyg_set(command, option)
	{
	var editor = document.getElementById('edit');
	hideIframes();

	if(command == 'createlink')
		{
		var userSelection;
		if(window.getSelection)
			{
			userSelection = editor.contentWindow.document.getSelection();
			}
		else if(document.selection)
			{
			userSelection = editor.contentWindow.document.selection.createRange().text;
			}
		if(userSelection == "")
			{
			alert("First select the text that you want to make into a link.");
			}
		else
			{
			var option = prompt("Enter the URL", "http://");
			if((option != null) && (option != ""))
				{
				editor.contentWindow.document.execCommand(command, false, option);
				}
			}
		}
	else if(command == 'insertimage')
		{
		var option = prompt("Enter the URL", "http://");
		if((option != null) && (option != ""))
			{
			editor.contentWindow.document.execCommand(command, false, option);
			}
		}
	else if(command == 'forecolor' || command == 'hilitecolor')
		{
		if(document.all)
			{
			if(range.text != "")
				{
				range.select();
				}
			if(command == 'hilitecolor')
				{
				command = 'backcolor';
				}
			}
		editor.contentWindow.document.execCommand(command, false, option);
		}
	else if(command == 'inserticon')
		{
		if(document.all)
			{
			range.select();
			}
		var image = host + '/datas/icons/' + option;
		editor.contentWindow.document.execCommand('insertimage', false, image);
		}
	else if(command == 'fontsize')
		{
		if(document.all)
			{
			range.select();
			}
		var image = host + '/datas/icons/' + option;
		editor.contentWindow.document.execCommand(command, false, option);
		}
	else
		{
		editor.contentWindow.document.execCommand(command, false, option);
		}

	editor.contentWindow.focus();
	}

function wysiwyg_forecolor()
	{
	if(document.all)
		{
		var selection = document.getElementById('edit').contentWindow.document.selection; 
		if(selection != null)
			{
			range = selection.createRange();
			}
		}
	hideIframes();
	document.getElementById('forecolor').style.display = '';
	}

function wysiwyg_hilitecolor()
	{
	if(document.all)
		{
		var selection = document.getElementById('edit').contentWindow.document.selection; 
		if(selection != null)
			{
			range = selection.createRange();
			}
		}
	hideIframes();
	document.getElementById('hilitecolor').style.display = '';
	}

function wysiwyg_icon()
	{
	if(document.all)
		{
		var selection = document.getElementById('edit').contentWindow.document.selection; 
		if(selection != null)
			{
			range = selection.createRange();
			}
		}
	hideIframes();
	document.getElementById('icons').style.display = '';
	}

function wysiwyg_video()
	{
	if(document.all)
		{
		var selection = document.getElementById('edit').contentWindow.document.selection; 
		if(selection != null)
			{
			range = selection.createRange();
			}
		}
	hideIframes();
	document.getElementById('video').style.display = '';
	}


function wysiwyg_insert_video()
	{
	var Code = document.getElementById('video-code').value;
	Code = relace_flash(Code);
	hideIframes();
	if(document.all)
		{
		range.select();
		}

	var editor = document.getElementById('edit');
	editor.contentWindow.focus();

	if(!value)
		{
		value = '';
		}

	if(document.all)
		{
		}
	else
		{
		}
















	}

function wysiwyg_size()
	{
	if(document.all)
		{
		var selection = document.getElementById('edit').contentWindow.document.selection; 
		if(selection != null)
			{
			range = selection.createRange();
			}
		}
	hideIframes();
	document.getElementById('size').style.display = '';
	}

function over(Item)
	{
	Item.style.borderTop = "1px solid #ffffff";
	Item.style.borderLeft = "1px solid #ffffff";
	Item.style.borderRight = "1px solid #000000";
	Item.style.borderBottom = "1px solid #000000";
	}

function out(Item)
	{
	Item.style.border = "1px solid #bbbbbb";
	}


function over_blue(Item)
	{
	Item.style.background = "#316ac5";
	Item.style.color = "#ffffff";
	}

function out_blue(Item)
	{
	Item.style.background = "#e2e7ee";
	Item.style.color = "#000000";
	}

function over_view(Item)
	{
	Item.style.color = "#cc0000";
	}

function out_view(Item)
	{
	Item.style.color = "#0000ee";
	}

function clean(Text)
	{
	a = Text.indexOf("<");
	b = Text.indexOf(">");
	len = Text.length;
	c = Text.substring(0, a);
	if(b == -1)
		{
		b = a;
		}
	d = Text.substring((b + 1), len);
	Text = c + d;
	tagCheck = Text.indexOf("<");
	if(tagCheck != -1)
		{
		Text = clean(Text);
		}

	return Text;
	}

function plain_text()
	{
	var Content = document.getElementById('edit').contentWindow.document.body.innerHTML;
	Content = Content.replace(/\n/gi, '');
	Content = Content.replace(/<br>/gi, '\n');
	Content = Content.replace(/<br \/>/gi, '\n');

	if(Content != "" && Content != null)
		{
		var Clean = clean(Content);
		if(Content != Clean)
			{
			var agree = confirm("Converting this message to plain text will lose some formatting.\nAre you sure you want to continue?");
			if(agree)
				{
				document.getElementById('edit').parentNode.parentNode.innerHTML = '<div class="wysiwyg-menu"><table cellspacing="0" cellpadding="0"><tr><td class="change_view" onmouseover="over_view(this)" onmouseout="out_view(this)" onclick="wysiwyg_init(\'Two\')">Rich formatting&nbsp;&nbsp;&raquo;</td></tr></table></div><textarea name="message" class="wysiwyg">\n' + Clean + '</textarea>';
				}
			else
				{
				return false;
				}
			}
		else
			{
			document.getElementById('edit').parentNode.parentNode.innerHTML = '<div class="wysiwyg-menu"><table cellspacing="0" cellpadding="0"><tr><td class="change_view" onmouseover="over_view(this)" onmouseout="out_view(this)" onclick="wysiwyg_init(\'Two\')">Rich formatting&nbsp;&nbsp;&raquo;</td></tr></table></div><textarea name="message" class="wysiwyg">\n' + Content + '</textarea>';
			}
		}
	else
		{
		document.getElementById('edit').parentNode.parentNode.innerHTML = '<div class="wysiwyg-menu"><table cellspacing="0" cellpadding="0"><tr><td class="change_view" onmouseover="over_view(this)" onmouseout="out_view(this)" onclick="wysiwyg_init(\'Two\')">Rich formatting&nbsp;&nbsp;&raquo;</td></tr></table></div><textarea name="message" class="wysiwyg">\n' + Content + '</textarea>';
		}
	}

function hover(Item)
	{
	Item.style.borderTop = "1px solid #ffffff";
	Item.style.borderLeft = "1px solid #ffffff";
	Item.style.borderRight = "1px solid #8d8d8d";
	Item.style.borderBottom = "1px solid #8d8d8d";
	}

function down(Item)
	{
	Item.style.borderTop = "1px solid #8d8d8d";
	Item.style.borderLeft = "1px solid #8d8d8d";
	Item.style.borderRight = "1px solid #ffffff";
	Item.style.borderBottom = "1px solid #ffffff";
	}

function up(Item)
	{
	Item.style.border = "1px solid #e2e7ee";
	}

function getValue()
	{
	var Content = document.getElementById('edit').contentWindow.document.body.innerHTML;
	Content = put_flash_back(Content);
	document.getElementById('message').value = Content;
	}

function show_reply()
	{
	document.getElementById('reply').style.display = 'none';
	document.getElementById('reply-container').style.display = '';
	wysiwyg_init('One');
	return false;
	}

function show_contacts()
	{
	document.getElementById('select-contact').style.display = '';
	}

function select_contact(User)
	{
	document.getElementById('contact-to').value = User;
	document.getElementById('select-contact').style.display = 'none';
	}