function popup(url, w, h) {
	window.open(url, 'popup', 'width=' + w + ',height=' + h + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=0');
}

/*
function remove_cat(sel) {
	if (confirm('Remove the selected category?')) {
		sel.options[sel.selectedIndex] = null;
	}
	return false;
}

function add_cat(name, value) {
	sel = document.form1.categories;
	sel.options[sel.length] = new Option(name, value, false, 
false);
}
*/

function selectAllCats() {
	for (a=0; a < document.form1.categories.options.length; a++) {
		document.form1.categories.options[a].selected = true;
	}
}

function confirmDelete() {
	if (confirm('Permanently delete this entry?')) return true;
	else return false;
}

var monthNames = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
function checkDate(el) {
	if (el.value != '') {
		var tmp = new Date(el.value);
		if (!isNaN(tmp)) el.value = tmp.getDate() + ' ' + monthNames[tmp.getMonth()] + ' ' + tmp.getFullYear();
		else {
			alert('Dates must be given in the format "1 Jan 2003".');
		}
	}
}

function setRadio(name, value) {
   eval('document.form1.' + name + '[' + value + '].checked = true');
}

function limitChars(el, limit) {
   if (el.value.length > limit) {
      el.value = el.value.substr(0, limit);
      alert('Note: This box can contain up to ' + limit + ' characters only.');
   }
}
