// JavaScript Document

function checkNull(Obj,Msg)	//value can not be null
{	
	if(Obj.value=="")
	{
		alert(Msg);
		Obj.focus();
		return false;
	}else
	{
		return true;
	}
}
function checkNullNum(Obj,Msg)	//value can not be null and must be numeric
{
	if(Obj.value=="" || isNaN(Obj.value))
	{
		alert(Msg);
		Obj.focus();
		return false;
	}else
	{
		return true;
	}
}
function checkNullNumPos(Obj,Msg)	//value can't be null, must be numeric and more than zero
{
	if(Obj.value=="" || isNaN(Obj.value) || Obj.value <= 0)
	{
		alert(Msg);
		Obj.focus();
		return false;
	}else
	{
		return true;
	}
}
function checkNullNumZero(Obj,Msg)//value can't be null, must be numeric and not negative value (can be zero)
{
	if(Obj.value=="" || isNaN(Obj.value) || Obj.value < 0)
	{
		alert(Msg);
		Obj.focus();
		return false;
	}else
	{
		return true;
	}
}

function deleteconfirm(str,strurl)
{
	if (confirm(str)) 
	{
		this.location=strurl;
	}
}
function emailCheck(Obj)
{
emailStr=Obj.value;

		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
		var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{

			alert("Email address seems incorrect (check @ and .'s)")
            Obj.focus();
			return false
		}
return true;
}
