
function Start() {
	var iframe = document.getElementById('iframe');
	if (!iframe) return false;
	/*
	if (document.getElementById && !document.all) {
		iframe.contentWindow.document.designMode = 'on';
	} else {
		iframe.document.designMode = 'on';
	}
	*/
	iframe.contentWindow.document.designMode = 'on';
	iframe.contentWindow.document.body.innerHTML = document.getElementById('content').value;
	try {
		iframe.contentWindow.document.execCommand("undo", false, null);
	} catch (e) {
		alert("This demo is not supported on your level of Mozilla.");
	}
}

function Exec(Command) {
	var iframe = document.getElementById('iframe');
	if (Command == 'CreateLink') {
		var szURL = prompt('Введите URL:', 'http://');
		if ((szURL != null) && (szURL != '')) iframe.contentWindow.document.execCommand(Command, false, szURL);
	} else if (Command == 'InsertImage') {
		var imagePath = prompt('Введите URL картинки:', '');
		if ((imagePath != null) && (imagePath != "")) iframe.contentWindow.document.execCommand(Command, false, imagePath);
	} else {
		iframe.contentWindow.document.execCommand(Command, false, null);
	}
}

function Post() {
	var content = document.getElementById('iframe').contentWindow.document.body.innerHTML;
	if (!content) { alert('Ошибка! Поле «Ваше сообщение» обязательно для заполнения'); return false; }
	document.getElementById('content').value = content;
	document.getElementById('button').disabled = true;
	return true;
}
