function chkEmpty(obj)
{
	temp = obj.value;
	if (temp.length==0)
	{
		alert("This value can't be empty.");
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}

function chkNumber(obj)
{
    temp = obj.value;
    //if(indexOf(" ",temp)<=0 && isNaN(temp))
	if(isNaN(temp))
	{
		alert("This value must be numeric.");
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}

function chkString(obj)
{
	if(isNaN(obj.value)==false)
	{
		alert("This value must not be numeric.");
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}

function chkLessThan(val,obj)
{
	if(obj.value>val)
	{
		alert("This value must less than or equal " + val + ".");
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}

function chkFound(val,objval,obj)
{
	if(val.indexOf(objval)>=0)
	{
		alert("This value must not equal another in list.");
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}

function chkmonth(obj1,obj2)
{
	tmpM1=(obj1.value).substring(0,3);
	tmpM2=(obj2.value).substring(0,3);
	tmpY1=(obj1.value).substring(4,8);
	tmpY2=(obj2.value).substring(4,8);
	arrMonth =new Array();
		arrMonth[1] = "Jan";
		arrMonth[2] = "Feb";
		arrMonth[3] = "Mar";
		arrMonth[4] = "Apr";
		arrMonth[5] = "May";
		arrMonth[6] = "Jun";
		arrMonth[7] = "Jul";
		arrMonth[8] = "Aug";
		arrMonth[9] = "Sep";
		arrMonth[10] = "Oct";
		arrMonth[11] = "Nov";
		arrMonth[12] = "Dec";
	
	for (var i=0;i<13;i++)
	{
		if(arrMonth[i] == tmpM1)
		{
			tmpM1=i;
		}
	}
	for (var i=0;i<13;i++)
	{
		if(arrMonth[i] == tmpM2)
		{
			tmpM2=i;
		}
	}
	
	if(tmpY2 < tmpY1)
	{
		alert("Your selected End of Effective Month must be equal or more than Start of Effective Month.");
		obj2.focus();
		return 0
	}
	else
	{
		if (tmpY2 == tmpY1)
		{
			if (tmpM2 < tmpM1)
			{
				alert("Your selected End of Effective Month must be equal or more than Start of Effective Month.");
				obj2.focus();
				return 0
			}
		}
		return 1
	}
}

function chkNoCmpsAndCmpsInfo(obj1,obj2)
{
	NoCmps=obj1.value;
	CmpsInfo=obj2.value;
	ArrNOCmps=CmpsInfo.split("/");
	var k=0;
	if (ArrNOCmps.length == NoCmps) 
	{
		for (i=0;i<ArrNOCmps.length;i++)
		{	
			ArrTmp=ArrNOCmps[i].split(" ");
			if (ArrTmp[0].length == 0)
			{
				k=k+1;
				alert("This value is invalid format");
				obj2.focus();
				obj2.select();
			}	
		}
	}
	else
	{
		k=k+1;
		alert("No Of Cmps missmatch Cmps Info");
		obj2.focus();
		obj2.select();
		return 0
	}
	if (k==0)
	{
		return 1
	}
}

function chkCmpsInfo(obj1)
{
	CmpsInfo=obj1.value;
	ArrCIF=CmpsInfo.split(" ");
	LenCmpsInfo=ArrCIF[0].length;
	tmp=0;
	for (i=0;i<(LenCmpsInfo);i++)
	{
		if ((isNaN(ArrCIF[0].substring(i,i+1)))&&((ArrCIF[0].substring(i,i+1))!="-") && ((ArrCIF[0].substring(i,i+1))!="/"))
		{
			alert("This value must be '0-9' or '-' or '/'  .");
			obj1.focus();
			obj1.select();
			return 0
		}
		else
		{
			return 1		
		}
	}
}

function chkCredit(obj1)
{
	Credit=obj1.value;
	//alert (Credit.length);
	CreditLen=Credit.length;
	for (i=0;i<(CreditLen);i++)
	{
		//alert(Credit.substring(i,i+1));
		if ((isNaN(Credit.substring(i,i+1)))&&((Credit.substring(i,i+1))!="."))
		{
			alert("This value must be numeric.");
			obj1.focus();
			obj1.select();
			return 0
		}
		else
		{
			return 1		
		}
	}
}

function chkAllEmpty(obj)
{
	temp = obj.value;
	if (temp.length==0)
	{
		obj.focus();
		obj.select();
		return 0
	}
	else
	{
		return 1
	}
}
