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 IsStrictNumeric(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 ValidateEmail(str)
   {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1)
	{
		alert("The eMail address '@' convention appears to be invalid.")
		return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
		alert("The eMail address '@' convention appears to be invalid.")
		return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("The eMail address 'dot' convention appears to be invalid.")
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1)
	{
		alert("The eMail address '@' convention appears to be invalid.")
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	{
		alert("The eMail address 'dot' convention appears to be invalid.")
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1)
	{
		alert("The eMail address 'dot' convention appears to be invalid.")
		return false
	}

	if (str.indexOf(" ")!=-1)
	{
		alert("The eMail address spacing convention appears to be invalid.")
		return false
	}
	
	var testEmailId=new RegExp("[^A-Za-z0-9-_.@_ ]","g");
	if(testEmailId.test(str))
	{
		alert("Please enter a valid Email Id");
		return false;
	}
	return true 
  }
  
  function validDate(d,m,y)
  {
	if(((y%4)==0) && (m==2) && (d>29))
	{
		alert("February contains 29 days")
		return (false);
	}

	if(((y%4)!=0) && (m==2) && (d>28))
	{
		alert("February contains 28 days")
		return (false);
	}
  
	if((m==4 || m==6 || m==9 || m==11) && (d>30))
	{
		alert("Please check your date of birth. Date exceeds number of days in a month");
		return (false);
	}

	var mydate=new Date();
	var cy=mydate.getFullYear();
	var diff=cy-y
	if (diff<17)
	{
		alert("Minimum age should be 18 years");
		return false; 
	}
	return true;
  }
  
  function validateDate(d,m,y)
  {
	if(((y%4)==0) && (m==2) && (d>29))
	{
		alert("February contains 29 days")
		return (false);
	}

	if(((y%4)!=0) && (m==2) && (d>28))
	{
		alert("February contains 28 days")
		return (false);
	}
  
	if((m==4 || m==6 || m==9 || m==11) && (d>30))
	{
		alert("Date exceeds number of days in a month");
		return (false);
	}	
	return true;
  }
  
  function clickButton(e, buttonid){ 
	var evt = e ? e : window.event;
	var bt = document.getElementById(buttonid);
	if (bt){ 
		if (evt.keyCode == 13){ 
		   bt.click(); 
	   return false; 
		}
	 } 
}

