<!--
/* FEITEN EN CIJFERS */
function wisselTabel(tabel,report,extra) {
	location.href='default.asp?Entity=feiten_cijfers_detail&entityID='+tabel+'&report='+report+'&r='+extra;
}

function openBron(item) {
	window.open('bron.asp?bron='+item,'bron','width=450px,height=550px,scrollbars=1')
}

function openOpmerkingen(item) {
	window.open('opmerking.asp?tabel='+item,'opmerkingen','width=450px,height=550px,scrollbars=1')
}

function openCategorieTekst(item) {
	window.open('CategorieTekst.asp?categorie='+item,'opmerkingen','width=450px,height=550px,scrollbars=1')
}

function openLeesvoorbeeld() {
	if (document.getElementById('leesvoorbeeld').style.display == 'none' || document.getElementById('leesvoorbeeld').style.display == '')
		document.getElementById('leesvoorbeeld').style.display =  'block';
	else
		document.getElementById('leesvoorbeeld').style.display = 'none';	
}

function openPrintVenster(string) {
	window.open('print.asp?'+string,'printen','width=670px,height=690px,scrollbars=1')
}

function openZoektabelPrintVenster(string) {
	if (string != '' ){
		window.open('zoektabel_print.asp?report_id='+string,'printen','width=670px,height=690px,scrollbars=1')
	}
}

dojo.require("dojo.parser");
dojo.require("dijit.Dialog");
dojo.addOnLoad(function() {
	dojo.body().className = "tundra";
});	

/** Call a Dialog with URL	*/
function popPage (titel,url, idname, onLoadHandler) {
	diag = new dijit.Dialog({href: url, title: titel, id: idname, autofocus: false});

	
	//pas de positie aan.
	diag._endDrag = function(e){
	if(e && e.node && e.node === this.domNode){
	   var p = e._leftTop || dojo.coords(e.node,true);
	   this._relativePosition = { //we don't want our dialog to scroll.
	    t: p.t,
	    l: p.l
	   }   
	   this._firstRun = false;  
	  }
	 }
	  
	 diag._position = function(){
	  if(!dojo.hasClass(dojo.body(),"dojoMove")){
	    
	   var node = this.domNode;
	   if (!this._relativePosition || this._firstRun  ) { 
	    this._firstRun = this._firstRun ? false: true;
	    var viewport = dijit.getViewport();
	    var mb = dojo.marginBox(node);
	    this._relativePosition = {
	      l: Math.floor(viewport.l + ((((viewport.w - mb.w) / 2) < 0) ? 10 : ((viewport.w - mb.w) / 2))),
	      t: Math.floor(viewport.t + ((((viewport.h - mb.h) / 2) < 0) ? 10 : ((viewport.h - mb.h) / 2)))
	    }  
	   }
	   
	   var p = this._relativePosition;
	   dojo.style(node,{
	    left: p.l + "px",
	    top: p.t + "px"
	   });
	  }
	 }
	diag.connect(diag, "onLoad", function() {
		var v = dijit.getViewport();
		var w = (dojo.style(this.containerNode, "width") > v.w) ? v.w - 2 : "auto"; 
		var h = (dojo.style(this.containerNode, "height") > v.h) ? v.h - 2 : "auto";
		dojo.style(this.domNode, {
			width: w,
			height: h
		});
		dojo.style(this.containerNode, {
			width: (w != "auto") ? w-20 : w,
			height: (h != "auto") ? h-50 : h, 
			overflow: "auto"
		});
		var r = this._relativePosition;
		this._relativePosition = {l:w!="auto"?v.l:r.l, t:h!="auto"?v.t:r.t}
	  this._position();
	}); 
	
	diag.connect(diag, "hide", dojo.hitch(diag, function() {this.destroyRecursive();}));
	//diag.connect(diag, "_onBlur", "hide");
	
	if (onLoadHandler) {
		  diag.connect(diag, "onLoad", onLoadHandler); 
	};	
	
	diag.show();
	//console.dir(diag);
}


function fillArchiveinPop(url) {
	window.scrollTo(1,1);
	diag.attr("href", url);
}
// -->