function uitKlap(id) 
{
    var c = document.getElementById(id);
    if (c.className === 'uitklap invisible') 
    {
        c.className = 'uitklap';
    } 
    else 
    {
        c.className = 'uitklap invisible';
    }
}

function popUP(locatie) 
{
  
  var layer = parent.top.document.getElementById("layer");
  var popup = parent.top.document.getElementById("popup");
  
  var size = getPageSize();
  layer.style.height = size[1] + 'px';
  layer.style.width = size[0] + 'px';
  
  var scroll = getScrollXY();   
  scroll[1] = scroll[1] - 225;
  popup.style.marginTop = '' + scroll[1] + 'px';
    
  var html = '<iframe style="float:left;width:637px;height:450px;border:0;padding:0" scrolling="no" src="' + locatie + '"></iframe>'
  popup.innerHTML = html; 
  
  layer.style.display='block';     
  popup.style.display='block';
      
}      

                          
/*
Source: http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
*/

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getPageSize()
{
  var xScroll, yScroll;
  if (window.innerHeight && window.scrollMaxY) {
    xScroll = document.body.scrollWidth;
    yScroll = window.innerHeight + window.scrollMaxY;
  } else if (document.body.scrollHeight > document.body.offsetHeight){
    xScroll = document.body.scrollWidth;
    yScroll = document.body.scrollHeight;
  } else {
    xScroll = document.body.offsetWidth;
    yScroll = document.body.offsetHeight;
  }
  var windowWidth, windowHeight;
  if (self.innerHeight) {
    windowWidth = self.innerWidth;
    windowHeight = self.innerHeight;
  } else if (document.documentElement && document.documentElement.clientHeight) {
    windowWidth = document.documentElement.clientWidth;
    windowHeight = document.documentElement.clientHeight;
  } else if (document.body) {
    windowWidth = document.body.clientWidth;
    windowHeight = document.body.clientHeight;
  }
  if(yScroll < windowHeight){
    pageHeight = windowHeight;
  } else { 
    pageHeight = yScroll;
  }
  if(xScroll < windowWidth){
    pageWidth = windowWidth;
  } else {
    pageWidth = xScroll;
  }
  arrayPageSize = new Array(pageWidth,pageHeight) 
  return arrayPageSize;
}   

function closePopUP() 
{
    parent.top.document.getElementById('layer').style.display = 'none';      
    parent.top.document.getElementById('popup').style.display = 'none'; 
}

function checkDate(option)
{
    var begin_day = document.getElementById("begin");
    day1 = begin_day.options[begin_day.selectedIndex].value;
    day1_index = begin_day.selectedIndex; 
    var begin_month = document.getElementById("begin_month");
    month1 = begin_month.options[begin_month.selectedIndex].value;
    month1_index = begin_month.selectedIndex;     
    var begin_year = document.getElementById("begin_year");
    year1 = begin_year.options[begin_year.selectedIndex].value;
    year1_index = begin_year.selectedIndex;
    var begin_hour = document.getElementById("begin_hour");
    hour1 = begin_hour.options[begin_hour.selectedIndex].value;
    var begin_minute = document.getElementById("begin_minute");
    minute1 = begin_minute.options[begin_minute.selectedIndex].value;
    minute1_index = begin_minute.selectedIndex;  

    var end_day = document.getElementById("end_day");
    day2 = end_day.options[end_day.selectedIndex].value;
    var end_month = document.getElementById("end_month");
    month2 = end_month.options[end_month.selectedIndex].value;
    var end_year = document.getElementById("end_year");
    year2 = end_year.options[end_year.selectedIndex].value;
    var end_hour = document.getElementById("end_hour");
    hour2 = end_hour.options[end_hour.selectedIndex].value;
    var end_minute = document.getElementById("end_minute");
    minute2 = end_minute.options[end_minute.selectedIndex].value;

    var datum1 = year1 + month1 + day1 + hour1 + minute1;
    var datum2 = year2 + month2 + day2 + hour2 + minute2;  
    
    if (datum1>datum2) {
        if (option==1) end_day[day1_index].selected = true;
        if (option==2) end_month[month1_index].selected = true;    
        if (option==3) end_year[year1_index].selected = true;  
        if (option==4) {
            end_hour[hour1].selected = true; 
            end_minute[minute1_index].selected = true;    
        }
        if (option==5) end_minute[minute1_index].selected = true;  
    }
}

