function disablePage(onclickHandler, zindex, color) {
	// LET OP onclickHandler meegeven ZONDER quotes. HET IS GEEN STRING

	if (!color)
		color = "#222222";

	if (!zindex)
		zindex = 3

	var div = document.createElement('div');
	div.setAttribute("id", "disabled_page_div");
	div.setAttribute("style", "-moz-opacity: .60; opacity: .60;");
	document.body.appendChild(div);

	div.style.display = "block";
	div.style.position = "absolute";
	div.style.zIndex = zindex-0;
	div.style.top = 0;
	div.style.left = 0;
	div.style.backgroundColor = color;
	div.style.filter = "alpha(opacity=60)";

	if (navigator.appName == "Microsoft Internet Explorer") {
		div.style.width = document.documentElement.clientWidth + document.documentElement.scrollLeft + "px";
		div.style.height = document.documentElement.clientHeight + document.documentElement.scrollTop + "px";
		var _docHeight = (document.height !== undefined) ? document.height : document.body.offsetHeight;
		div.style.height = _docHeight+"px";
	} else {
		div.style.height = window.innerHeight + window.scrollMaxY + "px";
		div.style.width = window.innerWidth + window.scrollMaxX + "px";
	}

	

	if (onclickHandler) {
		div.onclick = function () {
			onclickHandler.call();
		}
	}
}

function enablePage() {
	var div = document.getElementById("disabled_page_div");
	document.body.removeChild(div);
}

function insertFirmData(params) {
	if(params["response"] != null) {
		var element = document.getElementById("firmDetails");
		element.innerHTML = "<div style=\"width:95%; float:right; text-align:right;\"><a href=\"javascript:printMemberPopup('firmDetailsInner');\"><img src=\"/designimages/ipg/print.jpg\" alt=\"Print\" title=\"Print\" style=\"margin-right:9px; margin-bottom:5px;\" /></a>&nbsp;<a href=\"javascript:window.parent.closeFirm();\"><img src=\"/designimages/ipg/closelabel.gif\" alt=\"Close\" title=\"Close\" /></a></div><div id=\"firmDetailsInner\">"+params["response"]+"</div>";
	}
}
function showFirm(firmID)  {
	var params = new Array();
	ajaxSendGet("/Membership_Benefits/Show_Member.aspx?action=showMemberClean&firmID="+firmID, insertFirmData, params);
	disablePage(closeFirm);
	openDivPop("firmDetails", 550, 350);
}
function closeFirm() {
	closeDivPop("firmDetails");
	var params = new Array();
	params["response"] = "Loading...";
	insertFirmData(params);
}


function openDivPop(id, divWidth, divHeight) {
	// Width rekenen
	if (!divWidth)
		divWidth = 550;

	width = document.getElementById("containter_main").offsetWidth;

	if (width == 0 || !width)
		width = document.body.offsetWidth;

	if (navigator.appName == 'Microsoft Internet Explorer')
		width = width;
	else
		width = width-40;

	var divLeft = Math.round(width-divWidth);
	divLeft = Math.round(divLeft/2);

	// Height rekenen
	if (!divHeight)
		divHeight = 350;

	height = window.innerHeight;
	if (height == 0 || !height) {
		//height = document.body.offsetHeight;
		height =  document.documentElement.clientHeight;
	}

	// Div aanzetten
	if (!document.getElementById(id)) {
		var popdiv = document.createElement("div");
		popdiv.setAttribute("id", id);
		document.body.appendChild(popdiv);
	}
	
	var divTop = Math.round(height-divHeight);
	divTop = Math.round(divTop/2);

	var element = document.getElementById(id);
	element.style.visibility = 'visible';
	element.style.display = 'block';
	element.style.height = divHeight+"px";
	element.style.width = divWidth+"px";
	element.style.top =  divTop+"px";
	element.style.left= divLeft+"px";
	element.style.opacity = 1;
	element.style.filter = 'alpha(opacity=100)';
}

function closeDivPop(id) {
	document.getElementById(id).style.visibility = 'hidden';
	document.getElementById(id).style.display = 'none';
	enablePage();
}

