/*************************************************************************
 * MODALBOX CLASS v0.2
 *************************************************************************
 * Reinier van Grieken
 *************************************************************************
 * Laatste wijziging: 23 december 2009
 *************************************************************************
 * TO DO: ?
 *************************************************************************/

 /*************************************************************************
 * class        : ModalBox
 * omschrijving : Class om animaties uit te kunnen voeren.
 * argumenten   : geen
 */
function ModalBox(color,opacity,html) {
	this.blur_id = "modal_overlay";
	this.html_id = "modal_window";
	this.zindex  = 1023;
	this.color   = color;
	this.opacity = opacity;
	this.html    = html;

	var div = document.createElement("div");
	div.id            = this.blur_id;
	div.style.cssText = "position:absolute;z-index:"+this.zindex+";top:0;left:0;width:100%;height:100%;zoom:1;background-color:"+this.color+";opacity:"+(this.opacity/100)+";-moz-opacity:"+(this.opacity/100)+";-khtml-opacity:"+(this.opacity/100)+";filter:alpha(opacity="+this.opacity+");";
	div.style.display = "none";
	document.body.appendChild(div);

	var div = document.createElement("div");
	div.id            = this.html_id;
	div.style.cssText = "position:absolute;z-index:"+(this.zindex+1)+";top:0;left:0;width:100%;height:100%;zoom:1;";
	div.style.display = "none";
	div.innerHTML     = this.html;
	document.body.appendChild(div);
}

ModalBox.prototype.on = function() {
	var div = document.getElementById(this.blur_id);
	div.style.height  = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)+"px"; // voor IE6, om de hele pagina te pakken.
	div.style.display = "block";
	var div = document.getElementById(this.html_id);
	div.style.height  = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)+"px"; // voor IE6, om de hele pagina te pakken.
	div.style.display = "block";
}
ModalBox.prototype.off = function() {
	var div = document.getElementById(this.blur_id);
	div.style.display = "none";
	var div = document.getElementById(this.html_id);
	div.style.display = "none";
}

window.onload = function() {
	modal = new ModalBox("#000",66, '<div style="position:relative;left:50%;margin-left:-348px;width:696px;"><div style="height:26px;text-align:right; background-color:#e4e4e4;"><a href="#" onclick="modal.off(); return false;">sluit</a></div><div style="margin:0 auto;height:650px;"><iframe src="/budgetplanner/" width="696" height="666" frameborder="0" scrolling="no"></iframe></div></div>');
}


