//This is for Validate Number
function validateNumber(objNum)
{
	var num = objNum.value
	var newnum = num;
	if(isNaN(newnum))
	{	 
	     objNum.select();
	     return false	
	}	
	return true
}

//This Function is to get rid of leading and trailing spaces 
function trim(strText)
{ 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
} 

//This Function is for email validation
function EmailVal(email)
{	
	    		
	var EmailId=email.value;
	 if(EmailId!="")	
	  {	
		var len =EmailId.length;
		var str,str1,count=0,indexAt=0
		var str2=EmailId.substring(0,EmailId.indexOf('@',0))
		
		for(i=0;i<len;i++)
		{
			
			if(EmailId.charAt(i)=='@')
			{	
					
					str="yes";
					count=count+1;
					indexAt=i
				
			}
			if(EmailId.charAt(i)=='.')
			{										
					str1="yes";
							
			}
		}		
		
		
		for(j=0;j<str2.length;j++)
		{
			if(str2.charAt(j)=='.')
			{	
						
				str1="no";				
				
			}
		}
		
		if(str!="yes" ||str1!="yes" || count>1 || indexAt==0)
		{			
			email.select();
			return false
		}
	 }	
		
		return true
	}

//This Function is for Checking Blank Fields validation
function isNotEmpty(theobj)
{

	if(theobj.value=="")
	{	
		theobj.focus();
		return false;
	}
 return true;	
}

// This is used for check special characters in string data entered... ****
var TextExp = new RegExp("['`\[\|,!@#$%^&*/?_<>~\+-.{:;(})=]","gi");
function chkValidCharsForTextField(theobj)
{
	if(TextExp.test(theobj.value))
	{
		theobj.value="";
		theobj.focus();
		return false
	}
  return true
}

