function invertAllCheckboxes(input, container) {
	$(container + " input[type='checkbox']").each(function(){
		this.checked = !this.checked;
	});
}

function showConfirm() {
	
}

function showAlert() {
	
}

function showError() {
	
}

function insertCommas(num) {
	var pos = num.length;
	var a = "";
	var b = "";
	while(pos - 3 > 0) {
		pos =  pos - 3;
		a = num.substring(0, pos);
		b = num.substring(pos, num.length);
		num = a + "," + b;
	}
	return num;
}

function replaceBR(inputString) {
	var regex = /<br>|<br\/>/gi;
	s = new String(inputString);
	s = s.replace(regex, "\n");
	return s;
}

function insertBR(inputString) {
	var regex = /\n/gi;
	s = new String(inputString);
	s = s.replace(regex, "<br>");
	return s;
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


function popup(mylink, windowname, width, height)
{
	if (! window.focus)
		return true;

	var href;
	if (typeof(mylink) == 'string')
		href=mylink;
	else
		href=mylink.href;
	window.open(href, windowname, 'width='+width+',height='+height+',scrollbars=yes');
	return false;
}
