function ValidateCheckbox(e, msg) {
	var b = false;
	for (var i=0; i<e.length; i++) {
		if (e[i].checked) {
			b = true;
			break;
		}
	}
	if (!b) {
		alert(msg);
		return false;
	}
	return true;
}

function ValidateRadio(e, msg) {
	var b = false;
	for (var i=0; i<e.length; i++) {
		if (e[i].checked) {
			b = true;
			break;
		}
	}
	if (!b) {
		alert(msg);
		return false;
	}
	return true;
}

function ValidateSelect(e, msg) {
	if (e.selectedIndex==-1 || (e.options[e.selectedIndex].value==0 || e.options[e.selectedIndex].value=='')) {
		alert(msg);
		return false;
	}
	return true;
}
			
function ValidateText(e, msg) {
	if (e.value=='') {
		alert(msg);
		return false;
	}
	return true;
}

function Popup(url, width, height, scrollbar) {
	var width = parseInt(width) + (scrollbar ? 15 : 0);
	var height = parseInt(height);
	
	var features =	'width=' + width + ', height=' + height + ', left=100, top=100, ' +
					'channelmode=no, directories=no, fullscreen=no, location=no, menubar=no, ' +
					'resizable=no, scrollbars=yes, status=no, titlebar=yes, toolbar=no';

	var win = window.open(url, 'popup', features);
	win.moveTo(100, 100);
	return win;
}
