function NullValidate(obj,msg)
{
	if (wstrim(obj.value).length == 0) {
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}

function wstrim(str)
{
	while (str.charAt(0) == ' ') str = str.substr(1);
	while (str.charAt(str.length-1) == ' ') str = str.substr(0,str.length-1);
	return str;
}

function isnumeric(str)
{
	for (i=0; i< str.length; i++) {
		ch = str.substr(i,1);
		if (ch < '0' || ch > '9') return false;
	}
	return true;
}

function CheckedRadio(name,msg)
{
	var oc = document.all[name];
	var i,is_ok = false;
	for (i = 0; i < oc.length; i++) {
		if (oc[i].checked) is_ok = true;
	}
	if (!is_ok) {
		alert(msg);
		oc[0].focus();
	}
	return is_ok;
}

function SelectValidate(obj,msg)
{
	if (obj.selectedIndex == 0) {
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}

function MDY4Validate(obj,msg)
{
	var str = obj.value;
	var arr = str.split('/');
	
	if (arr.length != 3) {
		alert(msg);
		obj.focus();
		return false;
	}
	if (arr[0].length != 2 || !isnumeric(arr[0])) {
		alert(msg);
		obj.focus();
		return false;
	}
	if (arr[1].length != 2 || !isnumeric(arr[1])) {
		alert(msg);
		obj.focus();
		return false;
	}
	if (arr[2].length != 4 || !isnumeric(arr[2])) {
		alert(msg);
		obj.focus();
		return false;
	}
	return true;
}