function isEmpty(fld,mesg)
{
	reg = / /g;
	str = fld.value;
	res = str.replace(reg,""); 
	if(res == "")
	{
		alert(mesg);
		fld.value="";
		fld.focus();
		return false;
	}		
	return true;
}

function isNotEmpty(fld)
{
	reg = / /g;
	str = fld.value;
	res = str.replace(reg,""); 
	if(res != "")
	{
		return true;
	}		
	return false;
}

function isNumeric(fld,mesg)
{
	if(isNaN(fld.value))
	{
		alert(mesg);
		fld.select();
		fld.focus();
		return false;
	}
	return true;
}

function isSelected(fld,mesg)
{
	if(fld.selectedIndex==0)
	{
		alert(mesg);
		fld.focus();
		return false;
	}
	return true;
}
function isMultiSelected(fld,mesg)
{
	if(fld.selectedIndex==-1)
	{
		alert(mesg);
		fld.focus();
		return false;
	}
	return true;
}

function isValidEmail(fld,mesg)
{
	bln = false;
	str = fld.value;
	str = str.match(/(\w+)@(.+)\.(\w+)$/);
	if(str!=null)
	{
		if((str[3].length!=2) || (str[3].length!=3))
		{
			bln=true;
		}
	}
	if(!bln)
	{
		alert(mesg)
		fld.select();
		fld.focus();
		return false
	}
	return true;
}

function isValidURL(fld,mesg)
{	
	bln = false;
	str = fld.value;
	str = str.match(/(\w+)\.(.+)\.(\w+)$/);
	if(str!=null)
	{
		if((str[1]=='www') && ((str[3].length==2) || (str[3].length==3)))
		{
			bln=true;
		}
	}
	if(!bln)
	{
		alert(mesg)
		fld.select();
		fld.focus();
		return false
	}
	else
	return true;
}

