function showGmPopup() {
	$('#data_layover_bg').css('display', 'block');
	
	iframe_test = document.getElementById('googlemap_iframe');
	
	if(typeof iframe_test.contentWindow != 'undefined') {
		// Voor de rest
		iframe_test.contentWindow.initialize();
	} else {
		// Voor IE6
		document.frames.googlemap_iframe.window.execScript("initialize()", "JavaScript");
	}
}


function hideMyGmPopUp() {
	$('#data_layover_bg, #nvs_overlay, #btn-close').unbind();
	$.nvsOverlay.hide();
	$('#data_layover_bg').css('display', 'none');
}

function init_datalayover() {
	$('#show_data').click(function(){
		//this.blur();
		$.nvsOverlay.show({speed: 500, transparancy: 0.9, callback: function() {
			// bind click functie
			$('#nvs_overlay').unbind('click');
			$("#nvs_overlay").bind("click", function() { hideMyGmPopUp() });
		} });
		showGmPopup();
	 	$("#data_layover_bg, #data_btn-close").bind("click", function() { hideMyGmPopUp() });
	});
}

function showGmPopup_vanuit_flash() {
	$.nvsOverlay.show({speed: 500, transparancy: 0.9, callback: function() {
		// bind click functie
		 $("#nvs_overlay").bind("click", function() { hideMyGmPopUp() });
	} });
	showGmPopup();
 	$("#data_layover_bg, #data_btn-close").bind("click", function() { hideMyGmPopUp() });
}


/* Virtual tour viewer */

function hideVTview() {
	$('#nvs_overlay').unbind('click');
	$('#VirtualTour').remove();
	$.nvsOverlay.hide();
}

function showVTview(url) {
	$.nvsOverlay.show({speed: 500, transparancy: 0.9, callback: function() {
		$('<div></div>').attr({
			id: 'VirtualTour'
		}).css({
			position: 'absolute',
			zIndex: 10000,
			width: '100%',
			top: '40px',
			left: '0px',
			textAlign: 'center'
		}).appendTo('body').bind("click", function() { hideVTview(); })
	
		$('<div></div>').attr({
			id: 'VirtualTour_bg'
		}).css({
			position: 'relative',
			background: 'transparent url(/img/photo_layover_bg.png) no-repeat',
			height: '504px',
			width: '557px',
			margin: '0 auto',
			padding: '20px 0 20px 20px',
			textAlign: 'left'
		}).appendTo('#VirtualTour').bind("click", function() { return false; });

		$('<div></div>').attr({
			id: 'VirtualTour_end'
		}).css({
			position: 'absolute',
			height: '544px',
			width: '20px',
			background: 'transparent url(/img/photo_layover_end_bg.png) no-repeat top right',
			right: '-19px',
			top: '0px'
		}).appendTo('#VirtualTour_bg').bind("click", function() { return false; });
		
		$('<img></img>').attr({
			alt: 'X',
			title: 'X',
			src : '/img/photo_layover_close-btn.gif' 
		}).css({
			position: 'absolute',
			bottom: '20px',
			right: '10px',
			cursor: 'pointer'
		}).appendTo('#VirtualTour_bg').bind("click", function() { hideVTview(); });
			
		$('<iframe></iframe>').attr({
			id: 'VirtualTourFrame',
			width: '557',
			height: '474',
			src : url,
			border: '0',
			frameborder: '0',
			scrolling: 'no',
			overflow: 'hidden'
		}).appendTo('#VirtualTour_bg');

	} });	
	
	$('#nvs_overlay').bind("click", function() { hideVTview(); })
}
