function winOpen2(loc) {
  popupWin = window.open(loc, 'ewiz', 'toolbar,status,scrollbars,resizable,width=790,height=580')
}

//New Window opener
function winOpen(loc) {
  popupWin = window.open(loc, 'bap', 'scrollbars,resizable,width=790,height=580,left=1,top=1')
}

//Number Check
function allNum(whatField) {
  var checkOK = "0123456789.";
  var checkStr = document.BAB[whatField].value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid) {
     alert ("This field can only contain numbers! \n\n Please go back and correct this information.")
    document.BAB[whatField].focus()
	return false;
  } else {
  	return true;
  }
}
//function to show current stats of a submition
function ShowFormStats() {
	document.BAB.action = "showFormStats.asp";
	document.BAB.submit();
}

//Commonly used so I added a History -1
function goBack() {
	history.back()
}

//function used when canceling a Brochure Creation
function Cancel() {
	if(confirm("Canceling now will delete all information entered! \n\n To log-out and quit please click \'OK\',\n\n To return to the Build A Brochure click \'Cancel\'")) {
		location.href="logOff.asp";
	}
}

//Used to keep the people that do not understand that they must enter a username AND password in check!!!!!!
function checkLogIn() {
	if (document.LogIn.User.value == "") {
		alert("Please enter your user name")
		document.LogIn.User.focus()
		return false;
	}
	
	if (document.LogIn.Pass.value == "") {
		alert("Please enter your password")
		document.LogIn.Pass.focus()
		return false;
	}
}	


//option(welcome) screen check
function welcomeCheck(){
	if (document.BAB.PlanTitle.value == "") {
		alert("You have not entered a plan name\nPlease go back and enter this information")
		document.BAB.PlanTitle.focus()
		return false;
	}
	
	if (document.BAB.c3Tier.checked) {
		if (!document.BAB.c2Tier.checked) {
			alert("You have selected 3rd Tier Match Formula and not 2nd Tier Match Formula\n2nd Tier Match Formula must be checked to offer 3rd Tier Match Formula.")
			return false;
		}
	}
	
	if (document.BAB.CalendarStartDate.value == "") {
		alert("You have not entered a Calendar Start Date.\nPlease go back and enter this information.")
		document.BAB.CalendarStartDate.focus()
		return false;
	}
	
	if (document.BAB.CalendarEndDate.value == "") {
		alert("You have not entered a Calendar End Date.\nPlease go back and enter this information.")
		document.BAB.CalendarEndDate.focus()
		return false;
	}

	if (document.BAB.c2Tier.checked) {
		document.BAB.OtherEmployerContrib.value = "Company Match";
	} else {
		document.BAB.OtherEmployerContrib.value = "";
	}
}	

function BAB2000Check(){
	//return allNum('CompanyProfitContrib');
	return true;
}

//Admin Scripts
function moveAlong(page) {
	document.Admin.action = page;
	document.Admin.submit();
}	
