function isEmpty(val)

{

	if (val == '')

		return true;

	else if (trim(val) == '')

		return true;

	else

		return false;

}

function isValidEmail(val) {

	return (val.search(/^.+@[^\.].*\.[a-z]{2,}$/gi) != -1)

}



function isSelectDate(ctrlDD,ctrlMM,ctrlYY)

{



	if (ctrlDD.selectedIndex==0)

		return false;

	else if (ctrlMM.selectedIndex==0)

		return false;

	else if (ctrlYY.selectedIndex==0)

		return false;

	else

		return true;

}



/*--- Begin of date function ---*/

function isLeaveYear(year)

{

	if (year%100 == 0)

	{

		if (year%400 == 0)

			return true;

		else

			return false;

	}

	else if (year%4 == 0)

		return true;

	else

		return false;

}



function isValidDate(imm,idd,iyy)

{

	if (idd<=0)

		return false;

	else if ((imm<1) || (imm>12))

		return false;

	else

	{

		switch (imm)

		{

			case 1:

			case 3:

			case 5:

			case 7:

			case 8:

			case 10:

			case 12:

				if (idd>31)

					return false;

				else

					return true;

			

			case 2:

				if (isLeaveYear(iyy))

				{

					if (idd>29)

						return false;

					else

						return true;

				}

				else

				{

					if (idd>28)

						return false;

					else

						return true;

				}

				

			default:

				if (idd>30)

					return false;

				else

					return true;

		}

	}

}

function isValidControlDate(cmm,cdd,cyy)

{

	return isValidDate(parseInt(cmm.value),parseInt(cdd.value),parseInt(cyy.value));

}

/*--- End of date function ---*/



function isPositiveInteger(s)

{

	var reg = /^\d+$/;

	return reg.test(s);

}



function isCharacter(s)

{

	var reg = /^[a-zA-Z0-9]+$/;

	return reg.test(s);

}



function isZipCode(s) 

{

 

     // Check for correct zip code

     var reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

 

     if (!reZip.test(s)) {

          return false;

     }

 

	return true;

}



function isNumeric(strString)

   //  check for valid numeric strings	

   {

   var strValidChars = "0123456789.-";

   var strChar;

   var blnResult = true;



   if (strString.length == 0) return false;



   //  test strString consists of valid characters listed above

   for (i = 0; i < strString.length && blnResult == true; i++)

      {

      strChar = strString.charAt(i);

      if (strValidChars.indexOf(strChar) == -1)

         {

         blnResult = false;

         }

      }

   return blnResult;

   }
   
function Checknum(len,limit)
{
	if(len == limit){
		return true;
	} else {
		return false;	
	}
	
}

function formatMoney(inum){  
	var n_inum="";
	if(inum!='') {
		var s_inum=new String(inum);
		var num2=s_inum.split(".",s_inum);
		var l_inum=num2[0].length;
		for(i=0;i<l_inum;i++){
			if(parseInt(l_inum-i)%3==0){
				if(i==0){
					n_inum+=s_inum.charAt(i);		
				}else{
					n_inum+=","+s_inum.charAt(i);		
				}	
			}else{
				n_inum+=s_inum.charAt(i);
			}
		}
		if(num2[1]!=undefined){
			n_inum+="."+num2[1];
		}
	}
	return n_inum;
}

function ConvertFloat(number) {
//	alert(number);
	if(number!='0') {
		var val = parseFloat(number.replace(/,/g,""));
	}
	return val;
}




