function funcTrim(paramText)
{
	var strText=new String(paramText);
	var strReturnText;
	strReturnText="";
	bNonBlankStarted=false;
	bNonBlankEnded=false;
	strIntermediateBlankChunk="";
	var iLoop;
	for(iLoop=0;iLoop<strText.length;iLoop++)
	{
		if(strText.charCodeAt(iLoop)!=32)
		{
			if(!bNonBlankStarted)
			{
				bNonBlankStarted=true;
			}
			if(bNonBlankStarted && !bNonBlankEnded)
			{
				strReturnText+=strText.charAt(iLoop);
			}
			if(bNonBlankEnded)
			{
				strReturnText+=(strIntermediateBlankChunk+strText.charAt(iLoop));
				bNonBlankEnded=false;
				strIntermediateBlankChunk="";
			}
		}
		else
		{
			if(bNonBlankStarted)
			{
				bNonBlankEnded=true;
				strIntermediateBlankChunk+=" ";
			}
		}
	}
	return strReturnText;
}
//to check Numeric
function funcIsNumeric(paramText)
{
	if(!isNaN(paramText))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//to check give email is valid or not
function funcIsEmail(param_email)
{
	var str_current_character;
	var b_valid_email,b_period_present; 
	var i_last_position_of_period,b_correct_length_extension;
	var i_num_at_symbol=0;
	var i_pos_at_symbol;
	var i_length_of_server_name=1;
	var i_pos_consecutive_dots;
	var str_email=new String(funcTrim(param_email));
	i_length=str_email.length;
	b_period_present=1;
	b_correct_length_extension=1;
	i_last_position_of_period=0;
	
	if(i_length==0)
	{
		return true;
	}
	
	for(i_loop=0; i_loop<i_length; i_loop++)
	{
		if(!((str_email.charCodeAt(i_loop)>=65 && str_email.charCodeAt(i_loop)<=90)
		  || (str_email.charCodeAt(i_loop)>=97 && str_email.charCodeAt(i_loop)<=122)
		  || (str_email.charCodeAt(i_loop)>=48 && str_email.charCodeAt(i_loop)<=57)
		  || (str_email.charAt(i_loop)=="@")
		  || (str_email.charAt(i_loop)=="_")
		  || (str_email.charAt(i_loop)=="-")
		  || (str_email.charAt(i_loop)==".")))
		{
			return false;
		}
	}
	
	i_pos_consecutive_dots=str_email.indexOf('..');
	if(i_pos_consecutive_dots!=-1)
	{
		return false;
	}
	
	var i_pos_space;
	i_pos_space = str_email.indexOf(' ');
	if(i_pos_space!=-1)
	{
		return false;
	}
	
	i_last_position_of_period = str_email.lastIndexOf('.');
	if(i_last_position_of_period<=0)
	{
		b_period_present=0;
	}
	
	if(((i_length-i_last_position_of_period)>4) || ((i_length-i_last_position_of_period)<3))
	{
		b_correct_length_extension=0;
	}
	
	for(i_loop=0;i_loop<=i_length;i_loop++)
	{
		str_current_character=str_email.charAt(i_loop);
		if (str_current_character=='@')
		{
			i_num_at_symbol=i_num_at_symbol + 1;
		}
	}
	
	if(i_num_at_symbol!=1)
	{
		return false;
	}
	
	i_pos_at_symbol = str_email.indexOf('@');
	if(str_email.charAt(i_pos_at_symbol+1) == '.')
	{
		i_length_of_server_name=0;
	}
	
	if((i_num_at_symbol==1) && (b_period_present==1) && (b_correct_length_extension==1) && (i_length_of_server_name==1))
	{
		b_valid_email=1;
	}
	else
	{
		 b_valid_email=0;
	}
	
	if(b_valid_email==0)
	{
		return false;
	}
	else
	{
		return true;
	}
}