var popup = null;
function thepopup(url) {
	if (popup && !popup.closed) { popup.close() }
	popup = window.open(url,"popup","width=520,height=510,menubar,scrollbars,resizable");
	popup.focus();
	return false;
}

function get_anchors() {
	var anchors = document.getElementsByTagName('a');
	for (var i=0; i<anchors.length; i++) {
		if (anchors[i].getAttribute('type') == 'popup') {
			anchors[i].onclick = function(){ return thepopup(this.href) }
		}
	}
}
window.onload = get_anchors;

///// BALLOT STATUS /////
function get_status(df,sp) {
	var param = 'num=' +df[0].value+ '&dob=' +df[1].value+ '&zip=' +df[2].value;
	if (sp) { param += '&sp=1'; }
	Ajax.getMethod('/cgi-bin/get_ballot.cgi',param);
	return false;
}

function recv(result) {
	var el = document.getElementById('status');
	el.style.background = '#eee';
	el.style.border = '1px solid #aaa';
	el.innerHTML = result;
	return false;
}

function clear_status() {
	var el = document.getElementById('status');
	el.style.background = '#fff';
	el.style.border = '';
	el.innerHTML = '';
}
