
function trimLeft(strValue) {
	if (strValue == null) return null;
	if (strValue.length == 0) return strValue;
	for (i=0; i<strValue.length; i++) {
		if (strValue.charAt(i) != ' ')
			return strValue.substr(i);
	}
	return "";
}

function trimRight(strValue) {	
	if (strValue == null) return null;
	if (strValue.length == 0) return strValue;
	for (i=strValue.length-1; i>=0; i--) {
		if (strValue.charAt(i) != ' ')
			return strValue.substring(0, i+1);
	}
	return "";
}

function trim(strValue) {
	return trimRight(trimLeft(strValue));	
}

function isCurrency(strValue)
{
	var re;
	re = /^\$?\d{1,3}(,?\d{3})*(\.\d{1,2})?$/;
	if (strValue.match(re))
		return true;
	else
		return false;
}

function isEmail(strValue)
{
	var re;
//	re = /^[\w-][\w-.]*[\w-]@[\w-][\w-.]*[\w]$/;
	re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if (strValue.match(re))
		return true;
	else
		return false;
}

function isZipCode(strValue)
{
	var re;
	re = /^\d{5}$/;
	if (strValue.match(re))
		return true;
	else
		return false;
}

function isPhoneNumber(strValue)
{
	var re;
	re = /^\d{3}-\d{3}-\d{4}$/;
	if (strValue.match(re))
		return true;
	else
		return false;
}

function isPhoneNumberExt(strValue)
{
	var re;
	re = /^\d{1,5}$/;
	if (strValue.match(re))
		return true;
	else
		return false;
}


function isYearOfExp(strValue)
{
	var re;
	re = /^\d{1,3}$/;
	if(strValue.match(re))
		return true;
	else
		return false;
}

function openDocWindow(strUrl,strWidth,strHeight)
{		
			
	 var subWin = window.open(strUrl,"docWin",
							"toolbar=yes,scrollbars=yes," + 
								"resizable=yes,width=" + strWidth + "," +
									"height=" + strHeight + ",left=0,top=0");		
		
	if(subWin!=null) subWin.focus();
	    	
}

