// JavaScript Document
<!-- 
function ltrim(str) //Left trim
{ 
	return str.replace(/^[ ]+/, ''); 
} 

function rtrim(str) //Right trim
{ 
	return str.replace(/[ ]+$/, ''); 
} 

function trim(str) //Trim function
{ 
	return ltrim(rtrim(str)); 
} 
function max_chars(str,ctr) //Returns true only if str has less than ctr number of characters.
{ 
	if(str.length<ctr)
	{
	return false;
	}
	return true;
} 
function validate_mail(str)/*E-mail validation in javascript*/
{
		var re = new RegExp(/^[\w\.\-]+\@[\w\.\-]+\.[a-z\.]{2,6}$/);
		if(str.search(re)==-1)
		{
		return false;
		}
		return true;
}

function validate_string(str)/*Allows only alphabets and singlequotes in a string*/
{
		var re = new RegExp(/^[a-zA-Z']+$/);
		if(str.search(re)==-1)
		{
		return false;
		}
		return true;
}
function validate_date(day,mon,year)	//Date validation
{
mon=mon-1;	//Javascript months are in the range 0 to 11
dteDate=new Date(year,mon,day);//Creating a date object
return ((day==dteDate.getDate()) && (mon==dteDate.getMonth()) && (year==dteDate.getFullYear()));// Validates the date
}
function beg_end(str)	//Returns false if the beginning or end characters of str is a white space.
{
	if(str.charAt(0)==' '||str.charAt(str.length-1)==' ')
		{
			return false;
		}
	return true;	
}
//-->