// set status message
window.defaultStatus = "Centraal Beheer Achmea"
var childWindow = null;
var targetUrl = null;

//--------------------
function launchPop(url){
	newWindow(url,560,580,'preview','toolbar=no,status=yes,resizable=no,scrollbars=yes');
	hidePopupInfo();
}


function showPopupInfo()
	{
		//var targetUrl = "http://www.ussr.nl";
		var openerLink = document.getElementById("windowOpener");
		openerLink.href = "javascript:launchPop('"+ targetUrl +"');"

		var popupInfo = document.getElementById("popupInfo");
		popupInfo.style.top = Math.round(document.body.clientHeight / 2 - popupInfo.offsetHeight / 2) + "px";
		popupInfo.style.left = Math.round(document.body.clientWidth / 2 - popupInfo.offsetWidth / 2) + "px";
		popupInfo.style.visibility = "visible";
	}
	
function launchPreview(url)
	{
		targetUrl = url;
		childWindow = newWindow(url,560,580,'preview','toolbar=no,status=yes,resizable=no,scrollbars=yes');
		setTimeout(checkChildWindow, 500);

	}
	
function hidePopupInfo()
	{
		var popupInfo = document.getElementById("popupInfo");
		popupInfo.style.visibility = "hidden";
	}
	
function checkChildWindow()
	{
		//alert(popupHandle);
		if (popupHandle == null)
			showPopupInfo();
		else
			popupHandle.focus();
	}

//--------------------

function res(){ // resize the window to max onLoad
	self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
}

//--------------------

function newWindow(url,width,height,name,props){ // default popup script
  if(!props){
  	var properties = "width="+width+",height="+height+",toolbar=no,status=no,resizable=yes,scrollbars=yes";
 }else{
   var properties = "width="+width+",height="+height+","+props;
 }
  	var screenY = window.screen.availHeight;
  	var screenX = window.screen.availWidth;
  	var leftvar = Math.round((screenX - width) / 2);
  	var rightvar = Math.round((screenY - height) / 2);
  	properties += ",left=" + leftvar +",top=" + rightvar;
 
	popupHandle = window.open(url,name, properties);
	
}