var strNonEdu2Code = "ED00";
var strDefaultEducationRelevenceCode = "EDREL04";
var strDefaultInstituteReputationCode = "EDREP6";

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 isPSRRaiseDate(strValue)
{
	var re;
	re=/^(\d{1,2})\/(\d{4})$/;
	
	var aMatch = re.exec(strValue); 
	if (aMatch)
	{
		var oDate = new Date(aMatch[2], aMatch[1] - 1); 
		var intDateFullYear, intDateMonth;
		intDateFullYear = oDate.getFullYear();
		intDateMonth = oDate.getMonth()
		if (!(aMatch[2] == intDateFullYear && aMatch[1] - 1 == intDateMonth))
			return false; 
		else
		{
			var oToday = new Date();
			if (oToday.getFullYear() < intDateFullYear)
				return false;
			else
			{
				if (oToday.getFullYear() == intDateFullYear && oToday.getMonth() < intDateMonth)
					return false;
			}
			
			return true;
		}
	} 
	return false;
}

function isCCNumber(strValue)
{
	var re;
	re = /^\d{13,16}$/;
	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 openCommonWindow(strUrl,strWidth,strHeight)
{		
			
	 var subWin = window.open(strUrl,"subWin",
							"toolbar=yes,scrollbars=yes," + 
								"resizable=yes,width=" + strWidth + "," +
									"height=" + strHeight + ",left=0,top=0");		
		
	if(subWin!=null) subWin.focus();
	    	
}

function getRealBase(strValue)
{
	var strTemp
	strTemp = strValue.replace("$", "");
	strTemp = strTemp.replace(",", "");
	return strTemp;
}
