/* doRedirect: redirect zonder submit */
function doRedirect(link)
{
   window.location = link;
}

/* replace: Javascript tegenhanger van de PHP functie str_replace */
function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

/* showDatePickerfuture: toont de kalender */
function showDatePickerFuture(strFormField, myDate, e) {
   myDp = window.open('../include/datepicker.php?future=1&leegKnop=0&field='+strFormField+'&datum='+myDate+'', 'windp', 'toolbar=no,fullscreen=no,location=no,scrollbars=no,resizable=no,menubar=no,status=no,width=315,height=262,top='+(e.screenY-121)+',left='+(e.screenX-137)+';');
   myDp.focus();
}

function popupImage(strURL,strWindowName) {
   var winWidth = 575;
   var winHeight = 575;
	REFWindow = window.open(strURL, strWindowName, 'toolbar=no,fullscreen=no,location=no,scrollbars=no,resizable=yes,menubar=no,status=no,width='+winWidth+',height='+winHeight+',left='+(screen.width-winWidth)/2+',top='+(screen.height-winHeight)/2);
   REFWindow.focus();
}

function menuVisibility(n1) {
   for ( i=1; i<5; i++ ) {
      if ( i == n1) {
         document.getElementById('menu_' + i).style.visibility = 'visible';
      } else {
         document.getElementById('menu_' + i).style.visibility = 'hidden';
      }
   }
}

function gotoPage(page) {
   window.location = page;
}

function scrollMenu() {
   var browserWidth = document.body.clientWidth;
   var browserHeight = document.body.clientHeight;

   myMenu = eval("document.all.divMenu");
   myMenuItem1 = eval("document.all.menu_1");
   myMenuItem2 = eval("document.all.menu_2");
   myMenuItem3 = eval("document.all.menu_3");
   myMenuItem4 = eval("document.all.menu_4");

   /*
   if ( browserHeight < 590 ) {
      myMenu.style.position = "fixed";
      myMenu.style.top = 144;
      myMenuItem1.style.top = 147;
      myMenuItem2.style.top = 257;
      myMenuItem3.style.top = 367;
      myMenuItem4.style.top = 477;
   } else {
      myMenu.style.position = "absolute";
   */

      if (document.body.scrollTop <= 144) {
         myMenu.style.position = "static";
         myMenu.style.top = 144;
         myMenuItem1.style.top = 147;
         myMenuItem2.style.top = 257;
         myMenuItem3.style.top = 367;
         myMenuItem4.style.top = 477;
      } else {
         myMenu.style.position = "absolute";
         myMenu.style.top = document.body.scrollTop;
         myMenuItem1.style.top = 3 + document.body.scrollTop
         myMenuItem2.style.top = 113 + document.body.scrollTop
         myMenuItem3.style.top = 223 + document.body.scrollTop
         myMenuItem4.style.top = 333 + document.body.scrollTop
      }
   //}

}

function scrollMenu_novanews() {
   var browserWidth = document.body.clientWidth;
   var browserHeight = document.body.clientHeight;

   myMenu = eval("document.all.divMenu");
   myMenuItem1 = eval("document.all.menu_1");

   if (document.body.scrollTop <= 144) {
      myMenu.style.position = "static";
      myMenu.style.top = 144;
      myMenuItem1.style.top = 147;
   } else {
      myMenu.style.position = "absolute";
      myMenu.style.top = document.body.scrollTop;
      myMenuItem1.style.top = 3 + document.body.scrollTop
   }
}

function menuVisibility_NN(n1) {
   for ( i=1; i<1; i++ ) {
      if ( i == n1) {
         document.getElementById('menu_' + i).style.visibility = 'visible';
      } else {
         document.getElementById('menu_' + i).style.visibility = 'hidden';
      }
   }
}

function showSubMenu(n1) {
   alert(n1);
}