function popupIsOpen() {
	return (typeof(popupWin) == 'object') && popupWin.open && !popupWin.closed;
}
function popup(o, width, height) {
	if(popupIsOpen() && (popupWin.type != 'standard')) popupWin.close();
	popupWin = window.open(o.href, "edelman_popup",'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height);
	popupWin.focus();
	popupWin.type = 'standard';
	return false;
}

function popupEvent(o, width, height) {
	if(popupIsOpen() && (popupWin.type != 'standard')) popupWin.close();
	popupWin = window.open(o.href, "edelman_popup",'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+width+',height='+height);
	popupWin.focus();
	popupWin.type = 'standard';
	return false;
}

function popupSitemap(o) {
	return popup(o, 550, 550);
}

function popupPortfolio(o) {
	if(popupIsOpen() && (popupWin.type != 'portfolio')) popupWin.close();
	popupWin = window.open(o.href, "edelman_popup",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=700,height=490');
	popupWin.focus();
	popupWin.type = 'portfolio';
	return false;
}
popupTimeline = popupPortfolio;

function popup_noscroll(o, width, height) {
	if(popupIsOpen() && (popupWin.type != 'noscroll')) popupWin.close();
	popupWin = window.open(o.href, "edelman_popup",'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+width+',height='+height);
	popupWin.focus();
	popupWin.type = 'noscroll';
	return false;
}
//
function submitSearch() {
	var s = document.getElementById("in").value;
	if(s.length < 3) return;
	document.search.submit();
}
	
// basic window.onload broadcaster

_listeners = [];
function addListener(o) {
	_listeners[_listeners.length] = o;
}
function broadcastMessage(msg) {
	for(var i = 0; i < _listeners.length; i++) {
		_listeners[i][msg]();
	}
}
window.onload = function() {
	broadcastMessage('onload');
}
