<script type="text/javascript">
<!--
function xoopsCodeUrl(id) {
var text = prompt("<?php echo _ENTERURL;?>", "");
var dom  = xoopsGetElementById(id);
if ( text != null && text != "" ) {
	var text2 = prompt("<?php echo _ENTERWEBTITLE;?>", "");
	if (text2 != null) {
		if (text2 == "") {
			var result = "[url=" + text + "]" + text + "[/url]";
			} else {
				var result = "[url=" + text + "]" + text2 + "[/url]";
			}
		dom.focus();
		dom.value += result;
	}
}
}
function xoopsCodeImg(id) {
var dom  = xoopsGetElementById(id);
var text = prompt("<?php echo _ENTERIMGURL;?>", "");
if ( text != null && text != "" ) {
	var text2 = prompt("<?php echo _ENTERIMGPOS;?>\n<?php echo _IMGPOSRORL;?>", "");
	while ( ( text2 != "" ) && ( text2 != "r" ) && ( text2 != "R" ) && ( text2 != "l" ) && ( text2 != "L" ) && ( text2 != null ) ) {
		text2 = prompt("<?php echo _ERRORIMGPOS;?>\n<?php echo _IMGPOSRORL;?>","");
	}
	if ( text2 == "l" || text2 == "L" ) {
		text2 = " align=left";
		} else if ( text2 == "r" || text2 == "R" ) {
			text2 = " align=right";
			} else {
				text2 = "";
			}
		var result = "[img" + text2 + "]" + text + "[/img]";
		dom.focus();
		dom.value += result;
	}
}
function xoopsCodeEmail(id) {
var text = prompt("<?php echo _ENTEREMAIL;?>", "");
var dom  = xoopsGetElementById(id);
if ( text != null && text != "" ) {
	var result = "[email]" + text + "[/email]";
	dom.focus();
	dom.value += result;
	}
}
function xoopsCodeQuote(id) {
var text = prompt("<?php echo _ENTERQUOTE;?>", "");
var dom  = xoopsGetElementById(id);
if ( text != null && text != "" ) {
	var result = "[quote]" + text + "[/quote]";
	dom.focus();
	dom.value += result;
	}
}
function xoopsCodeCode(id) {
var text = prompt("<?php echo _ENTERCODE;?>", "");
var dom  = xoopsGetElementById(id);
if ( text != null && text != "" ) {
	var result = "[code]" + text + "[/code]";
	dom.focus();
	dom.value += result;
	}
}
function xoopsCodeText(id) {
var textareaDom        = xoopsGetElementById(id);
var textDom            = xoopsGetElementById(id + "Addtext");
var fontDom            = xoopsGetElementById(id + "Font");
var colorDom           = xoopsGetElementById(id + "Color");
var sizeDom            = xoopsGetElementById(id + "Size");
var hiddenTextDomStyle = xoopsGetElementById(id + "hiddenText").style;
var textDomValue       = textDom.value;
var fontDomValue       = fontDom.options[fontDom.options.selectedIndex].value;
var colorDomValue      = colorDom.options[colorDom.options.selectedIndex].value;
var sizeDomValue       = sizeDom.options[sizeDom.options.selectedIndex].value;
if (textDomValue == "") {
	alert("<?php echo _ENTERTEXTBOX;?>");
	textDom.focus();
	} else {
		if ( fontDomValue != "FONT") {
			textDomValue = "[font=" + fontDomValue + "]" + textDomValue + "[/font]";
			fontDom.options[0].selected = true;
		}
		if ( colorDomValue != "COLOR") {
			textDomValue = "[color=" + colorDomValue + "]" + textDomValue + "[/color]";
			colorDom.options[0].selected = true;
		}
		if ( sizeDomValue != "SIZE") {
			textDomValue = "[size=" + sizeDomValue + "]" + textDomValue + "[/size]";
			sizeDom.options[0].selected = true;
		}
		if ( xoopsGetElementById(id + "Bold").checked == true ) {
			textDomValue = "[b]" + textDomValue + "[/b]";
			xoopsGetElementById(id + "Bold").checked = false;
		}
		if ( xoopsGetElementById(id + "Italic").checked == true ) {
			textDomValue = "[i]" + textDomValue + "[/i]";
			xoopsGetElementById(id + "Italic").checked = false;
		}
		if ( xoopsGetElementById(id + "Underline").checked == true ) {
			textDomValue = "[u]" + textDomValue + "[/u]";
			xoopsGetElementById(id + "Underline").checked = false;
		}
		textareaDom.focus();
		textareaDom.value += textDomValue;
		textDom.value = "";
	}
}
function xoopsCodeSmilie(id, smilieCode) {
var textareaDom = xoopsGetElementById(id);
textareaDom.focus();
textareaDom.value += smilieCode;
}
function xoopsValidate(subjectId, textareaId, submitId) {
var maxchars    = 65535;
var subjectDom  = xoopsGetElementById(subjectId);
var textareaDom = xoopsGetElementById(textareaId);
var submitDom   = xoopsGetElementById(submitId);
if (textareaDom.value == "") {
	alert("<?php echo _PLZCOMPLETE;?>");
	textareaDom.focus();
	return false;
}
if (subjectDom.value == "") {
	alert("<?php echo _PLZCOMPLETE;?>");
	subjectDom.focus();
	return false;
}
if (maxchars != 0) {
	if (textareaDom.value.length > maxchars) {
		alert("<?php echo _MESSAGETOOLONG;?>\n\n<?php echo _ALLOWEDCHAR;?>" + maxchars + "\n<?php echo _CURRCHAR;?>" + textareaDom.value.length + "");
		textareaDom.focus();
		return false;
		} else {
			submitDom.disabled = true;
			return true;
		}
	} else {
		submitDom.disabled = true;
		return true;
	}
}
//-->
</script>
