function ajaxUpdater(url, params, updateID, type) {
	$.ajax({
		type: ((type == "post") ? "post" : "get"),
		processData: true,
		url: url,
		data: params,
		cache: false,
		success: function(data) {
			$("#" + updateID).html(data);
		}
	});
}

function checkAll(type, c) {
	var items = document.getElementsByName(type + '[]');
	for (i = 0; i < items.length; i++) {
		items[i].checked = c;
	}
}

function cursor_wait() {
	document.body.style.cursor = "wait";
}

function cursor_clear() {
	document.body.style.cursor = "default";
}

function highlight(item, is_true) {
	item.className = (is_true) ? "elementError" : "element";
}

function is_email(v) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(v)) {
		return true;
	} else {
		return false;
	}
}

function rand(min, max) {
	var argc = arguments.length;
    if (argc == 0) {
        min = 0;
		max = 2147483647;
    } else if (argc == 1) {
		throw new Error("Warning: rand() expects exactly 2 parameters, 1 given");
    }
    return Math.floor(Math.random() * (max - min + 1)) + min;
}

function reportError(request) {
	$("message") = "Error";
}

function urlencode(str) {
	str = escape(str);
	str = str.replace('+', '%2B');
	str = str.replace('%20', '+');
	str = str.replace('*', '%2A');
	str = str.replace('/', '%2F');
	str = str.replace('@', '%40');
	return str;
}

function viewMap(address, city, state, zip) {
	var height = screen.height - 200;
	var width = (screen.width * 0.75);
	var popup = window.open("http://maps.google.com/maps?f=q&hl=en&geocode=&q=" + address + '+' + city + ',+' + state + '+' + zip + '&ie=UTF8&z=16&iwloc=addr', "popup", "height=" + height + ",left=50,resizable=1,scrollbars=1,status=0,top=50,width=" + width);
	popup.focus();
}