function init_page( ) {

  scale_background();

  // png fix
  if ( typeof(pngfix) == 'function' ) {
    pngfix();
  }

}

function open_window( url, width, height, left, top, extra_params ) {

  extra_params = extra_params || 'dependent=no,directories=no,location=no,menubar=no,personalbar=no,status=no,resizable=yes,scrollbars=yes';
  width  = width  || 450;
  height = height || 600;
  if ( !left && !top ) {
    var screenX = 30; var screenY = 30; var screenTop = 30; var screenLeft = 30;
    if ( typeof(window.screenLeft) != 'undefined' ) {
    	left = screenLeft + window.screenLeft;
    	top	 = screenTop + window.screenTop;
    } else {
    	left = screenX + window.screenX;
    	top	 = screenY + window.screenY;
    }
  }

  window.open( url, 'popupWindow', 'width='+width+',height='+height+',left='+left+',top='+top+','+extra_params);

}

function scale_background() {

  var org_width = 1280, org_height = 760;

  var width = self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
  var height = self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);

  if ( width / height > org_width / org_height ) {
    height = Math.round( ( width / org_width ) * org_height );
  } else {
    width = Math.round( ( height / org_height ) * org_width );
  }

  document.getElementById('background_container').style.width  = width  + 'px';
  document.getElementById('background_container').style.height = height + 'px';
  document.getElementById('background_raster').style.width	= width	 + 'px';
	document.getElementById('background_raster').style.height = height + 'px';

  document.getElementById('page_container').style.zIndex = '1000';
  document.getElementById('page_positioner').style.zIndex = '1000';
  document.getElementById('page_positioner').style.top  = '0px';
  document.getElementById('page_positioner').style.left = '0px';
  document.getElementById('background_container').style.zIndex = '1';

}

function ignore_mouse_down(e) {
  e = (e) ? e : window.event;
  target = e.target || e.srcElement;

 
  return false;

}

function toggle_disclaimer() {
  if ( document.getElementById('disclaimer').style.display == 'block' ) {
    document.getElementById('disclaimer').style.display = 'none';
  } else {
    document.getElementById('disclaimer').style.display = 'block';
  }
}

function toggle_privacy_statement() {
  if ( document.getElementById('privacy_statement').style.display == 'block' ) {
    document.getElementById('privacy_statement').style.display = 'none';
  } else {
    document.getElementById('privacy_statement').style.display = 'block';
  }
}


function toggle_help_vragen() {
  if ( document.getElementById('help_vragen').style.display == 'block' ) {
    document.getElementById('help_vragen').style.display = 'none';
  } else {
    document.getElementById('help_vragen').style.display = 'block';
  }
}

function toggle_help_resultaat() {
  if ( document.getElementById('help_resultaat').style.display == 'block' ) {
    document.getElementById('help_resultaat').style.display = 'none';
  } else {
    document.getElementById('help_resultaat').style.display = 'block';
  }
}

function toggle_waaromdecultuurwijzer() {
  if ( document.getElementById('waaromdecultuurwijzer').style.display == 'block' ) {
    document.getElementById('waaromdecultuurwijzer').style.display = 'none';
  } else {
    document.getElementById('waaromdecultuurwijzer').style.display = 'block';
  }
}



function show_pleasewait() {
	document.getElementById('pleasewait_layer').style.height = getPageSizeWithScroll()[1] + 'px';
	document.getElementById('pleasewait_bgimage').style.height = getPageSizeWithScroll()[1] + 'px';
	document.getElementById('pleasewait_layer').style.visibility = 'visible';
}

function hide_pleasewait() {
	document.getElementById('pleasewait_layer').style.visibility = 'hidden';
}

// van http://codylindley.com/Webdev/295/javascript-get-page-height-with-scroll
function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}
