
   function isNumeric(text)
   {
		var validchars="0123456789";
		var isnumber=true;
		var Char;
		for(i=0;i<text.length && isnumber==true;i++)
		{
			Char=text.charAt(i);
			if(validchars.indexOf(Char)==-1)
			{
				isnumber=false;
			}
		}
		return isnumber;
   }
   
  function isEmpty(text)
   {
	if((text.length==0)||(text==null))
	{
		return true;
	}   
	else
	{
		return false;
	}
   }
   function isSelect(text)
   {
	if((text.length==0)||(text=="-- Click here to Select the Company --"))
	{
		return true;
	}   
	else
	{
		return false;
	}
   }
   
   function dropdownlist(choice)
   {
		if(choice==0)
		{
			return true;		
		}
		else
		{
			return false;
		}
   }

   function radiobutton(choice)
   {
		if((choice!=0)||(choice!=1))
		{
			return true;		
		}
		else
		{
			return false;
		}
   }
   function dropdownlist1(choice)
   {
		if(choice==-1)
		{
			return true;		
		}
		else
		{
			return false;
		}
   }
   
   function checkmail(email)
   {
		var len=email.length;
		if(len<5)
		{ 
			
			return false;
		}
		else
		{
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
		{ 
			return true;
		}
			return false;
		}
	}
	
	
	function range(text,min,max)
	{
		if((parseFloat(text)<parseFloat(min))||(parseFloat(text)>parseFloat(max)))
		{
			alert("Range must be between 1 and 100");
			return false;
		}
		else
		{
			return true;
		}
	}
	
	
	function validdate(text)
	{
		var datepat=/^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;	
		var matcharry=text.match(datepat);	
		if(matcharry==null)
		{
			/*alert("Date is not in valid Format");*/
			return true;
		}
		month=matcharry[1];
		day=matcharry[3];
		year=matcharry[4];
		if(month<1||month>12)
		{
			alert("Month must be between 1 and 12");
			return true;
		}
		if(day<1||day>31)
		{
			alert("Day must be between 1 and 31");
			return true;
		}
		if((month==4 || month==6 || month==9 || month==11) && day==31)
		{
			alert("Month"+month+" does'nt have 31 days");
			return true;
		}
		if(month==2)
		{
			var isleap=(year%4 == 0 &&(year%100!=0 || year%400 == 0));
			if(day>29 || (day==29 && !isleap))
			{
				alert("February" + " " + year + " " + " " + "does'nt have" + " " + " " + day + " " + "days");
				return true;
			}
		}
	
		return false;
	}
	
	
	function compare(text1,text2)
	{
		var datepat=/^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;
		var matcharry1=text1.match(datepat);
		var matcharry2=text2.match(datepat);

		month1=matcharry1[1];
		day1=matcharry1[3];
		year1=matcharry1[4];

		month2=matcharry2[1];
		day2=matcharry2[3];
		year2=matcharry2[4];
      	
		if(year2<year1)
		{
			alert("end date shud b grtr than start date");	
			return false;
		}
		else if(year2<=year1&&month2<month1)
		{
			alert("end date shud b grtr than start date");
			return false;
		}
		else if(year2<=year1&&month2<=month1&&day2<=day1)
		{ 
			alert("end date shud b grtr than start date");
		return false;
		}
		else
		{
			return true;
		}
	}
	
	
	
	
	function isZipcode(strZip)
	{
		var s = new String(strZip);
		if (s.length != 5 && s.length != 10)
		// inappropriate length
		return true;
		for (var i=0; i < s.length; i++)
		{
		if ((s.charAt(i) < '0' || s.charAt(s) > '9') && s.charAt(i) != '-')
		return true;
		}
		return false;
	}
	
	
	
	function ForceLength(objField, nLength)
	{
	var strField = new String(objField);

	if (strField.length != nLength) 
	{
	return true;
	} 
	else
	{
	return false;
	}

	}



function isInteger(b)
{
var i;
for (i = 4; i <8; i++)
{
// Check that current character is number.
var c = b.charAt(i);
if (((c < "0") || (c > "9"))) 
{
return true;
}
}
// All characters are numbers.
return false;
}




	//function for ascii values
function ascii_value (c)
{
// restrict input to a single character
c = c . charAt (0);

// loop through all possible ASCII values
var i;
for (i = 0; i < 256; ++ i)
{
// convert i into a 2-digit hex string
var h = i . toString (16);
if (h . length == 1)
h = "0" + h;

// insert a % character into the string
h = "%" + h;

// determine the character represented by the escape code
h = unescape (h);

// if the characters match, we've found the ASCII value
if (h == c)
break;
}
return i;
}

//function for triming the textbox value.
function TrimMe(a)
{
var txtObj = document.getElementById(a);
txtObj.value = txtObj.value.replace(/^\s+/,"");
txtObj.value = txtObj.value.replace(/\s+$/,"");
}

//function for prhbiting the neter key press.
function noenter()
{
return !(window.event && window.event.keyCode == 13);
}
	