﻿function printPage() {
  window.document.forms['frm_print'].action = "printObject.aspx";
	window.document.forms['frm_print'].elements['fld_print'].value = document.getElementById('divPrint').innerHTML;
	window.document.forms['frm_print'].submit();
	return;
}

function scrollLogo() {
  var logo = document.getElementById("logo");
  var spacer = document.getElementById("lmenuspacer");
  if (logo && spacer) {
    var scroll = (window.pageYOffset) ? window.pageYOffset : document.documentElement.scrollTop;
    var height = (window.innerHeight) ? window.innerHeight : document.documentElement.clientHeight;
    var margin = (height + scroll - spacer.offsetTop - 151 - 285);
    
    if (margin > 0) {
      logo.style.marginTop = margin + "px";
    } else {
      logo.style.marginTop = 0;
    }
  }
}
window.onresize = scrollLogo;
window.onscroll = scrollLogo;

function openWindow(url) {	
  var width = 800;	
  var height = 600;	

  var x = (800 - width)/2;	
  var y = (600 - height)/2;	  

  if (screen) {      
    y = (screen.availHeight - height)/2;      
    x = (screen.availWidth - width)/2;  
  }    
  window.open(url,"","status=no,scrollbars=yes,menubar=no,width=800,height=600 top="+y+",left="+x);
}

function showRoute(url) {	
  var width = 800;	
  var height = 600;	

  var x = (800 - width)/2;	
  var y = (600 - height)/2;	  

  if (screen) {      
    y = (screen.availHeight - height)/2;      
    x = (screen.availWidth - width)/2;  
  }    
  window.open("http://tools.locatienet.com/location/map.asp?config_id=7432&language=dutch&address=" + url + "&zoom=2&markertext=Vestiging%20Trip&bgcolor=%23319CCE&speedprofile=1","","status=no,scrollbars=yes,menubar=no,width=700,height=500 top="+y+",left="+x);
}

var adv = null;
function init() {
  adv = document.getElementById("adv");
  if (adv) {
    window.setInterval(flipAdvert, 5000);
  }
  scrollLogo();
}
    
function flipAdvert() {
  var item = 0;
  var rand = Math.ceil(Math.random() * 7);
  for (var i=0; i < adv.childNodes.length; i++) {
    if (adv.childNodes[i].tagName == "DIV") {
      item++;
      for (var j=0; j < adv.childNodes[i].childNodes.length; j++) {
        if (adv.childNodes[i].childNodes[j].tagName == "DIV") {
          if (rand == item) {
            adv.childNodes[i].childNodes[j].style.display = "block";
          } else {
            adv.childNodes[i].childNodes[j].style.display = "none";
          }
        }
      }          
    }
  }
}