/////////////////coding for scrolling marquee starts here/////////////////

  // Marja Ribbers-de Vroed, FlevOOware

  // get the object, for the given ID
  function MM_findObj(n, d) {
    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 (var i=0;!x&&i<d.forms.length;i++)
      x=d.forms[i][n];
    for(var 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;
  }

  // gets the left,top,width, or height of the DIV
  function getDivPositionValue(sDiv, sProperty) {
    this.opera = (window.opera); // Opera 5+
    this.ns4 = (document.layers); // Netscape 4.x
    this.ns6 = (document.getElementById && !document.all && !this.opera); // Netscape 6+
    this.ie = (document.all);  // Internet Explorer 4+
    var sValue = "";
    docObj = eval("MM_findObj('" + sDiv + "')");
    if (docObj == null){return 0;}

    if ((sProperty == "left") || (sProperty == "top")){
      if (!this.ns4) {docObj = docObj.style; }
      sValue = eval("docObj." + sProperty);
      if ((this.ie) && (sValue == "")){
        // IE (on PC) bug with nested layers
        if (sProperty == "top"){
          sValue = eval(sDiv + ".offsetTop");
        } else {
          sValue = eval(sDiv + ".offsetLeft");
        }
      };
    } else{
      if (this.opera){
        docObj = docObj.style;
        if (sProperty == "height"){
          sValue = docObj.pixelHeight;
        } else if (sProperty == "width"){
          sValue = docObj.pixelWidth;
        }
      } else if (this.ns4){
        sValue = eval("docObj.clip." + sProperty);
      } else if (this.ns6){
        sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty);
      } else if (this.ie){
        if (sProperty == "width"){
          sValue = eval(sDiv + ".offsetWidth");
        } else if (sProperty == "height"){
          sValue = eval(sDiv + ".offsetHeight");
        }
      }
    }

    sValue = (sValue == "") ? 0 : sValue;
    if (isNaN(sValue)){
      if (sValue.indexOf('px') > 0){
        sValue = sValue.substring(0,sValue.indexOf('px'));
      }
    }

    return parseInt(sValue);
  }


  // moves the DIV to given left and top position
  function moveDiv(sDivID, sLeft, sTop){
    var	docObj = eval("MM_findObj('" + sDivID + "')"), sSuffix="";
    if (!document.layers) {docObj = docObj.style;} // not NS4.x
    if((parseInt(navigator.appVersion)>4 || navigator.userAgent.indexOf("MSIE")>-1) && (!window.opera)) {sSuffix="px";}
    if (sLeft != "") {eval("docObj.left = '" + sLeft + sSuffix + "'");}
    if (sTop != "") {eval("docObj.top = '" + sTop + sSuffix + "'");}
  }


  // calculates the current position and determines the next position, and thus scroll the DIV
  function scrollDiv() {
    var iArgs = scrollDiv.arguments.length;

    // get the input parameters
    var sContainerDivID = (iArgs > 0) ? scrollDiv.arguments[0] : '';
    var sContentDivID = (iArgs > 1) ? scrollDiv.arguments[1] : '';

    var iStartScrolling = (iArgs > 2) ? parseInt(scrollDiv.arguments[2]) : 1;
    var iPixels = (iArgs > 3) ? parseInt(scrollDiv.arguments[3]) : 1;
    var iDelay = (iArgs > 4) ? parseInt(scrollDiv.arguments[4]) : 50;
    var scrollLeftOrTop = (iArgs > 5) ? scrollDiv.arguments[5] : 'LEFT';

    var docObj = MM_findObj(sContainerDivID);
    if (!docObj) {return;}
    if (docObj.scrollTimeout != null) {
      clearTimeout(docObj.scrollTimeout);
    }

    // get the current left and top
    var iCurrentLeft = getDivPositionValue(sContentDivID, 'left');
    var iCurrentTop = getDivPositionValue(sContentDivID, 'top');

    // get the position to scroll until, AND,
    //                  to start scrolling after completing the cycle.
    // this will be the container's width/height
     if ( scrollLeftOrTop == 'LEFT' ){
      var iScrollLeft = (-1 * getDivPositionValue(sContentDivID, 'width'));
      var iScrollRight = getDivPositionValue(sContainerDivID, 'width');
    } else{
      var iScrollTop = (-1 * getDivPositionValue(sContentDivID, 'height'));
      var iScrollBottom = getDivPositionValue(sContainerDivID, 'height');
    }

/*
       window.status = scrollLeftOrTop +
                    "; CurrentLeft = " + iCurrentLeft +
                    "; CurrentTop = " + iCurrentTop +
                    "; iScrollTop = " + iScrollTop +
                    "; iScrollLeft = " + iScrollLeft +
                    "; iScrollRight = "+iScrollRight +
                    "; iScrollBottom = "+iScrollBottom ;
*/
    if (iStartScrolling){
      if ( scrollLeftOrTop == 'LEFT' ){
        if (iCurrentLeft >= iScrollLeft){
          // scroll to left
          moveDiv(sContentDivID, String(iCurrentLeft-iPixels), String(iCurrentTop));
        } else{
          // Re-position scrolling layer at right end of containing layer
          moveDiv(sContentDivID, String(iScrollRight), String(iCurrentTop));
        }
      } else{

        if (iCurrentTop >= iScrollTop){
          // scroll to top
          moveDiv(sContentDivID, String(iCurrentLeft), String(iCurrentTop-iPixels));
        } else{
          // Re-position scrolling layer at bottom of containing layer
          moveDiv(sContentDivID, String(iCurrentLeft), String(iScrollBottom));
        }
      }
      // continue scrolling after a delay
      docObj.scrollTimeout = setTimeout("scrollDiv('" + sContainerDivID +"','"+ sContentDivID +
"'," + iStartScrolling + "," + iPixels + "," + iDelay + ",'" + scrollLeftOrTop + "')", iDelay);
    }
  }
/////////////////coding for scrolling marquee ends here/////////////////


// methods to be called onLoad() of the page
function pageLoad(ep_code){
  // scroll woonwijzer businesses
  scrollDiv('WoonwijzerScrollContainer','WoonwijzerScrollContent',1,2,50,'TOP');

  // resize the content, as the table does not fit all the images,
  // as they take more time to load.
  if(browser=="IE"){
    var docObj = MM_findObj('PrdTipScrollContent');
    if (!docObj){
      return;
    }

    var tempHeight=PrdTipScrollContent.style.height;
    PrdTipScrollContent.style.height=0;
    PrdTipScrollContent.style.height=tempHeight;
  }

  // scroll product tips
  scrollDiv('PrdTipScrollContainer','PrdTipScrollContent',1,2,50,'TOP');
}


function getLabel(value){
  return labelArray[findIndex(value)+1];
}

function writeLabel(value){
  document.write( getLabel(value) );
}

function findIndex(value){
  for(var i=1; i<labelArray.length; i+=2){
    if(labelArray[i] == value){
      return i;
    }
  }
  return -1;
}

function makeArray() {
  for (var i = 0; i<makeArray.arguments.length; i++)
    this[i + 1] = makeArray.arguments[i];
}

function printDateTime(datetime) {
  var months = new makeArray('Januari','Februari','Maart',
                             'April','May','Juni','Juli','Augustus','September',
                             'Oktober','November','December');

  var datetimeobj = datetime.split(' ');
  var date = datetimeobj[0];
  var time = datetimeobj[1];

  var dateobj = date .split('-');
  var day  = Number(dateobj[2]);
  var month = Number(dateobj[1]);
  var yy = dateobj[0];
  var year = (yy < 1000) ? yy + 1900 : yy;

  document.write(day + " " + months[month] + " " + year + " " + time );
}

function printDate(date) {
  var months = new makeArray('Januari','Februari','Maart',
                             'April','May','Juni','Juli','Augustus','September',
                             'Oktober','November','December');

  var dateobj = date.split('/');
  var day  = Number(dateobj[1]);
  var month = Number(dateobj[0]);
  var yy = dateobj[2];
  var year = (yy < 1000) ? yy + 1900 : yy;

  document.write(day + " " + months[month] + " " + year);
}


var preloadFlag = false;
function preloadImages() {
  if(document.images) {

     mover_bouwen_index    = newImage("http://www.allesover-trouwen.nl/images/mover_bouwen_index.gif");
     mover_badkamer_index  = newImage("http://www.allesover-trouwen.nl/images/mover_badkamer_index.gif");
     mover_diverse_index   = newImage("http://www.allesover-trouwen.nl/images/mover_diverse_index.gif");
     mover_interieur_index = newImage("http://www.allesover-trouwen.nl/images/mover_interieur_index.gif");
     mover_keuken_index    = newImage("http://www.allesover-trouwen.nl/images/mover_keuken_index.gif");
     mover_tuin_index      = newImage("http://www.allesover-trouwen.nl/images/mover_tuin_index.gif");
     preloadFlag = true;
  }
}

function changeImages() {
  if (document.images && (preloadFlag == true)) {
      for (var i=0; i<changeImages.arguments.length; i+=2) {
	   document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
      }
  }
}


function newImage(arg) {
  if( document.images) {
     rslt = new Image();
     rslt.src = arg;
     return rslt;
  }
}

function loadPage(url){
  location.href = url;
}

function validateSearchForm(){
  if(document.searchForm.criteria.value.length <2) {
 	  alert(getLabel('search_bar_3'));
 	  return false;
   }else{
 	  document.searchForm.ww_keywords.value = document.searchForm.criteria.value;
 	  document.searchForm.submit();
   }
}