
//usage
// onclick = "open_close(this)";

function spoiler(obj) {
    for (var i = 0; i < obj.children.length; i++) {
        if (obj.children[i].tagName == "DIV") {
            var child = obj.children[i];
        }
    }
    child.style.display = (child.style.display == 'block') ? 'none' : 'block';
}

function insnm(val){
 document.post.whoname.value = val;
}

function gets(){
 if (navigator.appName == 'Microsoft Internet Explorer') rng = document.selection.createRange().text; else rng = document.getSelection();
}

function ins(text){
    // Focus is placed to textarea.
	myForm = document.forms.post;
    var t = myForm.message;
    t.focus(); 
    // Insert the string. 
    if (document.selection && document.selection.createRange) {
      var r = document.selection.createRange();
      if (!myForm.replaceOnInsert) r.collapse();
      r.text = text; 
    } else if (t.setSelectionRange) {
      var start = myForm.replaceOnInsert? t.selectionStart : t.selectionEnd;
      var end   = t.selectionEnd;
      var sel1  = t.value.substr(0, start);
      var sel2  = t.value.substr(end);
      t.value   = sel1 + text + sel2;
      t.setSelectionRange(start+text.length, start+text.length);
    } else{
      t.value += text;
    }
    // For IE.
    setTimeout(function() { t.focus() }, 100);
}

function sel(text){
 temp = "[s]" + text + "[/s]";
 ins(temp);
}

function quot(text){
 temp = "[q]" + text + "[/q]";
 ins(temp);
}

function seltext(text){
  ins(">" + text);
  }

function PollWindow(w_url) {
window.open(w_url,"pollwindow","alwaysRaised=yes,width=620,height=460,menubar=no,resizable=no,scrollbars=yes,status=no");
}

function onLoad() {window.open("/forum/private.php?show=all","","");}

function sF(s){if (s) document.forms.post.submit();}

function checkall(val) {
dml = document.post;
len = dml.elements.length;
var i=0;
for (i=0 ; i<len ; i++) {
if (dml.elements[i].id=='chbox'){dml.elements[i].checked=val;}}
}


