function resetstatus() {
  window.status='';
  return true;
}
function MM_openBrWindow2(theURL,winName,width,height,popupfullscreen) {
  if (!popupfullscreen) {
    popupfullscreen="N";
  }
  height = height + 25;
  var winl = (screen.width - width) / 2;
  var wint = (screen.height - height) / 2;
  var i = width +25;
  var j = height +25;
  var features = 'scrollbars=yes,resizable=yes,width='+width+',height='+height+',top='+wint+',left='+winl+'';
  if (popupfullscreen=="Y") {
    var features = 'fullscreen=yes,scrollbars=yes';
  }
  var pietje;
  pietje=window.open(theURL,winName,features);
  if (popupfullscreen!="Y") {
    pietje.resizeTo(i,j);
  }
  pietje.focus();
}
function ReadCookie(cookieName) {
 var theCookie=""+document.cookie;
 var ind=theCookie.indexOf(cookieName);
 if (ind==-1 || cookieName=="") return "";
 var ind1=theCookie.indexOf(';',ind);
 if (ind1==-1) ind1=theCookie.length;
 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
}
function changeObjectVisibility(objectId, newVisibility) {
  var styleObject = getStyleObject(objectId, document);
  if(styleObject) {
    styleObject.visibility = newVisibility;
    return true;
  }
  return false;
}
function getStyleObject(objectId) {
  if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else if (document.layers && document.layers[objectId]) {
    return getObjNN4(document,objectId);
  } else {
    return false;
  }
}
function getObject(objectId) {
  if(document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId);
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId);
  } else if (document.layers && document.layers[objectId]) {
    return getObjNN4(document,objectId);
  } else {
    return false;
  }
}
function getObjNN4(obj,name) {
  var x = obj.layers;
  var foundLayer;
  for (var i=0;i<x.length;i++) {
    if (x[i].id == name)
       foundLayer = x[i];
    else if (x[i].layers.length)
      var tmp = getObjNN4(x[i],name);
    if (tmp) foundLayer = tmp;
  }
  return foundLayer;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

window.addEvent('domready', function(){
  var Tips2 = new Tips($$('.Tips2'), {
    initialize:function(){
      this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
    },
    onShow: function(toolTip) {
      this.fx.start(1);
    },
    onHide: function(toolTip) {
      this.fx.start(0);
    }
  });
  var Tips3 = new Tips($$('.Tips3'), {
    initialize:function(){
      this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
    },
    onShow: function(toolTip) {
      this.fx.start(1);
    },
    onHide: function(toolTip) {
      this.fx.start(0);
    },
    className: 'leftmenutip'
  });
});

function insertAtCursor(myField, myValue) {
  //IE support
  if (document.selection) {
    myField.focus();
   //in effect we are creating a text range with zero
   //length at the cursor location and replacing it
   //with myValue
   sel = document.selection.createRange();
   sel.text = myValue;
  } else if (myField.selectionStart | myField.selectionStart == '0') {
  //Mozilla/Firefox/Netscape 7+ support
    //Here we get the start and end points of the
    //selection. Then we create substrings up to the
    //start of the selection and from the end point
    //of the selection to the end of the field value.
    //Then we concatenate the first substring, myValue,
    //and the second substring to get the new value.
    var startPos = myField.selectionStart;
    var endPos = myField.selectionEnd;
    myField.value = myField.value.substring(0, startPos)+ myValue+ myField.value.substring(endPos, myField.value.length);
  } else {
    myField.value += myValue;
  }
}

function insertTag(string,fieldname) {
  fieldObj = document.getElementById(fieldname);
  insertAtCursor(fieldObj,string+' ');
}

function saveReactie(fieldname,ondid,reactieid) {
  fieldObj = document.getElementById(fieldname);
  document.reactieform.reactiedetail.value=fieldObj.value;
  document.reactieform.ondr_nr.value=ondid;
  document.reactieform.reactieid.value=reactieid;
  document.reactieform.submit();
}

function setDefaultValue(fieldObj) {
  if (fieldObj.value=='Tik hier uw reactie ...') {
    fieldObj.value = '';
  }
}
