function setsmiley(text) {
	if (document.editfuspost.body.createTextRange && document.editfuspost.body.caretPos) {
		var caretPos = document.editfuspost.body.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.editfuspost.body.value += text;
	document.editfuspost.body.focus(caretPos)
}

function setsmiley2(text) {
	if (document.editfuspost.form_full.createTextRange && document.editfuspost.form_full.caretPos) {
		var caretPos = document.editfuspost.form_full.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.editfuspost.form_full.value += text;
	document.editfuspost.form_full.focus(caretPos)
}

function code(text) {
	if (document.userpost.tresc_listu.createTextRange && document.userpost.body.caretPos) {
		var caretPos = document.userpost.tresc_listu.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.userpost.tresc_listu.value += text;
	document.userpost.tresc_listu.focus(caretPos)
}

function storeCaret(text) {
	if (text.createTextRange) {
		text.caretPos = document.selection.createRange().duplicate();
	}
}

function setsmiley2n(text) {
	if (document.userpost.form_full.createTextRange && document.userpost.form_full.caretPos) {
		var caretPos = document.userpost.form_full.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?
		text + ' ' : text;
	}
	else document.userpost.form_full.value += text;
	document.userpost.form_full.focus(caretPos)
}

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 check_if_selected() {
        var nonactive=true;
	// if IE 4+ or NS 6+
	if (document.all || document.getElementById) {
		// hunt down "checkbox"
		for (i=0;i<deleteform.length;i++) {
			var tempobj=deleteform.elements[i];
			if(tempobj.type.toLowerCase()=="checkbox") {
				//disable it
                                if (document.forms[ "deleteform" ].elements[tempobj.name].checked)
                                nonactive=false;
			}
		}
	}
        document.deleteform.deletebutton.disabled=nonactive;
}

function PreviewPost() {
        document.userpost.action = "body.php?id=preview";
}

function editpreview() {

        document.editposting.action = "edit.php?a=preview";
}


function Delete(){
  if(document.formpke.deleteuser.value == "no"){
     document.formpke.deleteuser.value = "yes";
  }else{
     document.formpke.deleteuser.value = "no";
  }
}

