//Function to trim the space in the left side of the string
function ltrim ( s )
{
	return s.replace( /^\s*/, "" );
}
//Function to trim the space in the right side of the string
function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}
//Function to trim the space in the  string
function trim(s)
{
	var temp = s;
   	return temp.replace(/^\s+/,'').replace(/\s+$/,'');
}

//Function to test string passed as argument is integer or not
function isInteger(s)
{
    var i;
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (((c < "0") || (c > "9"))) return false;
	}
    // All characters are numbers.
    return true;
}


function MM_findObj(n, d) { file://v4.0
	 var p,i,x;  if(!d) d=document;	
	 if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document;
	 n=n.substring(0,p);}
   if(!(x=d[n])&&d.all) x=d.all[n]; for
 (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
   for(i=0;!x&&d.layers&&i<d.layers.length;i++)
 x=MM_findObj(n,d.layers.document);
   if(!x && document.getElementById)
 x=document.getElementById(n); return x;
 }
 
function validZip(frmPostalCode)
{
	if (frmPostalCode.match(/^[0-9]{5}$/)) 
	{
		return true;
	}
	frmPostalCode=frmPostalCode.toUpperCase();
	if (frmPostalCode.match(/^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/)) 
	{
		return true;
	}
	if (frmPostalCode.match(/^[A-Z][0-9][A-Z].[0-9][A-Z][0-9]$/)) 
	{
		return true;
	}
	
	return false;
}
