function $(element) {
	if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			elements.push($(arguments[i]));
		return elements;
	} else {
		element = document.getElementById(element);
	}
	return element;
}

function openwindow(page, dialogwidth, dialogheight) {
	dialogheight = parseInt(dialogheight);
	if (dialogheight == NaN)
		dialogheight = 200;

	dialeft = ((screen.width-dialogwidth)/2);
	diatop = ((screen.height-dialogheight)/2);
	
	window.open(page, '', "toolbar=no,scrollbars=yes,location=no,resizable=no,status=no,width="+dialogwidth+",height="+dialogheight+",left="+dialeft+",top="+diatop);
}

function ismaxlength(obj, max){
	if (obj.value.length > max)
		obj.value = obj.value.substring(0, max);
}

