
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Bevestiging vragen bij het verwijderen van een item record.
function confirmAction(theLink, thingToDelete, confirmMsg)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }

    var is_confirmed = confirm(confirmMsg + ' \n' + thingToDelete);
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
} // end of the 'confirmLink()' function


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Zoekveld checken
function check_search_field()
  {
   var search_string
   search_string=document.search_form.search_string.value
   if (search_string=='Zoek hier')
    {
     alert ('Geef een geldige zoekopdracht');
     returnVal=false;
     return false;
    }
   else
    {
   returnVal=true;
    }
  }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Disable select + Mousedown functies
/*
  var message='';
  function clickIE() {if (document.all) {(message);return false;}}
  function clickNS(e) {if
  (document.layers||(document.getElementById&&!document.all)) {
  if (e.which==1||e.which==2||e.which==3) {(message);return false;}}}
  if (document.layers)
  {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
  else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
  document.oncontextmenu=new Function('return false')

  function disableselect(e){
  return false
  }
  function reEnable(){
  return true
  }
  document.onselectstart=new Function ('return false')
  if (window.sidebar){
  document.onmousedown=disableselect
  document.onclick=reEnable
  }
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// popup window
function openpopup(popurl, width, height)
   {
    winpops=window.open(popurl,'','width=' + width + ',height=' + height+', scrollbars=1, resizable=no')
   }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Het post formulier checken
function checkForm(what)
 {
    var valid = true;
    var checkBoxes = false;
    var checkboxChecked = false;
    var radioButtons = false;
    var radioChecked = false;
    var emptyField = new Array
    var x = 0;

    for (var i=0, j=what.elements.length; i<j; i++) {
        myType = what.elements[i].type;
        if (myType == 'radio') {
            radioButtons = true;
           if (what.elements[i].checked) radioChecked = true;
        }
        if (myType == 'checkbox') {
            checkBoxes = true;
            if (what.elements[i].checked) checkboxChecked = true;
        }
        if (myType == 'password' || myType == 'text' || myType == 'textarea')
            if (what.elements[i].value == '') {valid = false;
             emptyField[x] = what.elements[i].id; x++;
            }
    }

    if ((checkBoxes && !checkboxChecked) || (radioButtons && !radioChecked)) valid = false;

    if (!valid)
        alert(emptyField[0]);

    return valid;
 }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Een functie om form elemeneten te disablelen
function disableElement(formName, item) {
  for (var i=0; i<formName.elements.length; i++) {
    if (formName.elements[i].name == item) {
      formName.elements[i].disabled = true;
    }
  }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Een functie om form elemeneten te enablelen
function enableElement(formName, item) {
  for (var i=0; i<formName.elements.length; i++) {
    if (formName.elements[i].name == item) {
      formName.elements[i].disabled = false;
    }
  }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Een kleine preloarder van een pagina.
function clearPreloadPage() {
     if (document.getElementById){
             document.getElementById('prepage').style.visibility='hidden';
     }else{
             if (document.layers){
             document.prepage.visibility = 'hidden';
             }
             else {
             document.all.prepage.style.visibility = 'hidden';
             }
     }
 }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Een soort van BBCode alleen dan aangepast naar mijn wensen.
function codeInsert(what) {
  var txtarea = document.form.fullText.value;
  if (what == 'B'){
   document.form.fullText.value=txtarea + '[B] [/B]';
  }
  if (what == 'B-Big'){
   document.form.fullText.value=txtarea + '[B2] [/B2]';
  }
  if (what == 'I'){
   document.form.fullText.value=txtarea + '[I] [/I]';
  }
  if (what == 'U'){
   document.form.fullText.value=txtarea + '[U] [/U]';
  }
  if (what == 'URL'){
   document.form.fullText.value=txtarea + '[url= /] [/url]';
  }
  if (what == 'URL-Target'){
   document.form.fullText.value=txtarea + '[url= [target= /] [/url]';
  }
  if (what == 'IMG'){
   document.form.fullText.value=txtarea + '[img] [/img]';
  }
  if (what == 'Popup venster'){
   document.form.fullText.value=txtarea + '[popup= [link= [/popup]';
  }
 }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Een regeltje met helptekst voor de soort van BBcode....
function helpline(what) {
  if (what == 'B'){
   document.form.helpLine.value='[B] Type ertussen de text die VET moet worden weergegeven [/B]';
  }
  if (what == 'B-Big'){
   document.form.helpLine.value='[B2] Type ertussen de text die VET moet worden weergegeven [/B2]';
  }
  if (what == 'I'){
   document.form.helpLine.value='[I] Type ertussen de text die ITALIC moet worden weergegeven [/I]';
  }
  if (what == 'U'){
   document.form.helpLine.value='[U] Type ertussen de text die UNDERLINE moet worden weergegeven [/U]';
  }
  if (what == 'URL'){
   document.form.helpLine.value='[url=http://www.startpagina.nl /] Hyperlink tekst [/url]';
  }
  if (what == 'URL-Target'){
   document.form.helpLine.value='[url=http://www.startpagina.nl [target= /]  Hyperlink tekst [/url]';
  }
  if (what == 'IMG'){
   document.form.helpLine.value='[img] http://www.plaatjes.nl/plaatje.gif [/img]';
  }
  if (what == 'popup'){
   document.form.helpLine.value='[popup= http://www.site.nl [link= Hyperlink tekst [/popup]';
  }
 }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// De help lijn weer leegmaken
function clearHelpline() {
  document.form.helpLine.value=' ';
 }
