function DoConfirm(message, url) {
	if(confirm(message)) location.href = url;
}

function WhichClicked(ww) {
	window.document.postmodify.waction.value = ww;
}

function submitonce(theform) {
	// if IE 4+ or NS 6+
	if (document.all || document.getElementById) {
		// hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++) {
			var tempobj=theform.elements[i];
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") {
				//disable it
				tempobj.disabled=true;
			}
		}
	}
}

function storeCaret(text) { 
	if (text.createTextRange) {
		text.caretPos = document.selection.createRange().duplicate();
	}
}

function replaceText(text)
{

	if (document.postmodify.message.createTextRange && document.postmodify.message.caretPos) {      
		var caretPos = document.postmodify.message.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.postmodify.message.value += text;
	document.postmodify.message.focus(caretPos)
}

function surroundText(text1,text2)
{
	if (document.postmodify.message.createTextRange && document.postmodify.message.caretPos) {      
		var caretPos = document.postmodify.message.caretPos;      
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2;
	}
	else document.postmodify.message.value += text1 + text2;
	document.postmodify.message.focus(caretPos)
}

function isEmptyText(theField)
{
	while (theField.value.length > 0 && (theField.value.charAt(0)==' ' || theField.value.charAt(0)=='\t'))
		theField.value = theField.value.substring(1,theField.value.length);
	while (theField.value.length > 0 && (theField.value.charAt(theField.value.length-1)==' ' || theField.value.charAt(theField.value.length-1)=='\t'))
		theField.value = theField.value.substring(0,theField.value.length-1);

	if (theField.value=='')
		return true;
	else
		return false;
}