function Trim(myval)
{
	var chklen=myval.length; 
	var pos=0;
	mychar = myval.charAt(0);

	while(pos>=0 || lstpos >=0)
	{
		pos=myval.indexOf(" ");
		if (pos==0)
		{
			myval=myval.substring(1,chklen);
			chklen = myval.length;
			mychar = myval.charAt(0);
		}
		lstpos=myval.lastIndexOf(" ");

		if (lstpos==chklen-1)
		{	
			myval=myval.substring(0,chklen-1);
			chklen=myval.length;
			mychar = myval.charAt(chklen-1);
		}
		
		if(mychar!=" ")
			break;

	}
	return myval;			
}

function isRequired(formObject, fieldDescription) 
	{	

	var tempFormValue ;
	var strError ="";	
	var iFocus =-1;
	for (var i =0; i< isRequired.arguments.length;i=i+3)
	{
		tempFormValue =isRequired.arguments[i].value;
		if (tempFormValue.length < 15)
			{deleteLoop = tempFormValue.length}
		else
			{deleteLoop = 15}

		for (var j = 0; j < deleteLoop; j++) 
 			{tempFormValue = tempFormValue.replace(/ / , "");}	
	
		if (tempFormValue.length == 0){	
			strError = strError+ isRequired.arguments[i+2] + "\n"
			if (iFocus ==-1)
				iFocus = i;
		}
	}
	if (strError.length != 0){	
		alert( 'Following fields are required.\n\n' + strError)
			isRequired.arguments[iFocus+1].focus();
		return(false);
	}
	else
		return(true);
	}
function isEmail(oComp)
	{
	IsItReal	=	oComp.value ;
	if (typeof(IsItReal) != "undefined")
	{
	IsItReal = IsItReal.match(/(\w+)@(.+)\.(\w+)$/);

	if (IsItReal !=null)
		{
		if ((IsItReal[3].length==2) || (IsItReal[3].length==3))
			return true;
		}
		
	}
	oComp.focus();	
	return false;
	}
	function checkInt(a)
	{
		if (a.split(" ").join("").length ==0)
		{
			return false;
		}
		var Anum = "0123456789";
		for (i=0;i<a.length;i++)
		{
			if (Anum.indexOf(a.substr(i,1)) == -1)
			{
				//alert(Anum.indexOf(a.substr(i,1)) + "," + a.substr(i,1));
				return false;
			}
			
		}
		return true;
	}
function checkbox(checkobject)
{
	var i;
	i=0;
	for(i=0;i<checkobject.length;i++)
	{
		if(checkobject[i].checked==true)
		{
			return true;
		}
	}
	return false;
}
