function over(pct) {
	document.getElementById(pct).className="over";
};

function out(pct) {
	if(flg != pct)
		document.getElementById(pct).className="flat";
	else
		document.getElementById(pct).className="toggle";
};
	
flg = '';

function showeditor(fnc,width,height) {
	if(document.getElementById('editor').innerHTML=='' || flg != fnc) {
		document.getElementById(fnc).className='toggle';
		if(flg != '' && flg != fnc) document.getElementById(flg).className='flat';
		document.getElementById('editor').innerHTML='<hr size="1"><iframe src="editor/'+fnc+'/edit.html" frameborder="0" width="'+width+'" height="'+height+'" scrolling="no"></iframe>';
		flg = fnc;
	} else {
		document.getElementById(fnc).className='flat';
		document.getElementById('editor').innerHTML='';
		flg="";
	}
}

var area;

Event.observe(window.document, 'mousedown', findarea, true);

function findarea (e) {
	var clk = Event.element(e);
	if(clk.name != 'btn') area = clk;	
}

document.write("<style>.flat{border:#ffffff 1px solid;background-color:#ffffff;}.over{border:#316AC5 1px solid;background-color:#DFF1FF;}.toggle{border:#316AC5 1px solid;background-color:#C1D2EE;}</style>");
document.write("<div style=\"margin-top:3px;\"><img src=\"editor/auemoji/btn.gif\" id=\"auemoji\" name=\"btn\" alt=\"au絵文字挿入\" onClick=\"showeditor('auemoji',412,135);\" onmouseout=\"out('auemoji')\" onmouseover=\"over('auemoji')\" class=\"flat\" style=\"margin:0 1px;\"><!--<img src=\"editor/dcmemoji/btn.gif\" id=\"dcmemoji\" name=\"btn\" alt=\"DoCoMo絵文字挿入\" onClick=\"\" onmouseout=\"out('dcmemoji')\" onmouseover=\"over('dcmemoji')\" class=\"flat\" style=\"margin:0 1px;\">--><!--<img src=\"editor/sbemoji/btn.gif\" id=\"sbemoji\" name=\"btn\" alt=\"SoftBank絵文字挿入\" onClick=\"\" onmouseout=\"out('sbemoji')\" onmouseover=\"over('sbemoji')\" class=\"flat\" style=\"margin:0 1px;\">--></div>");
document.write('<span id="editor"></span>');
