var idTextfeld    = 'wikitext';
var rangeIE = null;

  function insertProperty(prop,val) {
    insertText('[' + prop + '=' + val + ']', '[/' + prop + ']');
  }

  function insertText(vor, nach) {
     var textfeld = document.getElementById(idTextfeld);
     textfeld.focus();

     if(typeof document.selection != 'undefined') {
       insertIE(textfeld, vor, nach);
     } else if (typeof textfeld.selectionStart != 'undefined') {
       insertGecko(textfeld, vor, nach);
     }
  }

  function insertIE(textfeld, vor, nach) {
     if(!rangeIE) rangeIE = document.selection.createRange();

     if(rangeIE.parentElement().id != idTextfeld) { rangeIE = null; return; }

     var alterText = rangeIE.text;
     rangeIE.text = vor + alterText + nach;

     if (alterText.length == 0)
       rangeIE.move('character', -nach.length);
     else
       rangeIE.moveStart('character', rangeIE.text.length);
    
     rangeIE.select();
     rangeIE = null;
  }

  function insertGecko(textfeld, vor, nach)
  {
     von = textfeld.selectionStart;
     bis = textfeld.selectionEnd;
     anfang = textfeld.value.slice(0,   von);
     mitte  = textfeld.value.slice(von, bis);
     ende   = textfeld.value.slice(bis);
     textfeld.value = anfang + vor + mitte + nach + ende;

     if(bis - von == 0) {
       textfeld.selectionStart = von + vor.length;
       textfeld.selectionEnd   = textfeld.selectionStart;
     } else {
       textfeld.selectionEnd   = bis + vor.length + nach.length;
       textfeld.selectionStart = textfeld.selectionEnd;
     }
  };

  function getSelectionIE()
  {
    if (document.selection) {
      document.getElementById(idTextfeld).focus();
      rangeIE = document.selection.createRange();
    }
  }

function hideEl(myid) {
    document.getElementById(myid).setAttribute('style', 'display:none;', 0);
    document.getElementById(myid).style.display = 'none';
}

function showEl(myid) {
    document.getElementById(myid).setAttribute('style', 'display:inline;', 0);
    document.getElementById(myid).style.display = 'inline';
}

function changeElBox(changeid) {
    if(document.getElementById(changeid).style.display=="inline") {
        hideEl(changeid);
        window.setTimeout("printMessage('ellink','&#8595; show')", 300);
    } else {
        showEl(changeid);
        window.setTimeout("printMessage('ellink','&#8593; hide')", 300);
    }
}

function wikiSetTitle(mytitle,mywikititle) {
    document.title = mytitle+' - Wiki - Conmunix Networks';
    printMessage('pathway','Navigation » <a href="./wiki,Home.html">Wiki</a> » <a href="./wiki,'+mywikititle+'.html">'+mytitle+'</a>');
}

function wikiSurvey(myid,myvalue) {
    saveBox("wikisurvey"+myid, "set");
    axGetRequest('./wikisurvey.html?survey_id='+myid+'&survey_value='+myvalue,'surveyreturn');
}