function popup(name,page,width,height) {
	if (document.all) {
		var screenwidth = document.body.offsetWidth;
		var screenheight = document.body.offsetHeight;
	} else {
		var screenwidth = window.innerWidth
		var screenheight = window.innerHeight;
	}
	var top= (screenheight - height)/2;
	var left= (screenwidth - width)/2;
	window.open(page,name,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=yes,statusbar=no");
}

var loaded = false;
var alertcontent=null;
function onloadalertit() {
	loaded=true;
	if (alertcontent!=null) {
		alertit(null, alertcontent, null, null);
	}
}

window.doOnLoadFunctions = new Array();
window.doOnLoad = function(functionToAdd) {
	window.doOnLoadFunctions[window.doOnLoadFunctions.length] = functionToAdd;
};
window.onload = function() {
	for(var l = 0; l < window.doOnLoadFunctions.length; l++)
	{
		window.doOnLoadFunctions[l]();
	}
}

window.doOnLoad(onloadalertit);


function alertit(subject,content,width,height) {
	if (loaded) {
		alert(content);
	} else {
		alertcontent=content;
	}
}

function popupNoBorder(name,page,width,height) {
	if (document.all) {
		var screenwidth = document.body.offsetWidth;
		var screenheight = document.body.offsetHeight;
	} else {
		var screenwidth = window.innerWidth
		var screenheight = window.innerHeight;
	}
	var top= (screenheight - height)/2;
	var left= (screenwidth - width)/2;
	window.open(page,name,"top="+top+",left="+left+",width="+width+",height="+height+","+"menubar=no,scrollbars=no,statusbar=no");
}
