	function openCommonWindow(strUrl,strWidth,strHeight){		
		
		 var subWin = window.open(strUrl,"MyBenefitsWin",
								"toolbar=yes,scrollbars=yes," + 
									"resizable=yes,width=" + strWidth + "," +
										"height=" + strHeight + ",left=0,top=0");		
	
		if(subWin!=null) subWin.focus();
    	
	}	
	

			
function ValidateStartForm(objForm){
	if (objForm.bs.value.length == 0) {
		alert("Please enter your base salary.");
		objForm.bs.focus();
		return false;	

	}
	if (!CheckNumericField(objForm.bs,objForm.bs.value)) return false;
	if (!CheckNumericField(objForm.bn,objForm.bn.value)) return false;
	return true;
	
}	

function ValidateResultForm(){
	if (!CheckNumericField(document.resultform.k401,document.resultform.k401.value)) return false;
	if (!CheckNumericField(document.resultform.disability,document.resultform.disability.value)) return false;
	if (!CheckNumericField(document.resultform.healthcare,document.resultform.healthcare.value)) return false;
	if (!CheckNumericField(document.resultform.pension,document.resultform.pension.value)) return false;
	if (!CheckNumericField(document.resultform.timeoff,document.resultform.timeoff.value)) return false;
	if (!CheckNumericField(document.resultform.other,document.resultform.other.value)) return false;
	document.resultform.mydata.value="1";
	return true;

}		
			
function CheckNumericField(strCtrl,strValue){
	if (trim(strValue)=="") return true;
	if (isNaN(strValue)){
		alert("Please enter numbers only. Do not use text, commas, or dollar signs.");
		strCtrl.focus();
		return false;
	}
	return true;
}


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 EditBenefits(){
	document.resultform.mydata.value="0";
	document.resultform.action="/mybenefits/layoutscripts/mbfl_result.asp";
	document.resultform.submit();

}	

function EditInput(){
	document.resultform.action="/mybenefits/layoutscripts/mbfl_start.asp";
	document.resultform.submit();

}

function openPSRpopWindow(){
var strHeight = "660";
var strWidth = "740";
//var popunder="/salaryreport/layoutscripts/srpl_overview_pu.asp?r=salpuln";
var popunder="/salaryreport/layoutscripts/srpl_overview.asp?r=salfrln"

PSRWindow=window.open(popunder,"CommonPSRWindow",
								"toolbar=yes,scrollbars=yes,status=yes," + 
									"resizable=yes,width=" + strWidth + "," +
										"height=" + strHeight + ",left=0,top=0");
PSRWindow.focus();
}

function openTinyWin(strUrl,strWindowName,strWidth,strHeight){		
			
	 var subWin = window.open(strUrl,strWindowName,
							"toolbar=no,scrollbars=no," + 
								"resizable=no,width=" + strWidth + "," +
									"height=" + strHeight + ",left=0,top=0");		
		
	if(subWin!=null) subWin.focus;
	    	
}
