	var iDuration = 0;
	var myImage = new Image();
	var sCurrentPageId = '';
	var sProfileId = '';
	var sEditionId = '';
	var d=document,w=window;
		
	function _(name) {
		return document.getElementById (name);
	}
		
	function loadImage(p_sParameters) {
		myImage.src = "http://www.bomvol.com/sc/engine.php?" + p_sParameters;
		return false;
	}

	function saveData(p_sParameters) {
		loadImage(p_sParameters);
		var a =0;
		for (var i=0; i < 200000; i++) {
			a = Math.sin(i);
		}
	}
	
	function update_last_duration(p_iDuration, p_sCurrentPageId, p_sProfileId, p_sEditionId) {
		iDuration = p_iDuration;
		sCurrentPageId = p_sCurrentPageId;
		sProfileId = p_sProfileId;
		sEditionId = p_sEditionId;
	}
	
	function bunload(p_origin){ 
		var sParameters = "comm=page_click&" + "&dura=" + iDuration + "&lpid=" + sCurrentPageId + "&cpid=0&prof=" + sProfileId + "&edid=" + sEditionId;	// van huidig naar 0
		saveData(sParameters);
		return false;
	} 
	
	function openMag2()
	{
		var url = "lpv2.php?popup=true";
	
		var win_handler = window.open(url, "Bomvol", "scrollbars=no,fullscreen=yes,resizable=yes");
		
		if (win_handler==null || typeof(win_handler)=="undefined") {
			if (_('bomvol') && _('bomvol').showFeedBack) {
				_('bomvol').showFeedBack ('popupBlocker');
			}
		}
		
		win_handler.focus();
		
	}
	
	function openMag(){
	
		// get anchor
		parts = document.location.href.split('#');
		
		var anchors = '';
		var url = '';
		
		if (parts.length == 2) // we've got  a #
		{
		
			anchors = parts[1];
			
			// anchor may or may not have a leading /
			if (anchors.substr(0,1)=='/') {
				anchors = anchors.substr(1,anchors.length);
			}
			
			parts = anchors.split('/');
			
			var edition = parts[0];
			var spread = parts[1];
		
//			var url = '?popup#' + edition + '/' + spread;
			
			anchors = '#' + edition + '/' + spread;
		}

		// get querystring
		parts = document.location.href.split('?');
		
		if (parts.length == 2) // we've got a ?
		{
			
			var qs = parts[1];
			
			if (anchors != '') // we've got anchors
			{
				parts = qs.split ('#');
				qs = parts[0];
			}
			
		}

		url = '?popup&' + qs + anchors;

		var win_handler = window.open(url, "Bomvol", "scrollbars=no,fullscreen=yes,resizable=yes");
		
		if (win_handler==null || typeof(win_handler)=="undefined") {
			if (_('bomvol') && _('bomvol').showFeedBack) {
				_('bomvol').showFeedBack ('popupBlocker');
			}
		}
		
		win_handler.focus();
	}
	
	function openSeat()
	{
		var win_handler = window.open("http://www.bomvol.com/?fromemail&popup#/13/5", "Bomvol", "scrollbars=no,fullscreen=yes,resizable=yes");
		
		if (win_handler==null || typeof(win_handler)=="undefined") {
			if (_('bomvol') && _('bomvol').showFeedBack) {
				_('bomvol').showFeedBack ('popupBlocker');
			}
		}
		
		win_handler.focus();
	}
	
	function createXMLHTTPObject () {
		var xmlhttp=null;
	    if(window.XMLHttpRequest){
	        xmlhttp = new XMLHttpRequest();
	    }else{
	        try{
	            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	        }catch(e){
	            window.alert("Uw browser ondersteunt het XMLHttpRequest object niet!");
	        }
	    }
	    return xmlhttp;
	}